Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Additional Table in ALV

Former Member
0 Kudos

HI , I need to dispaly an additional table to ALV Grid .

first i displayed ALV grid using REUSE_ALV_GRID_DISPLAY

and now my req i have to display additioan l table to below to that ALV.

THX

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos

Hello

You may have a look at my sample reports ZUS_SDN_TWO_ALV_GRIDS and ZUS_SDN_THREE_ALV_GRIDS in

Regards

Uwe

venkat_o
Active Contributor
0 Kudos

Hi CHAAYA SEN, When you use REUSE_ALV_GRID_DISPLAY, you cant display 2 tables at a time. But you have one option to display using ALV. That is called Blocked ALV . That means displaying many tables one by one upto 19 tables. Used Function modules. REUSE_ALV_BLOCK_LIST_INIT, REUSE_ALV_BLOCK_LIST_APPEND, REUSE_ALV_BLOCK_LIST_DISPLAY. Check this Sample program.


REPORT  zvenkat_blocked_alv.

**********************************************************************
* Declarations.
**********************************************************************
* Internal tables
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.
*&---------------------------------------------------------------------*
* ALV Declarations
*----------------------------------------------------------------------*
* Types Pools
TYPE-POOLS:
   slis.
* Types
TYPES:
   t_fieldcat         TYPE slis_fieldcat_alv,
   t_events           TYPE slis_alv_event,
   t_layout           TYPE slis_layout_alv.
* Workareas
DATA:
   w_fieldcat1        TYPE t_fieldcat,
   w_fieldcat2        TYPE t_fieldcat,
   w_fieldcat3        TYPE t_fieldcat,
   w_fieldcat4        TYPE t_fieldcat,
   w_events           TYPE t_events,
   w_layout           TYPE t_layout.
* Internal Tables
DATA:
   i_fieldcat1         TYPE STANDARD TABLE OF t_fieldcat,
   i_fieldcat2         TYPE STANDARD TABLE OF t_fieldcat,
   i_fieldcat3         TYPE STANDARD TABLE OF t_fieldcat,
   i_fieldcat4         TYPE STANDARD TABLE OF t_fieldcat,
   i_events            TYPE STANDARD TABLE OF t_events.

**********************************************************************
* start-of-selection.
**********************************************************************
START-OF-SELECTION.
  PERFORM get_data.

**********************************************************************
* end-of-selection.
**********************************************************************
END-OF-SELECTION.
  PERFORM display_data.
**********************************************************************
* FORM    :  get_data
***********************************************************************
FORM get_data.

  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.

ENDFORM. "get_data
**********************************************************************
* FORM    :  display_data
***********************************************************************
FORM display_data.

  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'.
  PERFORM display_data_alv.

ENDFORM. "display_data
*&---------------------------------------------------------------------*
*&      Form  display_data_ALV
*&---------------------------------------------------------------------*
FORM display_data_alv .

  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'.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


ENDFORM.                    " display_data_ALV
*&---------------------------------------------------------------------*
*&      Form  build_block_list_append
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0141   text
*      -->P_0142   text
*      -->P_0143   text
*      -->P_0144   text
*----------------------------------------------------------------------*
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.
  IF sy-subrc = 0.
 "MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  "       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " build_block_list_append
*&---------------------------------------------------------------------*
*&      Form  build_fieldcatalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0113   text
*----------------------------------------------------------------------*
FORM build_fieldcatalog  USING    structure CHANGING i_fieldcat1.
  DATA:l_program TYPE sy-repid.

  l_program = sy-repid.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name   = l_program
      i_structure_name = structure
    CHANGING
      ct_fieldcat      = i_fieldcat1.
  IF sy-subrc <> 0.
    "MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
     "       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    " build_fieldcatalo 
I hope that it helps u . Regards, Venkat.O

Former Member
0 Kudos

Hi ,

Using REUSE_ALV_GRID_DISPLAY you can display only one internal table .

If you opt for list display then you can use REUSE_ALV_LIST_DISPLAY.

and other contributors have provided sample code also for that.

If you require to ouput in grid display then you have to go for oops method i.e. using classes. If you need any help regarding that then you can get back to me.