ABAP Programming Report sample code with OOPS concept

This abap programming report with sap can be used to get the data from sap data base using oops concept is as shown below.

The variant on selection screen


Material ............ 100-100 to 100-200
Plant................ 1000 to 2000
BOM Usage............ 1 to 1
BOM status........... 01 to 01
BOM category........ D to P

SAMPLE CODE

**---------------------------------------------------------------------
*
*                           T Y P E S                                 *
*---------------------------------------------------------------------*
TYPES:
* Material Data
BEGIN OF TYPE_MAST,
 MATNR LIKE MAST-MATNR,             " Material Number
 WERKS LIKE MAST-WERKS,             " Plant
 STLAN LIKE MAST-STLAN,             " BOM Usage
 STLNR LIKE MAST-STLNR,             " Bill of material
 STLAL LIKE MAST-STLAL,             " Alternative BOM
END OF TYPE_MAST,

* Material Description Data
BEGIN OF TYPE_MAKT,
 MATNR LIKE MAKT-MATNR,             " Material Number
 MAKTX LIKE MAKT-MAKTX,             " Material Description
END OF TYPE_MAKT,

* BOM Header Data
BEGIN OF TYPE_STKO,
 STLTY LIKE STKO-STLTY,             " BOM category
 STLNR LIKE STKO-STLNR,             " Bill of material
 STLAL LIKE STKO-STLAL,             " Alternative BOM
 DATUV LIKE STKO-DATUV,             " Valid-From Date
 BMENG LIKE STKO-BMENG,             " Base Quantity
 STKTX LIKE STKO-STKTX,             " Alternative BOM Text
 STLST LIKE STKO-STLST,             " BOM status
END OF TYPE_STKO,

* BOM Text Data
BEGIN OF TYPE_STZU,
 STLTY LIKE STZU-STLTY,             " BOM category
 STLNR LIKE STZU-STLNR,             " Bill of material
 ZTEXT LIKE STZU-ZTEXT,             " BOM text
END OF TYPE_STZU,

* BOM Item Data
BEGIN OF TYPE_STPO,
 STLTY LIKE STPO-STLTY,             " BOM category
 STLNR LIKE STPO-STLNR,             " Bill of material
 IDNRK LIKE STPO-IDNRK,             " BOM component
 POSTP LIKE STPO-POSTP,             " Item Category(BOM)
 POSNR LIKE STPO-POSNR,             " BOM Item Number
 MENGE LIKE STPO-MENGE,             " Component quantity
END OF TYPE_STPO,

* Output Data
BEGIN OF TYPE_OUTPUT,

 WERKS LIKE MAST-WERKS,             " Plant
 MATNR LIKE MAST-MATNR,             " Material Number
 MAKTX LIKE MAKT-MAKTX,             " Material Description
 STLNR LIKE MAST-STLNR,             " Bill of material
 STLAN LIKE MAST-STLAN,             " BOM Usage
 STLAL LIKE MAST-STLAL,             " Alternative BOM

 STLTY LIKE STKO-STLTY,             " BOM category
 DATUV LIKE STKO-DATUV,             " Valid-From Date
 BMENG LIKE STKO-BMENG,             " Base Quantity
 STKTX LIKE STKO-STKTX,             " Alternative BOM Text
 STLST LIKE STKO-STLST,             " BOM status
 IDNRK LIKE STPO-IDNRK,             " BOM component
 POSTP LIKE STPO-POSTP,             " Item Category(BOM)
 POSNR LIKE STPO-POSNR,             " BOM Item Number
 MENGE LIKE STPO-MENGE,             " Component quantity
 ZTEXT LIKE STZU-ZTEXT,             " BOM text
END OF TYPE_OUTPUT.

*----------------------------------------------------------------------
*
*                            D A T A
*
*----------------------------------------------------------------------
*
DATA:
W_MATNR TYPE MARA-MATNR,             " Material Number
W_WERKS TYPE MAST-WERKS,             " Plant
W_STLAN TYPE MAST-STLAN,             " BOM Usage
W_STLST TYPE STKO-STLST,             " BOM status
W_STLTY TYPE STKO-STLTY,             " BOM category

W_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
W_ALV_GRID  TYPE REF TO CL_GUI_ALV_GRID,
OK_CODE     LIKE SY-UCOMM.

*---------------------------------------------------------------------*
*                  I N T E R N A L   T A B L E S                      *
*---------------------------------------------------------------------*
DATA:
* Material Data
I_MAST          TYPE STANDARD TABLE OF TYPE_MAST,
WA_MAST         TYPE TYPE_MAST,

