Listing 7.22  ZPTB00_OBJ_REP_SHOW  Buchhaltungsbelege anzeigen
FUNCTION zptb00_obj_rep_show.
*"----------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     REFERENCE(I_TAB_DOC) TYPE  ZPTB00_TTY_DOC
*"  EXCEPTIONS
*"      FAILED
*"----------------------------------------------------
* Contains ALV-Grid structures, needed for variables								
  TYPE-POOLS slis .

  DATA:
* for data handling
    l_str_doc_flat    TYPE zptb00_str_doc_flat,
    l_tab_doc_flat    TYPE STANDARD TABLE OF 
      zptb00_str_doc_flat,
* for ALV-Grid display
    l_dis             TYPE disvariant,
    l_rda_table       TYPE REF TO data,
    l_str_layout      TYPE slis_layout_alv.
  FIELD-SYMBOLS:
* for data handling
    <l_str_doc>       TYPE zptb00_str_doc,
    <l_str_doc_item>  TYPE zptb00_docitem.

* convert data to flat structure
  LOOP AT i_tab_doc ASSIGNING <l_str_doc>.
    MOVE-CORRESPONDING <l_str_doc> TO l_str_doc_flat.
    LOOP AT <l_str_doc>-tab_item ASSIGNING 
      <l_str_doc_item>.
      MOVE-CORRESPONDING <l_str_doc_item> TO 
        l_str_doc_flat.
      APPEND l_str_doc_flat TO l_tab_doc_flat.
    ENDLOOP.
  ENDLOOP.

* Make column width as small as possible
  l_str_layout-colwidth_optimize = 'X'.
* This text should be displayed as the window title
  l_str_layout-window_titlebar = text-001.
* Give the name of our report, so that the user can 
* save individual configurations of the ALV-Grid 
* display. You could also provide another text here, if 
* you want separate configuration of the show and 
* deletion display
  l_dis-report = sy-repid.

* Call the ALV-Grid display function
  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                  = 
        'ZPTB00_STR_DOC_FLAT'
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
      is_layout                         = l_str_layout
*     IT_FIELDCAT                       =
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT                           =
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
      i_save                            = 'A'
      is_variant                        = l_dis
*     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
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab                          = 
        l_tab_doc_flat
    EXCEPTIONS
      program_error                     = 1
      OTHERS                            = 2.
  IF sy-subrc <> 0.
* Error? -> Show to the user what happened
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFUNCTION.
