Saturday, December 18, 2010
Use the following function modules to get Blocked ALV list.
REUSE_ALV_BLOCK_LIST_INIT
REUSE_ALV_BLOCK_LIST_APPEND
REUSE_ALV_BLOCK_LIST_DISPLAY

REPORT  zblocked_alv.
*&---------------------------------------------------------------------*
*& Declarations
*&---------------------------------------------------------------------*
DATA:
    i_0000 TYPE STANDARD TABLE OF pa0000,
    i_0001 TYPE STANDARD TABLE OF pa0001,
    i_0002 TYPE STANDARD TABLE OF pa0002,
    i_0008 TYPE STANDARD TABLE OF pa0008.
TYPE-POOLS:
    slis.
DATA:
    i_fieldcat1  TYPE STANDARD TABLE OF slis_fieldcat_alv,
    i_fieldcat2  TYPE STANDARD TABLE OF slis_fieldcat_alv,
    i_fieldcat3  TYPE STANDARD TABLE OF slis_fieldcat_alv,
    i_fieldcat4  TYPE STANDARD TABLE OF slis_fieldcat_alv,
    i_events     TYPE STANDARD TABLE OF slis_alv_event,
    w_events     TYPE slis_alv_event,
    w_layout     TYPE slis_layout_alv.
*&---------------------------------------------------------------------*
*& Start-of-selection
*&---------------------------------------------------------------------*
START-OF-SELECTION.

  SELECT *  FROM pa0000 INTO TABLE i_0000 UP TO 10 ROWS.
  SELECT *  FROM pa0001 INTO TABLE i_0001 UP TO 10 ROWS.
  SELECT *  FROM pa0002 INTO TABLE i_0002 UP TO 10 ROWS.
  SELECT *  FROM pa0008 INTO TABLE i_0008 UP TO 10 ROWS.
  PERFORM build_fieldcatalog USING 'PA0000' CHANGING i_fieldcat1.
  PERFORM build_fieldcatalog USING 'PA0001' CHANGING i_fieldcat2[].
  PERFORM build_fieldcatalog USING 'PA0002' CHANGING i_fieldcat3[].
  PERFORM build_fieldcatalog USING 'PA0008' CHANGING i_fieldcat4[].
  w_layout-max_linesize = '500'.
  DATA:l_program TYPE sy-repid.
  l_program = sy-repid.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      i_callback_program = l_program.

  PERFORM build_block_list_append TABLES i_0000[] USING w_layout  i_fieldcat1[] 'PA0000' i_events[].
  PERFORM build_block_list_append TABLES i_0001[] USING w_layout i_fieldcat2[] 'PA0001' i_events[].
  PERFORM build_block_list_append TABLES i_0002[] USING w_layout i_fieldcat3[] 'PA0002' i_events[].
  PERFORM build_block_list_append TABLES i_0008[] USING w_layout i_fieldcat4[] 'PA0008' i_events[].

  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
*&---------------------------------------------------------------------*
*&      Form  build_block_list_append
*&---------------------------------------------------------------------*
FORM build_block_list_append  TABLES outtab USING  layout fieldcat tabname events .
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
      is_layout   = layout
      it_fieldcat = fieldcat
      i_tabname   = tabname
      it_events   = events
    TABLES
      t_outtab    = outtab.
ENDFORM.                    " build_block_list_append
*&---------------------------------------------------------------------*
*&      Form  build_fieldcatalog
*&---------------------------------------------------------------------*
FORM build_fieldcatalog  USING    structure CHANGING i_fieldcat1.
  DATA:l_program TYPE sy-repid VALUE sy-repid.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name   = l_program
      i_structure_name = structure
    CHANGING
      ct_fieldcat      = i_fieldcat1.
ENDFORM.                    " build_fieldcatalog

1 comment:

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.