* Material Description Data
I_MAKT          TYPE STANDARD TABLE OF TYPE_MAKT,
WA_MAKT         TYPE TYPE_MAKT,

* BOM Header Data
I_STKO          TYPE STANDARD TABLE OF TYPE_STKO,
WA_STKO         TYPE TYPE_STKO,

* BOM Text Data
I_STZU          TYPE STANDARD TABLE OF TYPE_STZU,
WA_STZU         TYPE TYPE_STZU,

* BOM Item Data
I_STPO          TYPE STANDARD TABLE OF TYPE_STPO,
WA_STPO         TYPE TYPE_STPO,

* Output table
I_OUTPUT        TYPE STANDARD TABLE OF TYPE_OUTPUT,
WA_OUTPUT       TYPE TYPE_OUTPUT,

* Field Catalog table
IT_FCAT      TYPE LVC_T_FCAT,         " Internal table for field catal
WA_FCAT      TYPE LVC_S_FCAT.         " Work area for field catalog

*---------------------------------------------------------------------*
*                 S E L E C T I O N     S C R E E N                   *
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-SS1.
SELECT-OPTIONS:
S_MATNR FOR W_MATNR,           " Material Number
S_WERKS FOR W_WERKS OBLIGATORY," Plant
S_STLAN FOR W_STLAN,           " BOM Usage
S_STLST FOR W_STLST,           " BOM status
S_STLTY FOR W_STLTY.           " BOM category
SELECTION-SCREEN END OF BLOCK B1.

*----------------------------------------------------------------------
*
*               A T   S E L E C T I O N   S C R E E N
*
*----------------------------------------------------------------------
*
AT SELECTION-SCREEN.
PERFORM F010_VALIDATE_MATERIAL.
PERFORM F020_VALIDATE_PLANT.
PERFORM F030_VALIDATE_BOM_USAGE.
PERFORM F040_VALIDATE_BOM_STATUS.
PERFORM F050_VALIDATE_BOM_CATEGORY.

*---------------------------------------------------------------------*
*                S T A R T   O F   S E L E C T I O N                  *
*---------------------------------------------------------------------*
START-OF-SELECTION .
PERFORM F210_FETCH_BOM_LINK_DATA.
PERFORM F220_FETCH_MATERIAL_DES_DATA.
PERFORM F230_FETCH_BOM_HEADER_DATA.
PERFORM F240_FETCH_BOM_TEXT.
PERFORM F250_FETCH_BOM_ITEM_DATA.

*---------------------------------------------------------------------*
*                  E N D   O F   S E L E C T I O N                    *
*---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM F600_POPULATE_DATA.
PERFORM F650_FIELD_CATLOG.
CALL SCREEN 100.


*&--------------------------------------------------------------------*
*&      Form  f010_validate_material                                  *
*&--------------------------------------------------------------------*
*       --Validate Material                                           *
*---------------------------------------------------------------------*
FORM F010_VALIDATE_MATERIAL .

* Validate Material
IF S_MATNR IS NOT INITIAL.

 SELECT MATNR
   INTO W_MATNR
   FROM MARA
  UP TO 1 ROWS
  WHERE MATNR IN S_MATNR.
 ENDSELECT.

 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_MATNR'.
 MESSAGE 'Invalid Material' TYPE 'E'.  " Invalid Material

ENDIF.                               " IF s_matnr IS NOT INITIAL.

ENDFORM.                               " f010_validate_material

*&--------------------------------------------------------------------*
*&      Form  f020_validate_plant                                     *
*&--------------------------------------------------------------------*
*       - Validate Plant                                              *
*---------------------------------------------------------------------*
FORM F020_VALIDATE_PLANT .

* Validate Plant
SELECT  WERKS
 INTO W_WERKS
 FROM T001W
 UP TO 1 ROWS
 WHERE WERKS IN S_WERKS.
ENDSELECT.
CHECK SY-SUBRC NE 0.

SET CURSOR FIELD 'S_WERKS'.
MESSAGE 'Invalid Plant' TYPE 'E'.    " Invalid Plant

ENDFORM.                               " f020_validate_plant

*&--------------------------------------------------------------------*
*&      Form  f030_validate_BOM_usage                                 *
*&--------------------------------------------------------------------*
*       -Validate BOM Usage                                           *
*---------------------------------------------------------------------*
FORM F030_VALIDATE_BOM_USAGE .

* Validate BOM Usage
IF S_STLAN IS NOT INITIAL.

 SELECT STLAN
   INTO W_STLAN
   FROM T416
   UP TO 1 ROWS
   WHERE STLAN IN S_STLAN.
 ENDSELECT.
 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_STLAN'.
 MESSAGE 'Invalid BOM Usage' TYPE 'E'.  " Invalid BOM Usage

