ALV Report to fetch data from custom table and Displaying it

 Program: 

REPORT ZSM_ALV.

type-pools:slis.

DATABEGIN OF zsm_table,
  ID type int4,
  NAME TYPE char20,
 PHONE TYPE char10,
  LOCATION TYPE char20,
  END OF zsm_table.

DATAit TYPE STANDARD TABLE OF zsm_table.

  SELECT FROM zsm_table INTO table it.

    datait_fieldcat TYPE slis_t_fieldcat_alv,
          wa_fieldcat TYPE slis_fieldcat_alv.

    wa_fieldcat-seltext_s 'ID'.
    wa_fieldcat-col_pos '1'.
    wa_fieldcat-fieldname 'ID'.
   APPEND wa_fieldcat to it_fieldcat.

        wa_fieldcat-seltext_s 'NAME'.
    wa_fieldcat-col_pos '2'.
    wa_fieldcat-fieldname 'NAME'.
   APPEND wa_fieldcat to it_fieldcat.

    wa_fieldcat-seltext_s 'PHONE'.
    wa_fieldcat-col_pos '3'.
    wa_fieldcat-fieldname 'PHONE'.
   APPEND wa_fieldcat to it_fieldcat.

    wa_fieldcat-seltext_s 'LOCATION'.
    wa_fieldcat-col_pos '4'.
    wa_fieldcat-fieldname 'LOCATION'.
   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                = ' '
*      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                  =
*      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        =
*      O_PREVIOUS_SRAL_HANDLER           =
*    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.


 Output:  


                                   








Post a Comment

0 Comments