SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Transport Orders Report



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Transport and Upgrade | Транспорт и Обновления
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Feb 25, 2008 7:32 pm    Post subject: Transport Orders Report Reply with quote

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...

Code:
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: <E071> LIKE LINE OF T_E071,
               <E070> 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 <E071>.
      MOVE <E071> 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 <E070>.

    CLEAR: ES_COFILE.
    REFRESH: ES_COFILE.

    CALL FUNCTION 'TR_READ_GLOBAL_INFO_OF_REQUEST'
         EXPORTING
              IV_TRKORR   = <E070>-TRKORR
              IV_DIR_TYPE = 'T'
         IMPORTING
              ES_COFILE   = ES_COFILE.

    APPEND ES_COFILE.
    READ TABLE ES_COFILE INDEX 1.
    MOVE ES_COFILE-SYSTEMS TO ES_SYSTEMS.
    LOOP AT ES_SYSTEMS INTO WA_SYSTEMS.
      MOVE WA_SYSTEMS-STEPS TO ES_STEPS.
      LOOP AT ES_STEPS INTO WA_STEPS WHERE STEPID EQ 'G'.
        MOVE WA_STEPS-ACTIONS TO ES_ACTIONS.
        LOOP AT ES_ACTIONS INTO WA_ACTIONS.
        ENDLOOP.
        READ TABLE DOMA_VALUES
        WITH KEY DOMVALUE_L = <E070>-TRSTATUS.

        IF W_TRKORR NE <E070>-TRKORR.
          W_TRKORR = <E070>-TRKORR.
          SKIP 1.
        ENDIF.

        WRITE:/1 <E070>-TRKORR,12 DOMA_VALUES-DDTEXT,
               22 WA_SYSTEMS-SYSTEMID,35 <E070>-AS4TEXT,
               96 WA_ACTIONS-DATE,108 WA_ACTIONS-TIME.
      ENDLOOP.
    ENDLOOP.

  ENDLOOP.

ENDFORM.


ALV version of the report
Code:

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: <E071> LIKE LINE OF T_E071,
               <E070> 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 <E071>.
      MOVE <E071> 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 <E070>.

    CLEAR: ES_COFILE.
    REFRESH: ES_COFILE.

    CALL FUNCTION 'TR_READ_GLOBAL_INFO_OF_REQUEST'
         EXPORTING
              IV_TRKORR   = <E070>-TRKORR
              IV_DIR_TYPE = 'T'
         IMPORTING
              ES_COFILE   = ES_COFILE.

    APPEND ES_COFILE.
    READ TABLE ES_COFILE INDEX 1.
    MOVE ES_COFILE-SYSTEMS TO ES_SYSTEMS.
    LOOP AT ES_SYSTEMS INTO WA_SYSTEMS.
      MOVE WA_SYSTEMS-STEPS TO ES_STEPS.
      LOOP AT ES_STEPS INTO WA_STEPS WHERE STEPID EQ 'G'.
        MOVE WA_STEPS-ACTIONS TO ES_ACTIONS.
        LOOP AT ES_ACTIONS INTO WA_ACTIONS.
        ENDLOOP.
        READ TABLE DOMA_VALUES
        WITH KEY DOMVALUE_L = <E070>-TRSTATUS.

        MOVE <E070>-TRKORR TO T_REPORT-TRKORR.
        MOVE DOMA_VALUES-DDTEXT TO T_REPORT-DDTEXT.
        MOVE WA_SYSTEMS-SYSTEMID TO T_REPORT-SYSTEMID.
        MOVE <E070>-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


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Transport and Upgrade | Транспорт и Обновления All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.