ENDIF.                               " IF s_stlan IS NOT INITIAL.

ENDFORM.                               " f030_validate_BOM_usage

*&--------------------------------------------------------------------*
*&      Form  f040_validate_BOM_status
*&--------------------------------------------------------------------*
*       - Validate BOM Status
*---------------------------------------------------------------------*
FORM F040_VALIDATE_BOM_STATUS .

* Validate BOM Status
IF S_STLST IS NOT INITIAL.

 SELECT  STLST
   INTO W_STLST
   FROM T415S
   UP TO 1 ROWS
   WHERE STLST IN S_STLST.
 ENDSELECT.

 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_STLST'.
 MESSAGE 'Invalid BOM Status' TYPE 'E'.  " Invalid BOM Status

ENDIF.                               " IF s_stlst IS NOT INITIAL

ENDFORM.                               " f040_validate_BOM_status

*&--------------------------------------------------------------------*
*&      Form  f050_validate_BOM_category                              *
*&--------------------------------------------------------------------*
*       -Validate BOM Category                                        *
*---------------------------------------------------------------------*
FORM F050_VALIDATE_BOM_CATEGORY .

* Validate BOM Category
IF S_STLTY IS NOT INITIAL.

 SELECT  STLTY
   INTO W_STLTY
   FROM STKO
   UP TO 1 ROWS
   WHERE STLTY IN S_STLTY.
 ENDSELECT.

 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_STLTY'.
 MESSAGE 'Invalid BOM Category' TYPE 'E'. " Invalid BOM Category

ENDIF.                               " IF s_stlty IS NOT INITIAL.

ENDFORM.                               " f050_validate_BOM_category

*&--------------------------------------------------------------------*
*&      Form  f210_fetch_bom_link_data                                *
*&--------------------------------------------------------------------*
*       - Fetch Material BOM Link data                                *
*---------------------------------------------------------------------*
FORM F210_FETCH_BOM_LINK_DATA .

* Fetch Material BOM Link data
SELECT MATNR                         " Material Number
      WERKS                         " Plant
      STLAN                         " BOM Usage
      STLNR                         " Bill of material
      STLAL                         " Alternative BOM
 INTO TABLE I_MAST
 FROM MAST
WHERE MATNR IN S_MATNR
  AND WERKS IN S_WERKS.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

SORT I_MAST BY MATNR WERKS.

ENDFORM.                               " f200_fetch_bom_link_data

*&--------------------------------------------------------------------*
*&      Form  f220_fetch_material_des_data                            *
*&--------------------------------------------------------------------*
*       -Fetch Material Description data                              *
*---------------------------------------------------------------------*
FORM F220_FETCH_MATERIAL_DES_DATA .

SELECT MATNR
      MAKTX
 INTO TABLE I_MAKT
 FROM MAKT
  FOR ALL ENTRIES IN I_MAST
WHERE MATNR EQ I_MAST-MATNR.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

SORT I_MAKT BY MATNR.

ENDFORM.                               " f200_fetch_material_des_data

*&--------------------------------------------------------------------*
*&      Form  f230_fetch_bom_header_data                              *
*&--------------------------------------------------------------------*
*       - Fetch BOM Header data                                       *
*---------------------------------------------------------------------*
FORM F230_FETCH_BOM_HEADER_DATA .

* Fetch BOM Header data
SELECT STLTY                         " BOM category
      STLNR                         " Bill of material
      STLAL                         " Alternative BOM
      DATUV                         " Valid-From Date
      BMENG                         " Base Quantity
      STKTX                         " Alternative BOM Text
      STLST                         " BOM status
 INTO TABLE I_STKO
 FROM STKO
 FOR ALL ENTRIES IN I_MAST
WHERE STLNR EQ I_MAST-STLNR
AND   STLTY IN S_STLTY
AND   STLST IN S_STLST.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

SORT I_STKO BY STLTY STLST.

ENDFORM.                               " f200_fetch_bom_header_data

*&--------------------------------------------------------------------*
*&      Form  f240_fetch_bom_text                                     *
*&--------------------------------------------------------------------*
*      - Fetch BOM text Data                                          *
*---------------------------------------------------------------------*
FORM F240_FETCH_BOM_TEXT .
*  DATA:
*    i_stko_temp LIKE TABLE OF wa_stko.
*
*  i_stko_temp = i_stko.
*  SORT i_stko_temp BY stlty stlnr.
*  DELETE ADJACENT DUPLICATES FROM i_stko_temp
*    COMPARING stlty stlnr.
*
*  SELECT stlty                         " BOM category
*         stlnr                         " Bill of material
*         ztext                         " BOM text
*    INTO TABLE i_stzu
*    FROM stzu
*     FOR ALL ENTRIES IN i_stko_temp
*   WHERE stlty EQ i_stko_temp-stlty
*     AND stlnr EQ i_stko_temp-stlnr.
*
*  DATA:
*    i_stzu_temp    LIKE TABLE OF wa_stzu.

