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: 

Multiple ALV display in one screen using SALV(Factory method)...

aris_hidalgo
Contributor
0 Kudos

Hello Experts,

I tried using the old 'REUSE_ALV_BLOCK_LIST_APPEND' but it does not suit my

requirement. So will it be possible to display multiple ALV display(block) using

SALV?

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello

Do not miss to consult the tutorials written by Rich Heilman:

[ALV Object Model - Simple 2D Table - The Basics|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6]

[ALV Object Model - Simple 2D Table - Event Handling|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]

[ALV Object Model - Hierarchical Sequential List - The Basics|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0f03986-046c-2910-a5aa-e5364e96ea2c]

Regards

Uwe

13 REPLIES 13

former_member188685
Active Contributor
0 Kudos

You might need to use a container, and split the container into parts using splitter container and in each part display one grid.

0 Kudos

Hi Vijay,

Sorry for being stubborn. Do you have any simple examples on that?

Thanks again!

0 Kudos

check the sample code..

REPORT  zsalv_demo_multiple.

DATA: salv1 TYPE REF TO cl_salv_table,
      salv2 TYPE REF TO cl_salv_table,
      salv3 TYPE REF TO cl_salv_table.
DATA: g_custom TYPE REF TO cl_gui_custom_container,
o_splitter    TYPE REF TO cl_gui_splitter_container,
o_grid1 TYPE REF TO cl_gui_container,
o_grid2  TYPE REF TO cl_gui_container,
o_grid3  TYPE REF TO cl_gui_container.
DATA: it_flight TYPE STANDARD TABLE OF sflight,
      it_carr  TYPE TABLE OF scarr,
      it_book TYPE TABLE OF sbook.

START-OF-SELECTION.
  SELECT * FROM sflight
  INTO TABLE it_flight
  UP TO 20 ROWS.
  SELECT * FROM scarr
  INTO TABLE it_carr
  UP TO 20 ROWS.
  SELECT * FROM sbook
  INTO TABLE it_book
  UP TO 20 ROWS.
  CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'ABC'.
  CREATE OBJECT g_custom
  EXPORTING container_name = 'CONT'.
  CREATE OBJECT o_splitter
  EXPORTING parent  = g_custom
  rows    = 3
  columns = 1.
  CALL METHOD o_splitter->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = o_grid1.

  CALL METHOD o_splitter->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = o_grid2.

  CALL METHOD o_splitter->get_container
    EXPORTING
      row       = 3
      column    = 1
    RECEIVING
      container = o_grid3.
  cl_salv_table=>factory(
    EXPORTING
      r_container    = o_grid1
    IMPORTING
      r_salv_table   = salv1
    CHANGING
      t_table        = it_flight
         ).
  cl_salv_table=>factory(
    EXPORTING
      r_container    = o_grid2
    IMPORTING
      r_salv_table   = salv2
    CHANGING
      t_table        = it_carr
         ).
  cl_salv_table=>factory(
    EXPORTING
      r_container    = o_grid3
    IMPORTING
      r_salv_table   = salv3
    CHANGING
      t_table        = it_book
         ).
  CALL METHOD salv1->display.
  CALL METHOD salv2->display.
  CALL METHOD salv3->display.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE sy-ucomm.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Flow Logic..

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

in the Screen i placed a custom control and named it as CONT

0 Kudos

Hi Vijay,

Thank you for your very helpful reply. However, remember that the splitting is dynamic meaning it is based on the number a given sort criteria in my program.

For example, in my internal table I have 10 company codes so I need to show 30 ALV displays since for every company code, 3 displays is needed(For its acquisition, retirements and balances). So my problem in your code is that I need to create references to the container(o_grid1, o_grid2 and so on...) dynamically.

I hope I made myself clear.

Thanks again!

0 Kudos

Hi Vijay,

Thanks for this example.

However, I was wondering if there is a way to display multiple Hierarchial Sequential lists on a screen.

I checked the class: CL_SALV_HIERSEQ_TABLE . And in none of the methods, we get to specify the container name. What I mean is - in

