‎2008 Aug 22 10:40 AM
hi
i have 2 parameters on my selection screen, p_file and p_file2
I am retrieving the path for p_file
and p_file2 copies this path.
after, if the user wants to modify the path in p_file2, there should be a popup to confirm if he wants the path to change
I was able to retrieve the path for p_file, p_file2 copies p_file but I cant cater for the change in path for p_file2.
see my code below
plz help
AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_filetab
rc = v_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
READ TABLE lt_filetab INTO ls_filetab INDEX 1.
IF sy-subrc = 0.
p_file = ls_filetab-filename.
CONCATENATE l_text1 l_text2 '_be' l_text4 INTO l_newfile.
TRANSLATE l_newfile TO UPPER CASE.
MOVE l_newfile TO l_file.
move 'P_FILE2' to wa_dynpread-fieldname.
move l_file to wa_dynpread-fieldvalue.
append wa_dynpread to it_dynpread.
move 'P_FILE' to wa_dynpread-fieldname.
move p_file to wa_dynpread-fieldvalue.
append wa_dynpread to it_dynpread.
ENDIF.
AT SELECTION-SCREEN.
p_file2 = l_file.
AT SELECTION-SCREEN ON p_file2.
loop at it_dynpread into wa_dynpread.
case wa_dynpread-fieldname.
when 'P_FILE'.
p_file = wa_dynpread-fieldvalue.
when 'P_FILE2'.
p_file2 = wa_dynpread-fieldvalue.
endcase.
endloop.
IF p_file2 NE l_newfile.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Do u want to overwrite the file'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'
DISPLAY_CANCEL_BUTTON = 'X'
IMPORTING
ANSWER = l_answer
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
.
IF l_answer = '2'.
p_file2 = l_newfile.
ELSE.
p_file2 = p_file2.
ENDIF.
ENDIF.
‎2008 Aug 22 10:43 AM
Hi,
Try this.
Change this code in ur pgm
IF l_answer = '2'.
p_file2 = l_newfile.
ELSE.
p_file2 = p_file2.
ENDIF.
to the below code and try it. Check the answer in the sy-subrc itself.
if sy-subrc eq 0.
IF l_answer = '1'
p_file2 = l_newfile.
ELSE.
p_file2 = p_file2.
ENDIF.
endif.
Sharin.
‎2008 Aug 22 10:43 AM
Hi,
Try this.
Change this code in ur pgm
IF l_answer = '2'.
p_file2 = l_newfile.
ELSE.
p_file2 = p_file2.
ENDIF.
to the below code and try it. Check the answer in the sy-subrc itself.
if sy-subrc eq 0.
IF l_answer = '1'
p_file2 = l_newfile.
ELSE.
p_file2 = p_file2.
ENDIF.
endif.
Sharin.