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: 

How to dispaly Three Internal Table Data (One below another) in ALV OOPS

Former Member
0 Kudos

HI Experts,

Can any one solve this issue?

In ALV oops, I want to display Three Internal table data in Single Container. One below another.

Is it possible?

My requirement is I have to display 100 fields data in ALV-OOPS.I have already done this using

CL_GUI_ALV_GRID=>SET_TABLE_FOR_DISPALY.

But above and below this data, I want to display three continuous lines (having same length of internal table row).

Can any one give Idea to do this?

Thanks in Advance.

Regards,

Kumar.

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor

Sure it is, what you need is:

- one custom control and custom container in it

- splitter container to spilt this custom container into three parts (top middle and bottom containers)

- in each of these two you place avl where you display your 3 internal tables


DATA: 
      g_alv_grid1 TYPE REF TO cl_gui_alv_grid,
      g_alv_grid2 TYPE REF TO cl_gui_alv_grid,
      g_alv_grid3 TYPE REF TO cl_gui_alv_grid,
      

      g_custom_container TYPE REF TO cl_gui_custom_container,
      g_splitter_container TYPE REF TO cl_gui_splitter_container,
      g_top_container TYPE REF TO cl_gui_container,
      g_middle_container TYPE REF TO cl_gui_container,
      g_bottom_container TYPE REF TO cl_gui_container,

"in PBO module
CREATE OBJECT g_custom_container
      EXPORTING
        container_name              = 'CUSTOM_AREA'.
    
    "now split the container into three independent containers
    CREATE OBJECT g_splitter_container
      EXPORTING
         parent            = g_custom_container
         rows              = 3
         columns           = 1.

    "get top container 
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 1
        column    = 1
      RECEIVING
        container = g_top_container.

    "get middle container 
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 2
        column    = 1
      RECEIVING
        container = g_middle_container.

    "get bottome one
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 3
        column    = 1
      RECEIVING
        container = g_bottom_container.

    "create alv control instances placing it on the top container
    CREATE OBJECT g_alv_grid1
      EXPORTING
        i_parent          =  g_top_container.

    CREATE OBJECT g_alv_grid_ref2
      EXPORTING
        i_parent          =  g_middle_container.
     
    CREATE OBJECT g_alv_grid_ref3
      EXPORTING
        i_parent          =  g_bottom_container.

"diplay all your ALVs with set_table_for_first_display

Regards

Marcin

6 REPLIES 6

MarcinPciak
Active Contributor

Sure it is, what you need is:

- one custom control and custom container in it

- splitter container to spilt this custom container into three parts (top middle and bottom containers)

- in each of these two you place avl where you display your 3 internal tables


DATA: 
      g_alv_grid1 TYPE REF TO cl_gui_alv_grid,
      g_alv_grid2 TYPE REF TO cl_gui_alv_grid,
      g_alv_grid3 TYPE REF TO cl_gui_alv_grid,
      

      g_custom_container TYPE REF TO cl_gui_custom_container,
      g_splitter_container TYPE REF TO cl_gui_splitter_container,
      g_top_container TYPE REF TO cl_gui_container,
      g_middle_container TYPE REF TO cl_gui_container,
      g_bottom_container TYPE REF TO cl_gui_container,

"in PBO module
CREATE OBJECT g_custom_container
      EXPORTING
        container_name              = 'CUSTOM_AREA'.
    
    "now split the container into three independent containers
    CREATE OBJECT g_splitter_container
      EXPORTING
         parent            = g_custom_container
         rows              = 3
         columns           = 1.

    "get top container 
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 1
        column    = 1
      RECEIVING
        container = g_top_container.

    "get middle container 
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 2
        column    = 1
      RECEIVING
        container = g_middle_container.

    "get bottome one
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 3
        column    = 1
      RECEIVING
        container = g_bottom_container.

    "create alv control instances placing it on the top container
    CREATE OBJECT g_alv_grid1
      EXPORTING
        i_parent          =  g_top_container.

    CREATE OBJECT g_alv_grid_ref2
      EXPORTING
        i_parent          =  g_middle_container.
     
    CREATE OBJECT g_alv_grid_ref3
      EXPORTING
        i_parent          =  g_bottom_container.

"diplay all your ALVs with set_table_for_first_display

Regards

Marcin

0 Kudos

Hi Marcin,

Thank You for Your answer.

Still a small problem is there.

When I use SET_TABLE_FOR_DISPLAY for three containers, It is displaying data only for First container.

Please give soltuion Further.

Thanks In Advance.

Regards,

Kumar.

0 Kudos

You need to call this method 3 times, one time per each ALV object


     CALL METHOD g_alv_grid1->SET_TABLE_FOR_FIRST_DISPLAY  "display first ALV
        ..."here parameters
 
      CALL METHOD g_alv_grid2->SET_TABLE_FOR_FIRST_DISPLAY "and second
        ..."here parameters

     CALL METHOD g_alv_grid3->SET_TABLE_FOR_FIRST_DISPLAY "and third
        ..."here parameters

Regards

Marcin

0 Kudos

Hi Marcin,

My Problem is solved.

Regards,

Kumar.

0 Kudos

Hi Marcin,

The above problem is fully solved.

I would like to ask one more query on this.

I have displayed three internal table data on three parts of containers.

Data is related to nearly 100 fields, so horizontal scrolling is needed.

My requirement is if we scroll any one of internal table data all three internal table data should be scrolled with respect to others.

So please give an clear Idea on this.

Thanks in Advance.

Regards,

Kumar.

0 Kudos

I must admit that this kind of requirement is untypicall and more advanced. Anyhow I look at the issue and here is the conclusion:

- to get info of scrollbar you can use method get_scroll_info_via_id

- to set scrollbar position for two other alvs you can use method set_scroll_info_via_id


  data: IS_COL_INFO Type  LVC_S_COL,

 "get scroll info of first alv
  CALL METHOD g_alv_grid1->get_scroll_info_via_id
    IMPORTING
      es_col_info = is_col_info.

"set same scroll position for others
    CALL METHOD g_alv_grid2->set_scroll_info_via_id
    exporting
      is_col_info = is_col_info.

    CALL METHOD g_alv_grid3->set_scroll_info_via_id
    exporting
      is_col_info = is_col_info.

- you would have to do the same for each other alv (I mean if second alv is scrolled then scroll also first and third, if third is scrolled, then scroll first and second). This requires some logic and implementation but is no an issue.

The real problem is: WHEN to call these methods? When you scroll, there is no event triggered, so you don't know when it is scrolled. I thought of two solutions:

1) scroll each time you push some custom pushbutton on ALV toolbar - which first you would have to create

2) as each GUI control can be registered to trigger PAI for certain kind of event, there would be possible to use method SET_REGISTERED_EVENTS with event EVT_HSCROLL and APPL_EVENT flag set.

This is what I tried, but here is the catch: this method is redefined in cl_gui_alv_grid and doens't allow to register events this way to ALV only - unfotunatelly

But to be more clear. This is not possible with second solution, only first one would be feasible, which means that there is no way to scroll different alvs dynamically as you require. The only possible way would be scrolling one ALV and then hiting some button to aling the others with scroll position.

Regards

Marcin