SELECT STLTY                         " BOM category
      STLNR                         " Bill of material
      ZTEXT                         " BOM text
 INTO TABLE I_STZU
 FROM STZU
  FOR ALL ENTRIES IN I_STKO
WHERE STLTY EQ I_STKO-STLTY
  AND STLNR EQ I_STKO-STLNR.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

ENDFORM.                               " f200_fetch_bom_text

*&--------------------------------------------------------------------*
*&      Form  f250_fetch_bom_item_data                                *
*&--------------------------------------------------------------------*
*       - Fetch BOM Item data                                         *
*---------------------------------------------------------------------*
FORM F250_FETCH_BOM_ITEM_DATA .

* Fetch BOM Header data
SELECT STLTY                         " BOM category
      STLNR                         " Bill of material
      IDNRK                         " BOM component
      POSTP                         " Item Category(BOM)
      POSNR                         " BOM Item Number
      MENGE                         " Component quantity
 INTO TABLE I_STPO
 FROM STPO
  FOR ALL ENTRIES IN I_STKO
WHERE STLTY EQ I_STKO-STLTY
  AND STLNR EQ I_STKO-STLNR.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

ENDFORM.                               " f200_fetch_bom_item_data

*&--------------------------------------------------------------------*
*&      Form  f600_populate_data
*
*&--------------------------------------------------------------------*
*       - Displaying the data                                         *
*---------------------------------------------------------------------*
FORM F600_POPULATE_DATA .

*  SORT i_stko.
*  SORT i_mast.
*  DELETE ADJACENT DUPLICATES FROM i_mast.

LOOP AT I_STPO INTO WA_STPO.
 CLEAR WA_OUTPUT.
 READ TABLE I_STKO INTO WA_STKO WITH KEY STLNR = WA_STPO-STLNR
                                         STLTY = WA_STPO-STLTY
                                         BINARY SEARCH.
*    CHECK sy-subrc eq 0.
 READ TABLE I_STZU INTO WA_STZU WITH KEY STLNR = WA_STKO-STLNR
                                         STLTY = WA_STKO-STLTY
                                         BINARY SEARCH.
*    CHECK sy-subrc Eq 0.
 READ TABLE I_MAST INTO WA_MAST WITH KEY STLNR = WA_STKO-STLNR
                                         BINARY SEARCH.
*    CHECK sy-subrc Eq 0.
 READ TABLE I_MAKT INTO WA_MAKT WITH KEY MATNR = WA_MAST-MATNR
                                         BINARY SEARCH.
*    CHECK sy-subrc Eq 0.
 MOVE:

   WA_STPO-IDNRK TO WA_OUTPUT-IDNRK,
   WA_STPO-POSTP TO WA_OUTPUT-POSTP,
   WA_STPO-POSNR TO WA_OUTPUT-POSNR,
   WA_STPO-MENGE TO WA_OUTPUT-MENGE,

   WA_STKO-STLTY TO WA_OUTPUT-STLTY,
   WA_STKO-DATUV TO WA_OUTPUT-DATUV,
   WA_STKO-BMENG TO WA_OUTPUT-BMENG,
   WA_STKO-STKTX TO WA_OUTPUT-STKTX,
   WA_STKO-STLST TO WA_OUTPUT-STLST,

   WA_STZU-ZTEXT TO WA_OUTPUT-ZTEXT,

   WA_MAST-WERKS TO WA_OUTPUT-WERKS,
   WA_MAST-MATNR TO WA_OUTPUT-MATNR,
   WA_MAKT-MAKTX TO WA_OUTPUT-MAKTX,
   WA_MAST-STLNR TO WA_OUTPUT-STLNR,
   WA_MAST-STLAN TO WA_OUTPUT-STLAN,
   WA_MAST-STLAL TO WA_OUTPUT-STLAL.

 APPEND WA_OUTPUT TO I_OUTPUT.

ENDLOOP.                             " LOOP AT i_stpo

ENDFORM.                               " f600_display_data

*&--------------------------------------------------------------------*
*&      Form  f650_field_catlog                                       *
*&--------------------------------------------------------------------*
*       -Fill Field Catalog                                           *
*---------------------------------------------------------------------*
FORM F650_FIELD_CATLOG .

