REPORT YDEMO_TEST. PARAMETERS: P_MATNR TYPE MARA-MATNR. TYPES: BEGIN OF TYPE_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM, END OF TYPE_MARA. DATA: T_MARA TYPE STANDARD TABLE OF TYPE_MARA,
W_MARA TYPE TYPE_MARA.
DATA: O_CONTAIN TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: T_FCAT TYPE LVC_T_FCAT,
W_FCAT TYPE LVC_S_FCAT.
DATA: DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER,
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER.
CLASS LCL_EVENT DEFINITION. PUBLIC SECTION. METHODS: EVENT_HANDLE FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
TOP_OF_PAGE1 FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID IMPORTING E_DYNDOC_ID. ENDCLASS. *&---------------------------------------------------------------------* *& CLASS (IMPLEMENTATION) LCL_EVENT *&---------------------------------------------------------------------* * TEXT *----------------------------------------------------------------------* CLASS LCL_EVENT IMPLEMENTATION. METHOD EVENT_HANDLE. CASE E_COLUMN_ID-FIELDNAME. WHEN 'MATNR'. READ TABLE T_MARA INTO W_MARA INDEX E_ROW_ID-INDEX ."TRANSPORTING MATNR. IF SY-SUBRC EQ 0. SET PARAMETER ID 'MAT' FIELD W_MARA-MATNR. CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN. ENDIF. WHEN OTHERS. ENDCASE. ENDMETHOD.
METHOD TOP_OF_PAGE1 . DATA : DL_TEXT(255) TYPE C. "TEXT DATA: LV_DATE TYPE CHAR10.
CALL METHOD DG_DYNDOC_ID->ADD_TEXT EXPORTING TEXT = 'THIS IS DEMO OF TOP OF PAGE THIS IS DEMO OF TOP OF PAGE THIS IS DEMO OF TOP OF PAGE THIS IS DEMO OF TOP OF PAGE THIS IS DEMO OF TOP OF PAGE THIS IS DEMO OF TOP OF PAGE'
SAP_STYLE = CL_DD_AREA=>HEADING. CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CONCATENATE SY-DATUM+6(2) SY-DATUM+4(2) SY-DATUM+0(4) INTO LV_DATE SEPARATED BY '.'. CONCATENATE 'DATE : ' LV_DATE INTO DL_TEXT SEPARATED BY SPACE. CALL METHOD DG_DYNDOC_ID->ADD_TEXT EXPORTING TEXT = DL_TEXT
SAP_STYLE = CL_DD_AREA=>HEADING.
PERFORM F_SET_HEADER_HTML USING DG_DYNDOC_ID. ENDMETHOD. ENDCLASS. "LCL_EVENT
START-OF-SELECTION. CALL SCREEN 100. *&---------------------------------------------------------------------* *& MODULE STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * TEXT *----------------------------------------------------------------------* MODULE STATUS_0100 OUTPUT. IF O_CONTAIN IS INITIAL. SET PF-STATUS 'STATUS'. SET TITLEBAR 'TITLE'. CREATE OBJECT O_CONTAIN EXPORTING
CONTAINER_NAME = 'CONT'. ENDIF. CREATE OBJECT DG_DYNDOC_ID EXPORTING STYLE = 'ALV_GRID'. CREATE OBJECT DG_SPLITTER EXPORTING
PARENT = O_CONTAIN ROWS = 2
COLUMNS = 1. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. CALL METHOD DG_SPLITTER->GET_CONTAINER EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML. CALL METHOD DG_SPLITTER->GET_CONTAINER EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID . CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT EXPORTING ID = 1
HEIGHT = 20. IF SY-SUBRC <> 0. * IMPLEMENT SUITABLE ERROR HANDLING HERE ENDIF.
CASE SY-UCOMM. WHEN 'EXIT' . LEAVE PROGRAM. * WHEN . WHEN OTHERS. ENDCASE. ENDMODULE. *&---------------------------------------------------------------------* *& FORM F_FETCH *&---------------------------------------------------------------------* * TEXT *----------------------------------------------------------------------* * --> P1 TEXT * <-- P2 TEXT *----------------------------------------------------------------------* FORM F_FETCH . SELECT
MATNR
ERSDA
ERNAM FROM MARA INTO TABLE T_MARA UP TO 30 ROWS.. ENDFORM. *&---------------------------------------------------------------------* *& FORM F_BUILD_FCAT *&---------------------------------------------------------------------* * TEXT *----------------------------------------------------------------------* * --> P1 TEXT * <-- P2 TEXT *----------------------------------------------------------------------* FORM F_BUILD_FCAT .
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-KEY = 'X'.
W_FCAT-COLTEXT = 'MATERIAL NUMBER '.
W_FCAT-HOTSPOT = 'X'. APPEND W_FCAT TO T_FCAT. CLEAR W_FCAT.
W_FCAT-FIELDNAME = 'ERSDA'.
W_FCAT-COLTEXT = 'CREATED DATE '. APPEND W_FCAT TO T_FCAT. CLEAR W_FCAT.
W_FCAT-FIELDNAME = 'ERNAM'.
W_FCAT-COLTEXT = 'NAME '. APPEND W_FCAT TO T_FCAT. CLEAR W_FCAT. ENDFORM. *&---------------------------------------------------------------------* *& FORM F_REGISTER_HANDLER *&---------------------------------------------------------------------* * TEXT *----------------------------------------------------------------------* * --> P1 TEXT * <-- P2 TEXT *----------------------------------------------------------------------* FORM F_REGISTER_HANDLER . DATA: O_HANDLE TYPE REF TO LCL_EVENT. CREATE OBJECT O_HANDLE. SET HANDLER O_HANDLE->EVENT_HANDLE FOR O_GRID. SET HANDLER O_HANDLE->TOP_OF_PAGE1 FOR O_GRID.
Social Plugin