0% found this document useful (0 votes)
39 views3 pages

Analayse

This document contains code for handling user commands and events in an ALV grid. It creates objects for the grid and event handling, sets handlers for events, and defines a class with methods that handle specific events like button clicks or user commands to open a form. When the "SMRTFRM" user command is selected, it calls a SUBROUTINE to display a form.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

Analayse

This document contains code for handling user commands and events in an ALV grid. It creates objects for the grid and event handling, sets handlers for events, and defines a class with methods that handle specific events like button clicks or user commands to open a form. When the "SMRTFRM" user command is selected, it calls a SUBROUTINE to display a form.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

MODULE USER_COMMAND_9005 INPUT. CLEAR OK_CODE. OK_CODE = SY-UCOMM. CASE OK_CODE. WHEN 'BACK' OR 'CANCEL' OR 'EXIT'. NUMBER = 9002.

CALL SCREEN 9000. ENDCASE. ENDMODULE.

SET PF-STATUS 'PFGRID'. SET TITLEBAR 'GRID_TITLE'. IF OBJ_CONT IS INITIAL. CREATE OBJECT OBJ_CONT EXPORTING CONTAINER_NAME EXCEPTIONS CNTL_ERROR CNTL_SYSTEM_ERROR CREATE_ERROR LIFETIME_ERROR LIFETIME_DYNPRO_DYNPRO_LINK OTHERS

= 'CONTAINER' = = = = = = 1 2 3 4 5 6.

IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. IF OBJ_GRID IS INITIAL. CREATE OBJECT OBJ_GRID EXPORTING I_PARENT = OBJ_CONT EXCEPTIONS ERROR_CNTL_CREATE = 1 ERROR_CNTL_INIT = 2 ERROR_CNTL_LINK = 3 ERROR_DP_CREATE = 4 OTHERS = 5. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. IF IT_GRID IS NOT INITIAL. WA_LAYOUT-CWIDTH_OPT = 'X'. WA_LAYOUT-KEYHOT = 'X'. CALL METHOD OBJ_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME IS_LAYOUT CHANGING IT_OUTTAB IT_FIELDCATALOG EXCEPTIONS INVALID_PARAMETER_COMBINATION PROGRAM_ERROR TOO_MANY_LINES OTHERS

= 'Z1075_CT_GRID' = WA_LAYOUT = IT_GRID = IT_FIELDCAT = = = = 1 2 3 4.

IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. CREATE OBJECT OBJ_EVENT. SET HANDLER OBJ_EVENT->HOTSPOT_CLICK FOR OBJ_GRID. SET HANDLER OBJ_EVENT->HANDLE_TOOLBAR FOR OBJ_GRID. CALL METHOD OBJ_GRID->SET_TOOLBAR_INTERACTIVE. ENDIF.

&---------------------------------------------------------------------* *& Include Z1075_SALES_CLASS *&--------------------------------------------------------------------* *---------------------------------------------------------------------* * CLASS EVENT_RECEIVER DEFINITION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS EVENT_RECEIVER DEFINITION. PUBLIC SECTION . METHODS : HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO, HANDLE_TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT E_INTERACTIVE, HANDLE_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM. ENDCLASS. "EVENT_RECEIVER DEFINITION *---------------------------------------------------------------------* * CLASS EVENT_RECEIVER IMPLEMENTATION *----------------------------------------------------------------------

* * *---------------------------------------------------------------------* CLASS EVENT_RECEIVER IMPLEMENTATION. METHOD HOTSPOT_CLICK. PERFORM CALL_TRANS_VA03 USING E_ROW_ID E_COLUMN_ID. ENDMETHOD. "HOTSPOT_CLICK METHOD HANDLE_TOOLBAR. * CLEAR E_OBJECT->MT_TOOLBAR. TY_TOOLBAR-BUTN_TYPE = 0. TY_TOOLBAR-FUNCTION = 'SMRTFRM'. TY_TOOLBAR-TEXT = 'FORMS'. TY_TOOLBAR-QUICKINFO = 'Sales Order in SMARTFORMS'. TY_TOOLBAR-DISABLED = ' '. APPEND TY_TOOLBAR TO E_OBJECT->MT_TOOLBAR. CLEAR TY_TOOLBAR. ENDMETHOD. "HANDLE_TOOLBAR METHOD HANDLE_USER_COMMAND. CASE E_UCOMM. WHEN 'SMRTFRM'. PERFORM DISPLAY_FORM. ENDCASE. ENDMETHOD. ENDCLASS.

"HANDLE_USER_COMMAND "EVENT_RECEIVER IMPLEMENTATION

You might also like