REUSE_ALV_LIST_DISPLAY- 30

light111Block List ALV

The previous post REUSE_ALV_LIST_DISPLAY- 29 shows how to display icon as a separate column in list alv. This post shows how to make block list alv.


Code Snippet:


TYPE-POOLS slis.
DATA it_spfli   TYPE TABLE OF spfli,
              it_sflight TYPE TABLE OF sflight,
               it_sbook   TYPE TABLE OF sbook.
DATA it_fieldcat TYPE slis_t_fieldcat_alv,
               wa_layout   TYPE slis_layout_alv,
               it_event    TYPE slis_t_event.

START-OF-SELECTION.
  PERFORM fetch_data.

END-OF-SELECTION.

  PERFORM blocked_alv_initialization.
  PERFORM field_cat USING ‘it_spfli’ ‘spfli’.
  PERFORM blocked_alv_append USING ‘it_spfli’ it_spfli.
  REFRESH it_fieldcat[].
  PERFORM field_cat USING ‘it_sflight’ ‘sflight’.
  PERFORM blocked_alv_append USING ‘it_sflight’ it_sflight.
  REFRESH it_fieldcat[].
  PERFORM field_cat USING ‘it_sbook’ ‘sbook’.
  PERFORM blocked_alv_append USING ‘it_sbook’ it_sbook.
  REFRESH it_fieldcat[].
  PERFORM blocked_alv_display.
————————————————————-

FORM fetch_data .
  SELECT FROM spfli INTO TABLE it_spfli UP TO 10 ROWS.

  SELECT FROM sflight INTO TABLE it_sflight UP TO 10 ROWS.

  SELECT FROM sbook INTO TABLE it_sbook UP TO 10 ROWS.
ENDFORM.                    ” fetch_data

———————————————————-
FORM blocked_alv_initialization .

  CALL FUNCTION ‘REUSE_ALV_BLOCK_LIST_INIT’
    EXPORTING
      i_callback_program sycprog.

ENDFORM.                    ” blocked_alv_initialization

————————————————————
FORM field_cat  USING  itab TYPE c
                                              tab_struc TYPE c.
  CALL FUNCTION ‘REUSE_ALV_FIELDCATALOG_MERGE’
    EXPORTING
      i_program_name     sycprog
      i_internal_tabname itab
      i_structure_name   tab_struc
    CHANGING
      ct_fieldcat        it_fieldcat.

ENDFORM.                    ” field_cat

————————————————————

FORM blocked_alv_append USING  itab1 TYPE 

                                                                   itab2 TYPE STANDARD TABLE.

  CALL FUNCTION ‘REUSE_ALV_BLOCK_LIST_APPEND’
    EXPORTING
      is_layout   wa_layout
      it_fieldcat it_fieldcat
      i_tabname   itab1
      it_events   it_event
    TABLES
      t_outtab    itab2.

ENDFORM.                    ” blocked_alv_append

————————————————————

FORM blocked_alv_display .

  CALL FUNCTION ‘REUSE_ALV_BLOCK_LIST_DISPLAY’.

ENDFORM.” blocked_alv_display


program Output:

1


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s