Skip to Content

How to catch the select data in multiple ALV

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>.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Dec 23, 2014 at 11:31 AM

    You need to use At user-command event.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2014 at 11:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Dec 23, 2014 at 11:37 AM

    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?frameset=/en/0a/b55336d30911d2b467006094192fe3/frameset.htm&current_toc=/en/c5/3bd1369f2d280ee10000009b38f889/plain.htm&node_id=69

    Regards,

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 04:24 PM

    Hi,

    Get the book An Easy Reference for ALV Grid Control

    An Easy Reference For ALV Grid Control

    Chapter "Event Based Additional Functionalities"

    deals with handler class

    A real eye opener...

                 

    regards.     

    Add comment
    10|10000 characters needed characters exceeded