Skip to Content
Sometime, we want to know if one particular program or transaction have been transported to QAS or PRD…But we usually do is go to SE10 transaction, look for the orders and check all of them to see when and where they were transported.   That’s why I decided to develop a small program that giving a program or transaction, lists all related transport orders along with they’re descriptions and information about if they were either transported to QAS or PRD, when they were transported and a what time.   This is aimed for beginners or for people like me, who enjoys developing stuff using ABAP. Here’s the source code…   Z_TRANPORT_ORDERS    REPORT Z_TRANPORT_ORDERS NO STANDARD PAGE HEADING MESSAGE-ID ZMM.  *—————————————————————- * *  TYPES                                                          * *—————————————————————- * TYPES: BEGIN OF TY_E071,        TRKORR TYPE E071-TRKORR,        OBJECT TYPE E071-OBJECT,        OBJ_NAME TYPE E071-OBJ_NAME,        END OF TY_E071.  TYPES: BEGIN OF TY_E071_ENTRY,        TRKORR TYPE E071-TRKORR,        END OF TY_E071_ENTRY.  TYPES: BEGIN OF TY_E070,        TRKORR TYPE E070-TRKORR,        TRSTATUS TYPE E070-TRSTATUS,        TARSYSTEM TYPE E070-TARSYSTEM,        AS4USER TYPE E070-AS4USER,        AS4DATE TYPE E070-AS4DATE,        AS4TIME TYPE E070-AS4TIME,        AS4TEXT TYPE E07T-AS4TEXT,        END OF TY_E070.  TYPES: BEGIN OF CTSLG_ACTION,        DATE LIKE TSTRFCOFIL-TRDATE,        TIME LIKE TSTRFCOFIL-TRTIME,        RC LIKE TSTRFCOFIL-RETCODE,        END OF CTSLG_ACTION,         CTSLG_ACTIONS TYPE SORTED TABLE OF CTSLG_ACTION                                  WITH UNIQUE KEY DATE TIME                                  INITIAL SIZE 2,        BEGIN OF CTSLG_STEP,        CLIENTID LIKE TSTRFCOFIL-TARCLIENT,        STEPID LIKE TSTRFCOFIL-FUNCTION,        RC LIKE TSTRFCOFIL-RETCODE,        ACTIONS TYPE CTSLG_ACTIONS,        END OF CTSLG_STEP,         CTSLG_STEPS TYPE CTSLG_STEP OCCURS 10,         BEGIN OF CTSLG_SYSTEM,        SYSTEMID LIKE TSTRFCOFIL-TARSYSTEM,        RC LIKE TSTRFCOFIL-RETCODE,        STEPS TYPE CTSLG_STEPS,        END OF CTSLG_SYSTEM,         CTSLG_SYSTEMS TYPE CTSLG_SYSTEM OCCURS 10,         BEGIN OF CTSLG_MERGELINE,        TRKORR TYPE TRKORR,        RC LIKE TSTRFCOFIL-RETCODE,        END OF CTSLG_MERGELINE,         CTSLG_MERGELINES TYPE CTSLG_MERGELINE OCCURS 0,         BEGIN OF CTSLG_COFILE,        EXISTS TYPE C,        IMPORTED TYPE C,        DEL_LINES_ONLY TYPE C,        SYSTEMS TYPE CTSLG_SYSTEMS,        MERGES TYPE CTSLG_MERGELINES,        RC TYPE I,        END OF CTSLG_COFILE.  *—————————————————————- * * INTERNAL TABLES                                                 * *—————————————————————- * DATA: T_E071 TYPE STANDARD TABLE OF TY_E071 WITH HEADER LINE,       T_E070 TYPE STANDARD TABLE OF TY_E070 WITH HEADER LINE,       T_E071_ENTRY TYPE STANDARD TABLE OF TY_E071_ENTRY       WITH HEADER LINE,       DOMA_VALUES TYPE STANDARD TABLE OF RPY_DVAL WITH HEADER LINE,       ES_COFILE TYPE STANDARD TABLE OF CTSLG_COFILE WITH HEADER LINE,       ES_SYSTEMS TYPE STANDARD TABLE OF CTSLG_SYSTEM,       WA_SYSTEMS TYPE CTSLG_SYSTEMS WITH HEADER LINE,       ES_STEPS TYPE CTSLG_STEPS,       WA_STEPS TYPE CTSLG_STEPS WITH HEADER LINE,       ES_ACTIONS TYPE CTSLG_ACTIONS,       WA_ACTIONS TYPE CTSLG_ACTIONS WITH HEADER LINE.  *—————————————————————- * *  VARIABLES                                                      * *—————————————————————- * DATA: W_PGMNA TYPE TSTC-PGMNA,       W_NAME(41) TYPE C,       W_FLAG TYPE C.  *—————————————————————- * *  FIELD-SYMBOLS                                                  * *—————————————————————- * FIELD-SYMBOLS:  LIKE LINE OF T_E070.  *—————————————————————- * *   SELECTION-SCREEN                                              * *—————————————————————- * SELECTION-SCREEN BEGIN OF BLOCK DATA. PARAMETERS:             P_TCODE LIKE TSTC-TCODE,             P_PGMNA LIKE TSTC-PGMNA. SELECTION-SCREEN END OF BLOCK DATA.  *——————————————————————— * *   START-OF-SELECTION                                                 * *——————————————————————— * START-OF-SELECTION.    PERFORM VALIDATE_ENTRY.   IF W_FLAG EQ SPACE.     PERFORM GET_ORDERS.     PERFORM PRINT_ORDERS.   ENDIF.  *&——————————————————————– * *&      Form  VALIDATE_ENTRY                                           * *&——————————————————————– * FORM VALIDATE_ENTRY.    IF P_TCODE NE SPACE.     SELECT SINGLE PGMNA     INTO W_PGMNA     FROM TSTC     WHERE TCODE EQ P_TCODE.     IF SY-SUBRC EQ 0.       W_FLAG = SPACE.     ELSE.       MESSAGE S008 WITH ‘Requested transacction don”t exist’.       W_FLAG = ‘X’.     ENDIF.   ELSEIF P_PGMNA NE SPACE.     SELECT SINGLE PGMNA     INTO W_PGMNA     FROM TSTC     WHERE PGMNA EQ P_PGMNA.     IF SY-SUBRC EQ 0.       W_FLAG = SPACE.     ELSE.       MESSAGE S008 WITH ‘Requested program don”t exist’.       W_FLAG = ‘X’.     ENDIF.   ENDIF.  ENDFORM.  *&————————————————————— * *&      Form  GET_ORDERS                                          * *&————————————————————— * FORM GET_ORDERS.    CALL FUNCTION ‘RPY_DOMAIN_READ’        EXPORTING             DOMA_NAME        = ‘TRSTATUS’             LANGUAGE         = SY-LANGU        TABLES             DOMA_VALUES      = DOMA_VALUES        EXCEPTIONS             CANCELLED        = 1             NOT_FOUND        = 2             PERMISSION_ERROR = 3             ILLEGAL_TYPE     = 4             OTHERS           = 5.    CONCATENATE W_PGMNA ‘%’   INTO W_NAME.    SELECT TRKORR OBJECT OBJ_NAME   INTO TABLE T_E071   FROM E071   WHERE OBJ_NAME LIKE W_NAME     AND OBJECT EQ ‘REPS’.    IF NOT T_E071[] IS INITIAL.     LOOP AT T_E071 ASSIGNING  TO T_E071_ENTRY.       APPEND T_E071_ENTRY.     ENDLOOP.      SORT T_E071_ENTRY.     DELETE ADJACENT DUPLICATES FROM T_E071_ENTRY.      IF NOT T_E071_ENTRY[] IS INITIAL.       SELECT E070~TRKORR TRSTATUS TARSYSTEM              AS4USER AS4DATE AS4TIME              AS4TEXT       INTO TABLE T_E070       FROM ( E070 INNER JOIN E07T              ON E070~TRKORR EQ E07T~TRKORR )       FOR ALL ENTRIES IN T_E071_ENTRY       WHERE E070~TRKORR EQ T_E071_ENTRY-TRKORR         AND LANGU EQ SY-LANGU.        SORT T_E070 BY AS4DATE AS4TIME DESCENDING.      ENDIF.   ENDIF.  ENDFORM.  *&————————————————————— * *&      Form  PRINT_ORDERS                                        * *&————————————————————— * FORM PRINT_ORDERS.    DATA: W_TRKORR TYPE E070-TRKORR.    WRITE:1 ‘Order’,12 ‘Status’,22 ‘Destination’,         35 ‘Name’,96 ‘Date’,108 ‘Time’.    LOOP AT T_E070 ASSIGNING  REPORT Z_TRANPORT_ORDERS NO STANDARD PAGE HEADING MESSAGE-ID ZMM.  *—————————————————————- * *  TYPES                                                          * *—————————————————————- * TYPES: BEGIN OF TY_E071,        TRKORR TYPE E071-TRKORR,        OBJECT TYPE E071-OBJECT,        OBJ_NAME TYPE E071-OBJ_NAME,        END OF TY_E071.  TYPES: BEGIN OF TY_E071_ENTRY,        TRKORR TYPE E071-TRKORR,        END OF TY_E071_ENTRY.  TYPES: BEGIN OF TY_E070,        TRKORR TYPE E070-TRKORR,        TRSTATUS TYPE E070-TRSTATUS,        TARSYSTEM TYPE E070-TARSYSTEM,        AS4USER TYPE E070-AS4USER,        AS4DATE TYPE E070-AS4DATE,        AS4TIME TYPE E070-AS4TIME,        AS4TEXT TYPE E07T-AS4TEXT,        END OF TY_E070.  TYPES: BEGIN OF CTSLG_ACTION,        DATE LIKE TSTRFCOFIL-TRDATE,        TIME LIKE TSTRFCOFIL-TRTIME,        RC LIKE TSTRFCOFIL-RETCODE,        END OF CTSLG_ACTION,         CTSLG_ACTIONS TYPE SORTED TABLE OF CTSLG_ACTION                                  WITH UNIQUE KEY DATE TIME                                  INITIAL SIZE 2,        BEGIN OF CTSLG_STEP,        CLIENTID LIKE TSTRFCOFIL-TARCLIENT,        STEPID LIKE TSTRFCOFIL-FUNCTION,        RC LIKE TSTRFCOFIL-RETCODE,        ACTIONS TYPE CTSLG_ACTIONS,        END OF CTSLG_STEP,         CTSLG_STEPS TYPE CTSLG_STEP OCCURS 10,         BEGIN OF CTSLG_SYSTEM,        SYSTEMID LIKE TSTRFCOFIL-TARSYSTEM,        RC LIKE TSTRFCOFIL-RETCODE,        STEPS TYPE CTSLG_STEPS,        END OF CTSLG_SYSTEM,         CTSLG_SYSTEMS TYPE CTSLG_SYSTEM OCCURS 10,         BEGIN OF CTSLG_MERGELINE,        TRKORR TYPE TRKORR,        RC LIKE TSTRFCOFIL-RETCODE,        END OF CTSLG_MERGELINE,         CTSLG_MERGELINES TYPE CTSLG_MERGELINE OCCURS 0,         BEGIN OF CTSLG_COFILE,        EXISTS TYPE C,        IMPORTED TYPE C,        DEL_LINES_ONLY TYPE C,        SYSTEMS TYPE CTSLG_SYSTEMS,        MERGES TYPE CTSLG_MERGELINES,        RC TYPE I,        END OF CTSLG_COFILE.  TYPES: BEGIN OF TY_REPORT,        TRKORR TYPE E070-TRKORR,        DDTEXT TYPE RPY_DVAL-DDTEXT,        SYSTEMID TYPE TSTRFCOFIL-TARSYSTEM,        AS4TEXT TYPE E07T-AS4TEXT,        DATE TYPE SY-DATUM,        TIME TYPE SY-UZEIT,        END OF TY_REPORT.  *—————————————————————- * * INTERNAL TABLES                                                 * *—————————————————————- * DATA: T_E071 TYPE STANDARD TABLE OF TY_E071 WITH HEADER LINE,       T_E070 TYPE STANDARD TABLE OF TY_E070 WITH HEADER LINE,       T_E071_ENTRY TYPE STANDARD TABLE OF TY_E071_ENTRY       WITH HEADER LINE,       DOMA_VALUES TYPE STANDARD TABLE OF RPY_DVAL WITH HEADER LINE,       ES_COFILE TYPE STANDARD TABLE OF CTSLG_COFILE WITH HEADER LINE,       ES_SYSTEMS TYPE STANDARD TABLE OF CTSLG_SYSTEM,       WA_SYSTEMS TYPE CTSLG_SYSTEMS WITH HEADER LINE,       ES_STEPS TYPE CTSLG_STEPS,       WA_STEPS TYPE CTSLG_STEPS WITH HEADER LINE,       ES_ACTIONS TYPE CTSLG_ACTIONS,       WA_ACTIONS TYPE CTSLG_ACTIONS WITH HEADER LINE,       T_REPORT TYPE STANDARD TABLE OF TY_REPORT WITH HEADER LINE.  *—————————————————————- * *  VARIABLES                                                      * *—————————————————————- * DATA: W_PGMNA TYPE TSTC-PGMNA,       W_NAME(41) TYPE C,       W_FLAG TYPE C,       GS_FIELDCAT TYPE LVC_S_FCAT,       GT_FIELDCAT_REP TYPE LVC_T_FCAT,       CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,       MYCONTAINER TYPE SCRFNAME VALUE ‘CONTAINER’,       GRID_ORDERS TYPE REF TO CL_GUI_ALV_GRID,       GS_SORT_REP TYPE LVC_S_SORT,       GT_SORT_REP TYPE LVC_T_SORT.  *—————————————————————- * *  FIELD-SYMBOLS                                                  * *—————————————————————- * FIELD-SYMBOLS:  LIKE LINE OF T_E070.  *—————————————————————- * *   SELECTION-SCREEN                                              * *—————————————————————- * SELECTION-SCREEN BEGIN OF BLOCK DATA. PARAMETERS:             P_TCODE LIKE TSTC-TCODE,             P_PGMNA LIKE TSTC-PGMNA. SELECTION-SCREEN END OF BLOCK DATA.  *——————————————————————— * *   START-OF-SELECTION                                                 * *——————————————————————— * START-OF-SELECTION.    PERFORM VALIDATE_ENTRY.   IF W_FLAG EQ SPACE.     PERFORM GET_ORDERS.     PERFORM PRINT_ORDERS.   ENDIF.  *&——————————————————————– * *&      Form  VALIDATE_ENTRY                                           * *&——————————————————————– * FORM VALIDATE_ENTRY.    IF P_TCODE NE SPACE.     SELECT SINGLE PGMNA     INTO W_PGMNA     FROM TSTC     WHERE TCODE EQ P_TCODE.     IF SY-SUBRC EQ 0.       W_FLAG = SPACE.     ELSE.       MESSAGE S008 WITH ‘Requested transacction don”t exist’.       W_FLAG = ‘X’.     ENDIF.   ELSEIF P_PGMNA NE SPACE.     SELECT SINGLE PGMNA     INTO W_PGMNA     FROM TSTC     WHERE PGMNA EQ P_PGMNA.     IF SY-SUBRC EQ 0.       W_FLAG = SPACE.     ELSE.       MESSAGE S008 WITH ‘Requested program don”t exist’.       W_FLAG = ‘X’.     ENDIF.   ENDIF.  ENDFORM.  *&————————————————————— * *&      Form  GET_ORDERS                                          * *&————————————————————— * FORM GET_ORDERS.    CALL FUNCTION ‘RPY_DOMAIN_READ’        EXPORTING             DOMA_NAME        = ‘TRSTATUS’             LANGUAGE         = SY-LANGU        TABLES             DOMA_VALUES      = DOMA_VALUES        EXCEPTIONS             CANCELLED        = 1             NOT_FOUND        = 2             PERMISSION_ERROR = 3             ILLEGAL_TYPE     = 4             OTHERS           = 5.    CONCATENATE W_PGMNA ‘%’   INTO W_NAME.    SELECT TRKORR OBJECT OBJ_NAME   INTO TABLE T_E071   FROM E071   WHERE OBJ_NAME LIKE W_NAME     AND OBJECT EQ ‘REPS’.    IF NOT T_E071[] IS INITIAL.     LOOP AT T_E071 ASSIGNING  TO T_E071_ENTRY.       APPEND T_E071_ENTRY.     ENDLOOP.      SORT T_E071_ENTRY.     DELETE ADJACENT DUPLICATES FROM T_E071_ENTRY.      IF NOT T_E071_ENTRY[] IS INITIAL.       SELECT E070~TRKORR TRSTATUS TARSYSTEM              AS4USER AS4DATE AS4TIME              AS4TEXT       INTO TABLE T_E070       FROM ( E070 INNER JOIN E07T              ON E070~TRKORR EQ E07T~TRKORR )       FOR ALL ENTRIES IN T_E071_ENTRY       WHERE E070~TRKORR EQ T_E071_ENTRY-TRKORR         AND LANGU EQ SY-LANGU.        SORT T_E070 BY AS4DATE AS4TIME DESCENDING.      ENDIF.   ENDIF.  ENDFORM.  *&————————————————————— * *&      Form  PRINT_ORDERS                                        * *&————————————————————— * FORM PRINT_ORDERS.    DATA: W_TRKORR TYPE E070-TRKORR.    LOOP AT T_E070 ASSIGNING -AS4TEXT TO T_REPORT-AS4TEXT.         MOVE WA_ACTIONS-DATE TO T_REPORT-DATE.         MOVE WA_ACTIONS-TIME TO T_REPORT-TIME.         APPEND T_REPORT.       ENDLOOP.     ENDLOOP.   ENDLOOP.    PERFORM FILL_CATALOG.   PERFORM CALL_ALV.    CALL SCREEN 0100.  ENDFORM.  *&———————————————————- * *&      Form  FILL_CATALOG                                   * *&———————————————————- * FORM FILL_CATALOG.    DATA: GS_FIELDCAT_ADD TYPE LVC_S_FCAT.    CLEAR GS_FIELDCAT.   GS_FIELDCAT-COL_POS   = 1.   GS_FIELDCAT-REPTEXT   = ‘Order’.   GS_FIELDCAT-FIELDNAME = ‘TRKORR’.   GS_FIELDCAT-TABNAME = ‘T_REPORT’.   GS_FIELDCAT-OUTPUTLEN = ’12’.   APPEND GS_FIELDCAT TO GT_FIELDCAT_REP.    CLEAR GS_FIELDCAT.   GS_FIELDCAT-COL_POS   = 2.   GS_FIELDCAT-REPTEXT   = ‘Status’.   GS_FIELDCAT-FIELDNAME = ‘DDTEXT’.   GS_FIELDCAT-TABNAME = ‘T_REPORT’.   GS_FIELDCAT-OUTPUTLEN = ‘8’.   APPEND GS_FIELDCAT TO GT_FIELDCAT_REP.    CLEAR GS_FIELDCAT.   GS_FIELDCAT-COL_POS   = 3.   GS_FIELDCAT-REPTEXT   = ‘Destination’.   GS_FIELDCAT-FIELDNAME = ‘SYSTEMID’.   GS_FIELDCAT-TABNAME = ‘T_REPORT’.   GS_FIELDCAT-OUTPUTLEN = ‘4’.   APPEND GS_FIELDCAT TO GT_FIELDCAT_REP.    CLEAR GS_FIELDCAT.   GS_FIELDCAT-COL_POS   = 4.   GS_FIELDCAT-REPTEXT   = ‘Name’.   GS_FIELDCAT-FIELDNAME = ‘AS4TEXT’.   GS_FIELDCAT-TABNAME = ‘T_REPORT’.   GS_FIELDCAT-OUTPUTLEN = ’60’.   APPEND GS_FIELDCAT TO GT_FIELDCAT_REP.    CLEAR GS_FIELDCAT.   GS_FIELDCAT-COL_POS   = 5.   GS_FIELDCAT-REPTEXT   = ‘Date’.   GS_FIELDCAT-FIELDNAME = ‘DATE’.   GS_FIELDCAT-TABNAME = ‘T_REPORT’.   GS_FIELDCAT-OUTPUTLEN = ’10’.   APPEND GS_FIELDCAT TO GT_FIELDCAT_REP.    CLEAR GS_FIELDCAT.   GS_FIELDCAT-COL_POS   = 5.   GS_FIELDCAT-REPTEXT   = ‘Time’.   GS_FIELDCAT-FIELDNAME = ‘TIME’.   GS_FIELDCAT-TABNAME = ‘T_REPORT’.   GS_FIELDCAT-OUTPUTLEN = ‘8’.   APPEND GS_FIELDCAT TO GT_FIELDCAT_REP.    GS_SORT_REP-SPOS = 1.   GS_SORT_REP-FIELDNAME = ‘TRKORR’.   APPEND GS_SORT_REP TO GT_SORT_REP.  ENDFORM.                    ” FILL_CATALOG  *&———————————————————- * *&      Form  CALL_ALV                                       * *&———————————————————- * FORM CALL_ALV.    IF CUSTOM_CONTAINER IS INITIAL.     CREATE OBJECT CUSTOM_CONTAINER        EXPORTING            CONTAINER_NAME = MYCONTAINER        EXCEPTIONS            CNTL_ERROR = 1            CNTL_SYSTEM_ERROR = 2            CREATE_ERROR = 3            LIFETIME_ERROR = 4            LIFETIME_DYNPRO_DYNPRO_LINK = 5.   ENDIF.    CREATE OBJECT GRID_ORDERS         EXPORTING I_PARENT = CUSTOM_CONTAINER.    CALL METHOD GRID_ORDERS->SET_TABLE_FOR_FIRST_DISPLAY        EXPORTING I_DEFAULT        = ‘X’        CHANGING  IT_FIELDCATALOG  = GT_FIELDCAT_REP                  IT_SORT          = GT_SORT_REP[]                  IT_OUTTAB        = T_REPORT[].  ENDFORM.                    ” CALL_ALV   image
To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Dushyant Shetty
    Thanks Blag,
    Very useful functionality, and excellent support in terms of adding the ALV option so quickly…
    And yes, I believe this report will be of use to not-just-beginners like me as well, so I disagree slightly on your note about the target audience ! Keep coding 🙂

    Regards,

    Dushyant

    (0) 
  2. Michael Nicholls
    Hi Blag

    Good idea. As a suggestion, how about putting the code into the Code Gallery and leave the blog with the rest? That way people can add extra functions to the code and it is easier to copy and paste.

    Cheers

    (0) 

Leave a Reply