Hi to all experts,
my requirement is download a file at the application server with the physical inventory document no
for example the 123149394.txt that i have done if the already exist then i have to give a message to the user that the file already exist , for that i have used the fm POPUP_WITH_2_BUTTONS_TO_CHOOSE yes or no (2 buttons) but the problem know is that if there are 1000 files than the users have to click 1000 times yes or no . I have display all the files at once and ask user just once for yes or no
here is my code please can u help me with this requirement.
LOOP AT it_output INTO wa_output.
CONCATENATE wa_output-iblnr 'txt' INTO f_filename SEPARATED BY '.'.
CONCATENATE p_file '\' wa_output-iblnr '.txt' INTO fname.
*checking whether file exist already in the directory
READ TABLE it_filelist INTO wa_filelist
WITH KEY name = f_filename BINARY SEARCH.
IF sy-subrc EQ 0.
* if the file already exist giving message.
PERFORM popup_to_confirm.
IF gc_answer EQ '1'.
OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
PERFORM transfer_file.
ELSE.
CONTINUE.
ENDIF.
ELSE.
OPEN DATASET fname FOR APPENDING IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
PERFORM transfer_file.
ENDIF.
ENDIF.
CLOSE DATASET fname.
CLEAR: wa_output,f_filename, wa_filelist,gc_answer.
ENDLOOP.
FORM popup_to_confirm .
CALL FUNCTION 'POPUP_WITH_2_BUTTONS_TO_CHOOSE'
EXPORTING
DEFAULTOPTION = '1'
diagnosetext1 = text-005
DIAGNOSETEXT2 = 'Enter Yes Or NO'
DIAGNOSETEXT3 = 'YES'
textline1 = 'Enter Yes Or NO'
TEXTLINE2 = ' '
TEXTLINE3 = ' '
text_option1 = 'YES'
text_option2 = 'NO'
titel = 'FILE ALREADY EXIST DO WANT TO CONTINUE'
IMPORTING
answer = gc_answer
.
ENDFORM. " popup_to_confirm
&----
*& Form delimit_file
&----
FORM transfer_file .
DATA: output TYPE string.
CONCATENATE wa_output-iblnr
wa_output-zeili
wa_output-matnr
wa_output-werks
wa_output-lgort
wa_output-bstar
wa_output-erfme
wa_output-maktx
wa_output-lgpbe
INTO output SEPARATED BY '|'.
transfering the file contents to the
TRANSFER output TO fname .
ENDFORM.