*&---------------------------------------------------------------------* *& Report Name : /EUTIN/DEMO_FUNCTION_KEY *& Title : Demo: Provide Funtion Key to Display Message *& Developer : Michael Eutin - 01.05.2019 *& Development Class : TEUTIN_LOCAL *& Description : *& Provide customer function key on selection screen 1000 and *& display message while function key was pushed *& *&---------------------------------------------------------------------* *& CHANGE HISTORY *&---------------------------------------------------------------------* *& Date Description *&---------------------------------------------------------------------* *& *& *& *&---------------------------------------------------------------------* REPORT /eutin/demo_function_key NO STANDARD PAGE HEADING. *----------------------------------------------------------------------* *--- Global Data Declarations *----------------------------------------------------------------------* TABLES: sscrfields. *---------------------------------------------------------------------- *--- Selection-Screen 1000 *---------------------------------------------------------------------- SELECTION-SCREEN: FUNCTION KEY 1. SELECTION-SCREEN BEGIN OF BLOCK sel WITH FRAME TITLE TEXT-sel. PARAMETERS: p_test AS CHECKBOX DEFAULT 'X'. SELECTION-SCREEN END OF BLOCK sel. *---------------------------------------------------------------------- *--- Event INITIALIZATION *---------------------------------------------------------------------- INITIALIZATION. PERFORM init. *---------------------------------------------------------------------- *--- Event Screen 1000: Process After Input (PAI) *---------------------------------------------------------------------- AT SELECTION-SCREEN. PERFORM pai_1000. *---------------------------------------------------------------------- *--- Event START-OF-SELECTION *---------------------------------------------------------------------- START-OF-SELECTION. PERFORM main. *---------------------------------------------------------------------- *--- Event END-OF-SELECTION *---------------------------------------------------------------------- END-OF-SELECTION. RETURN. *---------------------------------------------------------------------- *--- FORM-Routinen *---------------------------------------------------------------------- *&---------------------------------------------------------------------* *& Form INIT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM init. DATA lv_rsfunc_txt TYPE rsfunc_txt. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *--- default selection parameters p_test = abap_true. *--- add icon to button for "Message" CLEAR lv_rsfunc_txt. CALL FUNCTION 'ICON_CREATE' EXPORTING name = icon_information * Text = 'Message' info = 'Message'(i01) add_stdinf = space IMPORTING result = lv_rsfunc_txt EXCEPTIONS icon_not_found = 1 outputfield_too_short = 2 OTHERS = 3. IF sy-subrc NE 0. lv_rsfunc_txt = '@0S@'. ENDIF. sscrfields-functxt_01 = lv_rsfunc_txt. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ENDFORM. " INIT *&---------------------------------------------------------------------* *& Form PAI_1000 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM pai_1000. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CASE sy-ucomm. WHEN 'FC01'. MESSAGE 'Function Key #1 has been pressed'(001) TYPE 'I'. RETURN. WHEN OTHERS. RETURN. ENDCASE. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ENDFORM. " PAI_1000 *&---------------------------------------------------------------------* *& Form MAIN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM main. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CASE p_test. WHEN abap_true. MESSAGE 'Test Mode is Active'(002) TYPE 'S'. WHEN OTHERS. MESSAGE 'Done'(003) TYPE 'S'. ENDCASE. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ENDFORM. " MAIN *--- The End!