Monday, 14 August 2017

First List ALV using FM-REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DISPLAY


The post shows how to build your first simple list ALV. AND GRID ALV The list ALV shows records from the flight table- SPFLI.
REPORT  ZAVI_ALV20.

DATAIT TYPE TABLE OF SPFLI,
      WA TYPE SPFLI.

SELECT *
       FROM SPFLI INTO TABLE IT.

SELECTION-SCREEN BEGIN OF BLOCK ABC WITH FRAME TITLE TEXT-001.

 PARAMETERSRAD1 RADIOBUTTON GROUP RG1 USER-COMMAND UC ,
             RAD2 RADIOBUTTON GROUP RG1.

SELECTION-SCREEN END OF BLOCK ABC.

IF RAD1 'X'.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK              = ' '
*     I_BYPASSING_BUFFER             =
*     I_BUFFER_ACTIVE                = ' '
     I_CALLBACK_PROGRAM             'SY-rEPID '
*     I_CALLBACK_PF_STATUS_SET       = ' '
*     I_CALLBACK_USER_COMMAND        = ' '
     I_STRUCTURE_NAME               =  'SPFLI'
*     IS_LAYOUT                      =
*     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
*     IR_SALV_LIST_ADAPTER           =
*     IT_EXCEPT_QINFO                =
*     I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER        =
*     ES_EXIT_CAUSED_BY_USER         =
    TABLES
      t_outtab                       IT
   EXCEPTIONS
     PROGRAM_ERROR                  1
     OTHERS                         2
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  ELSE.

    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          = ' '
*       I_CALLBACK_USER_COMMAND           = ' '
*       I_CALLBACK_TOP_OF_PAGE            = ' '
*       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*       I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  'SPFLI'
*       I_BACKGROUND_ID                   = ' '
*       I_GRID_TITLE                      =
*       I_GRID_SETTINGS                   =
*       IS_LAYOUT                         =
*       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
     EXCEPTIONS
       PROGRAM_ERROR                     1
       OTHERS                            2
              .
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.
    ENDIF.


OUTPUT