WA_FCAT-FIELDNAME = 'WERKS'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'WERKS'.
WA_FCAT-COL_POS   = 1.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'MATNR'.
WA_FCAT-COL_POS   = 2.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-REF_TABLE = 'MAKT'.
WA_FCAT-REF_FIELD = 'MAKTX'.
WA_FCAT-COL_POS   = 3.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLTY'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'STLTY'.
WA_FCAT-COL_POS   = 4.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLAN'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'STLAN'.
WA_FCAT-COL_POS   = 5.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLNR'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'STLNR'.
WA_FCAT-COL_POS   = 6.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLAL'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'STLAL'.
WA_FCAT-COL_POS   = 7.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STKTX'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'STKTX'.
WA_FCAT-COL_POS   = 8.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'DATUV'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'DATUV'.
WA_FCAT-COL_POS   = 9.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'BMENG'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'BMENG'.
WA_FCAT-COL_POS   = 10.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLST'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'STLST'.
WA_FCAT-COL_POS   = 11.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'IDNRK'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'IDNRK'.
WA_FCAT-COL_POS   = 12.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'POSTP'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'POSTP'.
WA_FCAT-COL_POS   = 13.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'POSNR'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'POSNR'.
WA_FCAT-COL_POS   = 14.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'MENGE'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'MENGE'.
WA_FCAT-COL_POS   = 15.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'ZTEXT'.
WA_FCAT-REF_TABLE = 'STZU'.
WA_FCAT-REF_FIELD = 'ZTEXT'.
WA_FCAT-COL_POS   = 16.
APPEND WA_FCAT TO IT_FCAT.

ENDFORM.                               " f650_field_catlog

*&--------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT                                   *
*&--------------------------------------------------------------------*
*       -Calling Function Module                                      *
*---------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BACK'.
*  SET TITLEBAR 'xxx'.

IF W_CONTAINER IS INITIAL.
*    IF cl_gui_alv_grid=>offline( ) IS INITIAL.

 CREATE OBJECT W_CONTAINER
   EXPORTING
*      PARENT                      =
     CONTAINER_NAME              = 'CUSTOM'
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      REPID                       =
*      DYNNR                       =
*      NO_AUTODEF_PROGID_DYNNR     =
 EXCEPTIONS
   CNTL_ERROR                  = 1
   CNTL_SYSTEM_ERROR           = 2
   CREATE_ERROR                = 3
   LIFETIME_ERROR              = 4
   LIFETIME_DYNPRO_DYNPRO_LINK = 5
   OTHERS                      = 6
     .
 IF SY-SUBRC  EQ 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
 ENDIF.                               " IF sy-subrc  0.
ENDIF.

CREATE OBJECT W_ALV_GRID
 EXPORTING
*      I_SHELLSTYLE      = 0
*      I_LIFETIME        =
   I_PARENT          = W_CONTAINER
*      I_APPL_EVENTS     = space
*      I_PARENTDBG       =
*      I_APPLOGPARENT    =
*      I_GRAPHICSPARENT  =
*      I_NAME            =
 EXCEPTIONS
   ERROR_CNTL_CREATE = 1
   ERROR_CNTL_INIT   = 2
   ERROR_CNTL_LINK   = 3
   ERROR_DP_CREATE   = 4
   OTHERS            = 5
   .
IF SY-SUBRC  EQ 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.                             " IF sy-subrc  0.
*  ENDIF.

CALL METHOD W_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
*   EXPORTING
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
*     i_structure_name              = 'WA_OUTPUT'
*    IS_VARIANT                    =
*    I_SAVE                        =
*    I_DEFAULT                     = 'X'
*    IS_LAYOUT                     =
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
*    IT_TOOLBAR_EXCLUDING          =
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
 CHANGING
   IT_OUTTAB                     = I_OUTPUT
   IT_FIELDCATALOG               = IT_FCAT
*    IT_SORT                       =
*    IT_FILTER                     =
 EXCEPTIONS
   INVALID_PARAMETER_COMBINATION = 1
   PROGRAM_ERROR                 = 2
   TOO_MANY_LINES                = 3
   OTHERS                        = 4
       .
IF SY-SUBRC  EQ 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.                               " IF sy-subrc  0.

ENDMODULE.                             " STATUS_0100 OUTPUT

*&--------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT                              *
*&--------------------------------------------------------------------*
*       - Leave Program                                               *
*---------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.
 WHEN 'BACK'.
   LEAVE TO SCREEN 0.
ENDCASE.                             " CASE ok_code
CLEAR OK_CODE.

ENDMODULE.                             " USER_COMMAND_0100  INPUT

No comments :

Post a Comment