*&---------------------------------------------------------------------* *& Report ZSDSHIPMENT_STATUS *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZSDSHIPMENT_STATUS NO STANDARD PAGE HEADING MESSAGE-ID ZSHIPMENT_STATUS . TABLES:LIKP,LIPS. TYPE-POOLS: SLIS. *SELECT-OPTIONS: S_VKORG FOR LIKP-VKORG, * S_VTWEG FOR LIKP-VTWEG, * S_SPART FOR LIKP-SPART, * S_VSTEL FOR LIKP-VSTEL. SELECT-OPTIONS: S_KODAT FOR LIKP-KODAT, S_LDDAT FOR LIKP-LDDAT, S_TDDAT FOR LIKP-TDDAT, S_WADAT FOR LIKP-WADAT, S_LFDAT FOR LIKP-LFDAT. SELECT-OPTIONS: S_VBELN FOR LIKP-VBELN, S_LFART FOR LIKP-LFART. TYPES: BEGIN OF TY_LIKP, VBELN TYPE LIKP-VBELN, WADAT TYPE LIKP-WADAT, TDDAT TYPE LIKP-TDDAT, LFDAT TYPE LIKP-LFDAT, KODAT TYPE LIKP-KODAT, KUNNR TYPE LIKP-KUNNR, END OF TY_LIKP. TYPES: BEGIN OF TY_LIPS, VBELN TYPE LIPS-VBELN, POSNR TYPE LIPS-POSNR, VGBEL TYPE LIPS-VGBEL, VGPOS TYPE LIPS-VGPOS, END OF TY_LIPS. TYPES: BEGIN OF TY_VBKD, VBELN TYPE VBKD-VBELN, POSNR TYPE VBKD-POSNR, BSTKD TYPE VBKD-BSTKD, END OF TY_VBKD. TYPES: BEGIN OF TY_KNA1, KUNNR TYPE KNA1-KUNNR, NAME1 TYPE KNA1-NAME1, END OF TY_KNA1. TYPES: BEGIN OF TY_FINAL, VBELN TYPE LIKP-VBELN, VGBEL TYPE LIPS-VGBEL, BSTKD TYPE VBKD-BSTKD, LFDAT TYPE LIKP-LFDAT, KUNNR TYPE LIKP-KUNNR, NAME1 TYPE KNA1-NAME1, KODAT TYPE LIKP-KODAT, TDDAT TYPE LIKP-TDDAT, WADAT TYPE LIKP-WADAT, END OF TY_FINAL. TYPES: BEGIN OF TY_VTTK, TKNUM TYPE VTTK-TKNUM, SHTYP TYPE VTTK-SHTYP, TPBEZ TYPE VTTK-TPBEZ, TDLNR TYPE VTTK-TDLNR, STTRG TYPE VTTK-STTRG, DPABF TYPE VTTK-DPABF, END OF TY_VTTK. TYPES: BEGIN OF TY_ADRC, LIFNR TYPE LFA1-LIFNR, NAME1 TYPE ADRC-NAME1, END OF TY_ADRC. TYPES: BEGIN OF TY_FINAL1, TKNUM TYPE VTTK-TKNUM, SHTYP TYPE VTTK-SHTYP, TPBEZ TYPE VTTK-TPBEZ, TDLNR TYPE VTTK-TDLNR, STTRG TYPE VTTK-STTRG, DPABF TYPE VTTK-DPABF, LIFNR TYPE LFA1-LIFNR, NAME1 TYPE ADRC-NAME1, END OF TY_FINAL1. DATA: IT_LIKP TYPE STANDARD TABLE OF TY_LIKP, WA_LIKP TYPE TY_LIKP. DATA: IT_LIPS TYPE STANDARD TABLE OF TY_LIPS, WA_LIPS TYPE TY_LIPS. DATA: IT_VBKD TYPE STANDARD TABLE OF TY_VBKD, WA_VBKD TYPE TY_VBKD. DATA: IT_KNA1 TYPE STANDARD TABLE OF TY_KNA1, WA_KNA1 TYPE TY_KNA1. DATA: IT_FINAL TYPE STANDARD TABLE OF TY_FINAL, WA_FINAL TYPE TY_FINAL. DATA: IT_FINAL1 TYPE STANDARD TABLE OF TY_FINAL1, WA_FINAL1 TYPE TY_FINAL1. DATA: IT_VTTK TYPE STANDARD TABLE OF TY_VTTK, WA_VTTK TYPE TY_VTTK. DATA: IT_ADRC TYPE STANDARD TABLE OF TY_ADRC, WA_ADRC TYPE TY_ADRC. DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV. DATA: IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV, WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV. SELECT VBELN WADAT TDDAT LFDAT KODAT KUNNR FROM LIKP INTO TABLE IT_LIKP WHERE VBELN IN S_VBELN AND WADAT IN S_WADAT AND TDDAT IN S_TDDAT AND LFDAT IN S_LFDAT AND KODAT IN S_KODAT. * LOOP AT IT_LIKP INTO WA_LIKP. * WRITE: / WA_LIKP-VBELN. * ENDLOOP. IF SY-SUBRC <> 0. MESSAGE I000(ZSHIPMENT_STATUS). LEAVE LIST-PROCESSING. ENDIF. IF NOT IT_LIKP[] IS INITIAL. SELECT VBELN POSNR VGBEL VGPOS INTO TABLE IT_LIPS FROM LIPS FOR ALL ENTRIES IN IT_LIKP WHERE VBELN = IT_LIKP-VBELN. IF SY-SUBRC <> 0. MESSAGE I001(ZSHIPMENT_STATUS). LEAVE LIST-PROCESSING. else. sort it_lips by vbeln vgbel. DELETE ADJACENT DUPLICATES FROM IT_LIPS COMPARING VBELN VGBEL. ENDIF. ENDIF. *loop at it_lips into wa_lips. *write: / wa_lips-vbeln. *endloop. IF NOT IT_LIPS[] IS INITIAL. SELECT VBELN POSNR BSTKD INTO TABLE IT_VBKD FROM VBKD FOR ALL ENTRIES IN IT_LIPS WHERE POSNR = IT_LIPS-VGPOS. IF SY-SUBRC <> 0. MESSAGE I002(ZSHIPMENT_STATUS). LEAVE LIST-PROCESSING. ENDIF. ENDIF. *loop at it_VBKD into wa_VBKD. *write: / wa_VBKD-vbeln. *endloop. IF NOT IT_LIKP[] IS INITIAL. SELECT KUNNR NAME1 INTO TABLE IT_KNA1 FROM KNA1 FOR ALL ENTRIES IN IT_LIKP WHERE KUNNR = IT_LIKP-KUNNR. IF SY-SUBRC <> 0. MESSAGE I003(ZSHIPMENT_STATUS). LEAVE LIST-PROCESSING. ENDIF. ENDIF. * LOOP AT IT_LIKP INTO WA_LIKP. READ TABLE IT_LIPS INTO WA_LIPS WITH KEY VBELN = WA_LIKP-VBELN. READ TABLE IT_VBKD INTO WA_VBKD WITH KEY posnr = WA_LIPS-VGPOS. READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_LIKP-KUNNR. WA_FINAL-VBELN = WA_LIKP-VBELN. WA_FINAL-VGBEL = WA_LIPS-VGBEL. WA_FINAL-BSTKD = WA_VBKD-BSTKD. WA_FINAL-LFDAT = WA_LIKP-LFDAT. WA_FINAL-KUNNR = WA_LIKP-KUNNR. WA_FINAL-NAME1 = WA_KNA1-NAME1. WA_FINAL-KODAT = WA_LIKP-KODAT. WA_FINAL-TDDAT = WA_LIKP-TDDAT. WA_FINAL-WADAT = WA_LIKP-WADAT. APPEND WA_FINAL TO IT_FINAL. ENDLOOP. *LOOP AT IT_VBKD INTO WA_VBKD. *LOOP AT IT_LIPS INTO WA_LIPS WHERE VGPOS = WA_VBKD-POSNR. *LOOP AT IT_LIKP INTO WA_LIKP WHERE VBELN = WA_LIPS-VBELN. *LOOP AT IT_KNA1 INTO WA_KNA1 WHERE KUNNR = WA_LIKP-KUNNR. *WA_FINAL-VBELN = WA_LIKP-VBELN. *WA_FINAL-VGBEL = WA_LIPS-VGBEL. *WA_FINAL-BSTKD = WA_VBKD-BSTKD. *WA_FINAL-LFDAT = WA_LIKP-LFDAT. *WA_FINAL-KUNNR = WA_LIKP-KUNNR. *WA_FINAL-NAME1 = WA_KNA1-NAME1. *WA_FINAL-KODAT = WA_LIKP-KODAT. *WA_FINAL-TDDAT = WA_LIKP-TDDAT. *WA_FINAL-WADAT = WA_LIKP-WADAT. *APPEND WA_FINAL TO IT_FINAL. *ENDLOOP. *ENDLOOP. *ENDLOOP. *ENDLOOP. *LOOP AT IT_FINAL INTO WA_FINAL. *WRITE: / WA_FINAL-VBELN. *ENDLOOP. SELECT TKNUM SHTYP TPBEZ TDLNR STTRG DPABF FROM VTTK INTO TABLE IT_VTTK. select y~name1 X~LIFNR INTO TABLE it_adrc FROM lfa1 AS x INNER JOIN adrc AS y ON x~adrnr = y~addrnumber FOR ALL ENTRIES IN it_vttk WHERE x~lifnr = it_vttk-tdlnr. *LOOP AT IT_ADRC INTO WA_ADRC. *WRITE: / WA_ADRC-LIFNR, WA_ADRC-NAME1. *ENDLOOP. *SELECT LIFNR * ADRNR * FROM LFA1 * INTO TABLE IT_ * WHERE LIFNR = IT_VTTK-TDLNR. LOOP AT IT_VTTK INTO WA_VTTK. READ TABLE IT_ADRC INTO WA_ADRC WITH KEY LIFNR = WA_VTTK-TDLNR. WA_FINAL1-TKNUM = WA_VTTK-TKNUM. WA_FINAL1-SHTYP = WA_VTTK-SHTYP. WA_FINAL1-TPBEZ = WA_VTTK-TPBEZ. WA_FINAL1-TDLNR = WA_VTTK-TDLNR. WA_FINAL1-STTRG = WA_VTTK-STTRG. WA_FINAL1-DPABF = WA_VTTK-DPABF. WA_FINAL1-NAME1 = WA_ADRC-NAME1. APPEND WA_FINAL1 TO IT_FINAL1. ENDLOOP. WA_FIELDCAT-COL_POS = '1'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'VBELN'. WA_FIELDCAT-SELTEXT_M = 'DELIVERY NUMBER'. WA_FIELDCAT-OUTPUTLEN = '15'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '2'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'LFDAT'. WA_FIELDCAT-SELTEXT_M = 'DELIVERY DATE'. WA_FIELDCAT-OUTPUTLEN = '15'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '3'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'TDDAT'. WA_FIELDCAT-SELTEXT_M = 'PLANNING DATE'. WA_FIELDCAT-OUTPUTLEN = '15'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '4'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'WADAT'. WA_FIELDCAT-SELTEXT_M = 'MOVEMENT DATE'. WA_FIELDCAT-OUTPUTLEN = '15'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '5'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'KODAT'. WA_FIELDCAT-SELTEXT_M = 'PICK DATE'. WA_FIELDCAT-OUTPUTLEN = '10'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '6'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'KUNNR'. WA_FIELDCAT-SELTEXT_M = 'PARTY NUMBER'. WA_FIELDCAT-OUTPUTLEN = '15'. WA_FIELDCAT-DO_SUM = 'X'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '7'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'VGBEL'. WA_FIELDCAT-SELTEXT_M = 'SALES ORDER'. WA_FIELDCAT-OUTPUTLEN = '15'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '8'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'BSTKD'. WA_FIELDCAT-SELTEXT_M = 'PURCHASE ORDER NUM'. WA_FIELDCAT-OUTPUTLEN = '17'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. WA_FIELDCAT-COL_POS = '9'. WA_FIELDCAT-TABNAME = 'IT_FINAL'. WA_FIELDCAT-FIELDNAME = 'NAME1'. WA_FIELDCAT-SELTEXT_M = 'SHIP TO PARTY NAME'. WA_FIELDCAT-OUTPUTLEN = '17'. WA_FIELDCAT-JUST = 'L'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = SY-REPID I_CALLBACK_PF_STATUS_SET = 'SET_STATUS' I_CALLBACK_USER_COMMAND = 'USER_COMMAND' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = * IS_LAYOUT = IT_FIELDCAT = IT_FIELDCAT * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = IT_FINAL EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. FORM SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB. . SET PF-STATUS 'SHOW DELIVERY'. ENDFORM. form user_command using V_UCOMM LIKE SY-UCOMM SEL_FLD TYPE SLIS_SELFIELD. CASE V_UCOMM. WHEN 'SHOW_DEL'. read table it_final into wa_final index sel_fld-tabindex. SET PARAMETER ID 'VL' field wa_final-VBELN. CALL TRANSACTION 'VL03N' and skip first screen. WHEN '&IC1' OR 'SHOW_SHIP'. PERFORM DISPLAY. endcase. endform. *&---------------------------------------------------------------------* *& Form DISPLAY *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM DISPLAY . CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING I_PROGRAM_NAME = SY-REPID I_INTERNAL_TABNAME = 'IT_FINAL1' I_STRUCTURE_NAME = 'ZSHIP_FINAL' * I_CLIENT_NEVER_DISPLAY = 'X' * I_INCLNAME = * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = CHANGING CT_FIELDCAT = IT_FIELDCAT1 EXCEPTIONS INCONSISTENT_INTERFACE = 1 PROGRAM_ERROR = 2 OTHERS = 3 . 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 FUNCTION 'REUSE_ALV_POPUP_TO_SELECT' EXPORTING * I_TITLE = * I_SELECTION = 'X' * I_ALLOW_NO_SELECTION = * I_ZEBRA = ' ' * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_CHECKBOX_FIELDNAME = * I_LINEMARK_FIELDNAME = * I_SCROLL_TO_SEL_LINE = 'X' I_TABNAME = 'IT_FINAL1' I_STRUCTURE_NAME = 'ZSHIP_FINAL' IT_FIELDCAT = IT_FIELDCAT1 * IT_EXCLUDING = I_CALLBACK_PROGRAM = SY-REPID * I_CALLBACK_USER_COMMAND = * IS_PRIVATE = * IMPORTING * ES_SELFIELD = * E_EXIT = TABLES T_OUTTAB = IT_FINAL1 EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. " DISPLAY
Serkan AKKAVAK Computer Engineer ABAP Developer & SAP MM SD Consultant Contact : serkurumsal@yandex.com
Social Plugin