cl_salv_table=>factory

    EXPORTING

      r_container    = <container_name>   "here we get to specify container name

    IMPORTING

      r_salv_table   =

    CHANGING

      t_table        =  .

         .

Is there a way where we get to specify container name for displaying HierSeq lists? I am asking this because, I have to display a hierseq list in a specific area of a user created dynpro.

Thanks for your time and effort.

uwe_schieferstein
Active Contributor
0 Kudos

Hello

Do not miss to consult the tutorials written by Rich Heilman:

[ALV Object Model - Simple 2D Table - The Basics|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6]

[ALV Object Model - Simple 2D Table - Event Handling|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]

[ALV Object Model - Hierarchical Sequential List - The Basics|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0f03986-046c-2910-a5aa-e5364e96ea2c]

Regards

Uwe

0 Kudos

Hi Again,

I have those tutorials saved on my PC but it doesn't show/answer my question if multiple ALV display can be shown in one screen using SALV.

0 Kudos

Hello

Perhaps sample report SALV_DEMO_HIERSEQ_SIMPLE may be useful for you:

*&---------------------------------------------------------------------*
*& Report  SALV_DEMO_HIERSEQ_SIMPLE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report salv_demo_hierseq_simple no standard page heading.

*-----------------------------------------------------------------------
*... This report demonstrates the simplest call of new ALV API
*      - cl_salv_hierseq_table (hierseq. lists)
*
*    If the table ALV_T_T2 is empty, please create data for the demo
*    by running report BCALV_GENERATE_ALV_T_T2
*
* §1   select data into global output table
*
* §2   create ALV hierseq Table
* §2.1 create the binding information between master and slave
* §2.2 create instance of cl_salv_hierseq_table for displaying a
*      hierseq list of your output tables
*
* §3   Functions
* §3.1 activate default ALV generic Functions
*
* §4   Display
*      display the configurated ALV hierseq Table by calling the method
*      display of cl_salv_hierseq_table.
*-----------------------------------------------------------------------
...

Regards

Uwe

0 Kudos

Hi Uwe,

Do you know if there is a way to display multiple Hierarchial Sequential lists on a screen.

I checked the class: CL_SALV_HIERSEQ_TABLE . And in none of the methods, we get to specify the container name. What I mean is - in

cl_salv_table=>factory

    EXPORTING

      r_container    = <container_name>   "here we get to specify container name

    IMPORTING

      r_salv_table   =

    CHANGING

      t_table        =  .

         .

Is there a way where we get to specify container name for displaying HierSeq lists? I am asking this because, I have to display a hierseq list in a specific area of a user created dynpro.

Thanks for your time and effort.

aris_hidalgo
Contributor
0 Kudos

Not yet solved.

0 Kudos

If that is the Case I really Don't like the Idea of Having Different lists/Grids. This can be handle with one simple option using the SORT functionality. Use the REUSE_ALV_LIST_DISPLAY function.

Having many Grid is not a good approach i feel..

Did you check the Transaction FBL5N

0 Kudos

Hi again Vijay,

Unfortunately I still haven't checked it. Anyway, what do you mean about the sort function? Is there a way to 'DIVIDE' it using SORT?

Many thanks again!

0 Kudos

Yes it will just check this Report..

REPORT  ztest_alv_sort.

TYPE-POOLS: slis.
DATA: BEGIN OF it_data OCCURS 0,
        matnr LIKE mara-matnr,
      END OF it_data.

DATA:
    it_fieldcat TYPE  slis_t_fieldcat_alv,
    it_sort TYPE  slis_t_sortinfo_alv,
    sort LIKE LINE OF it_sort.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'IT_DATA'
    i_inclname             = sy-repid
  CHANGING
    ct_fieldcat            = it_fieldcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2.

select matnr from mara into table it_data
up to 200 rows.

sort-fieldname = 'MATNR'.
sort-up = 'X'.
sort-group = '*'.  "This is responsible for Break..

APPEND sort TO it_sort.
CLEAR sort.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid
    it_fieldcat        = it_fieldcat
    it_sort            = it_sort
  TABLES
    t_outtab           = it_data
  EXCEPTIONS
    program_error      = 1.