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 catch the select data in multiple ALV

former_member189009
Active Participant
0 Kudos

Dear,

       Recently I develop a program display with multiple ALV:  when I select one data of one ALV(like the image ) I want to know the data is in which output table (three table) and in which line. how can I get this ?

Thanks for your sincerely asnwer.

The diaplay code:

CREATE OBJECT container

     EXPORTING

       container_name = g_container.

   CREATE OBJECT grid1

     EXPORTING

       i_parent = container_1.

   CALL METHOD grid1->set_table_for_first_display

     CHANGING

       IT_FIELDCATALOG = GT_FIELDLOG

       it_outtab       = <DYN_T_SAME>.

   CREATE OBJECT container

     EXPORTING

       container_name = g_container.

   CREATE OBJECT grid3

     EXPORTING

       i_parent = container_5.

   CALL METHOD grid3->set_table_for_first_display

     CHANGING

       IT_FIELDCATALOG = GT_FIELDLOG

       it_outtab       = <DYN_TAB1>.

   CREATE OBJECT container

     EXPORTING

       container_name = g_container.

   CREATE OBJECT grid4

     EXPORTING

       i_parent = container_6.

   CALL METHOD grid4->set_table_for_first_display

     CHANGING

       IT_FIELDCATALOG = GT_FIELDLOG

       it_outtab       = <DYN_TAB2>.

5 REPLIES 5

archanapawar
Contributor
0 Kudos

You need to use At user-command event.

Former Member
0 Kudos

Hi Zongjie,

Each ALV object(grid1, grid2, grid3) have their own get_selected_row method. Just call this method to get.

If all the their object return values, means you selected at least one row for each ALV.

regards,

Archer

0 Kudos

Hi dengyong,

    Thanks for your answer. it helps, but when I call the method, it didn't get the data.

First display, then select the row, this method run when I click one button after I select the row.

CALL METHOD grid3->GET_SELECTED_ROWS

             IMPORTING

                ET_INDEX_ROWS = GT_ROW_TAB1

                ET_ROW_NO     = GT_NO_TAB1.

pavanm592
Contributor
0 Kudos

Hi Zhang,

You can get the line selected by using the  get_selected_rows.

Assuming you have the Gr_grid1 ,Gr_grid2, Gr_grid3 objects for 3 alvs when you select the line in first alv then you can read the data by using the corresponding object i.e

GR_GRID1->Get_selected_rows.

if sy-subrc eq 0.

**Perform your action here similarly for remaining two alv's

endif.

Go through this link

https://help.sap.com/saphelp_erp2004/helpdata/en/0a/b55312d30911d2b467006094192fe3/content.htm?frame...

Regards,

Pavan

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Get the book An Easy Reference for ALV Grid Control

Chapter "Event Based Additional Functionalities"

deals with handler class

A real eye opener...

             

regards.