EDUCAÇÃO E TECNOLOGIA

Dump DYNPRO_MSG_IN_HELP on F4 help for file selection

While processing the “F4” of the file selection using cl_gui_frontend_services=>file_open_dialog, if the user selects nothing and chooses the cancel button, we always want to give a message at this time.

Please don’t try to output an “E” message at your program; otherwise, it will trigger the dump error ‘DYNPRO_MSG_IN_HELP’ with the category ‘Error at Screen Runtime’. Instead of the Error message, just change to the ‘S’ type will do and stop further processing.

Take this as a template for file selection : )

CONSTANTS: c_win_title TYPE string VALUE 'Open Excel Workbook', c_int_dir TYPE string VALUE '/', c_def_filename TYPE string VALUE '*.XLSX' . DATA: g_it_file_table TYPE TABLE OF file_table, g_wa_filetable TYPE file_table, g_usr_act TYPE i, g_rc TYPE i. PARAMETERS: p_file type rlgrap-filename. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. PERFORM f4_excel_file USING p_file. *&---------------------------------------------------------------------*
*& Form F4_EXCEL_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f4_excel_file USING pa_file TYPE localfile. CLEAR: g_wa_filetable,g_rc,g_usr_act. REFRESH: g_it_file_table. CALL METHOD cl_gui_frontend_services=>file_open_dialog EXPORTING window_title = c_win_title default_filename = c_def_filename initial_directory = c_int_dir CHANGING file_table = g_it_file_table rc = g_rc user_action = g_usr_act EXCEPTIONS file_open_dialog_failed = 1 cntl_error = 2 error_no_gui = 3 not_supported_by_gui = 4 OTHERS = 5. IF sy-subrc EQ 0 AND g_usr_act NE cl_gui_frontend_services=>action_cancel. READ TABLE g_it_file_table INTO g_wa_filetable INDEX 1. pa_file = g_wa_filetable. ELSEIF g_usr_act eq cl_gui_frontend_services=>action_cancel. MESSAGE s398(00) WITH text-e64. ENDIF. IF p_file IS INITIAL. MESSAGE s398(00) WITH text-e63. ENDIF.
ENDFORM.