SELECT-OPTIONS : S_VKORG FOR VBAK-VKORG, " Sales organization S_KUNNR FOR VBAK-KUNNR, " Sold-to party S_VBELN FOR VBAK-VBELN. " Sales document
SELECTION-SCREEN : SKIP, BEGIN OF LINE,COMMENT 5(27) V_1 FOR FIELD P_MAX. PARAMETERS P_MAX(2) TYPE N DEFAULT '20' OBLIGATORY. SELECTION-SCREEN END OF LINE.
DATA: * Data displayed in the first list BEGIN OF GT_VBAK OCCURS 0, * CHECKBOX, VKORG LIKE VBAK-VKORG, " Sales organization KUNNR LIKE VBAK-KUNNR, " Sold-to party VBELN LIKE VBAK-VBELN, " Sales document NETWR LIKE VBAK-NETWR, " Net Value of the Sales Order END OF GT_VBAK,
* Data displayed in the popup list BEGIN OF GT_VBAP OCCURS 0, POSNR LIKE VBAP-POSNR, " Sales document item MATNR LIKE VBAP-MATNR, " Material number ARKTX LIKE VBAP-ARKTX, " Short text for sales order item KWMENG LIKE VBAP-KWMENG, " Order quantity NETWR LIKE VBAP-NETWR, " Net value of the order item END OF GT_VBAP, GS_LAYOUT TYPE SLIS_LAYOUT_ALV. DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
*---------------------------------------------------------------------* * Form f_read_data_vbak *---------------------------------------------------------------------* FORM F_READ_DATA_VBAK.
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_VBAK FROM VBAK UP TO P_MAX ROWS WHERE KUNNR IN S_KUNNR AND VBELN IN S_VBELN AND VKORG IN S_VKORG.
ENDFORM. " F_READ_DATA_VBAK *---------------------------------------------------------------------* * Form f_display_data_vbak *---------------------------------------------------------------------* FORM F_DISPLAY_DATA_VBAK.
* DATA: * LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, * LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
* GS_LAYOUT-SEL_MODE = 'A'. * Display the first list CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SY-CPROG I_CALLBACK_USER_COMMAND = 'USER_COMMAND' IT_FIELDCAT = LT_FIELDCAT IS_LAYOUT = GS_LAYOUT TABLES T_OUTTAB = GT_VBAK.
ENDFORM. " F_DISPLAY_DATA_VBAK *---------------------------------------------------------------------* * FORM USER_COMMAND * *---------------------------------------------------------------------* FORM USER_COMMAND USING U_UCOMM LIKE SY-UCOMM US_SELFIELD TYPE SLIS_SELFIELD.
CASE U_UCOMM. WHEN '&IC1'. READ TABLE GT_VBAK INDEX US_SELFIELD-TABINDEX. CHECK SY-SUBRC EQ 0. PERFORM F_READ_DATA_VBAP. " Read data from VBAP PERFORM F_DISPLAY_DATA_VBAP. ENDCASE.
ENDFORM. " USER_COMMAND *---------------------------------------------------------------------* * Form f_read_data_vbap *---------------------------------------------------------------------* FORM F_READ_DATA_VBAP.
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_VBAP FROM VBAP WHERE VBELN = GT_VBAK-VBELN.
ENDFORM. " F_READ_DATA_VBAP *---------------------------------------------------------------------* * Form f_display_data_vbap *---------------------------------------------------------------------* FORM F_DISPLAY_DATA_VBAP.
DATA: LS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT, LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
Social Plugin