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: 

GET_SELECTED_ROWS didn't get the selected row in second time.

former_member189009
Active Participant
0 Kudos

Dear friends,

      I had trapped in this problem in many days, I have search many discussion in SCN, but didn't find any solution yet. Hope someone can help me with this:

      I display an ALV report by OO container, which divide into three pieces. Such as when I select two row then I click one button, then I want to get the row I selected. but now it can only get the row first time, after that, it wouldn't succeed again unless I run the report again.

     In addition, after I select another ALV row, then back into the above screen, it can not get the row no matter first time or other:

My code in PBO(post some key code 😞

DATA: Grid4            TYPE REF TO cl_gui_alv_grid.

WA_LAYOUT1-SEL_MODE = 'A'.

CALL METHOD grid4->set_table_for_first_display

     EXPORTING

        IS_LAYOUT       = WA_LAYOUT1

        IS_VARIANT      = WA_VARIANT1

        I_SAVE          = 'A'

     CHANGING

       IT_FIELDCATALOG = GT_FIELDLOG

       it_outtab       = <DYN_TAB2>.


after I select some row, I click the button, then it run this code in PAI :


IF GRID4 IS NOT INITIAL.

            CLEAR GT_ROW_TAB2.

            CLEAR GT_NO_TAB2.

            call method grid4->check_changed_data

               importing

                  e_valid = l_valid.

             CALL METHOD grid4->GET_SELECTED_ROWS

               IMPORTING

                ET_INDEX_ROWS = GT_ROW_TAB2[]

                ET_ROW_NO     = GT_NO_TAB2[].

ENDIF.

     

     Thanks for your sincerely answer!

6 REPLIES 6

ipravir
Active Contributor
0 Kudos

Hi Zhang,

Call the REFRESH_TABLE_DISPLAY method in PBO with respect to your grids objects.

Code Should be.

PBO.

     your current coding to display the information through set_table_for_first_display.

    

     at the last of PBO.

          call the grid->REFRESH_TABLE_DISPLAY

          exporting

               I_SOFT_REFRESH = 'X'.

PAI
     PAI Coding.

regards.

Praveer.

0 Kudos

Dear Praveer,

       Thanks for your help, but I try , it didn't work!

ipravir
Active Contributor
0 Kudos

Hi Zhang,

Please find the below screens,

I made a very simple program.

1 Inside the PBO Module.

2 Inside the PAI module

and every time selected row information is coming on et_index_rows parameter.

Please check.

regards.

Praveer.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

For editable ALV, event needs to be registered and then once the data is updated, we should use refresh_table_Display method. Refer the below link in which I am explaining the same.

http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=37472

VenkatRamesh_V
Active Contributor
0 Kudos

Hi Zhang,

             CALL METHOD grid4->GET_SELECTED_ROWS

               IMPORTING

                ET_INDEX_ROWS = GT_ROW_TAB2[]

                ET_ROW_NO     = GT_NO_TAB2[].

CALL METHOD grid4->refresh_table_display.

Hope it helpful.

Regards,

Venkat.

NemanjaSimovic
Participant
0 Kudos

Interesting to mention. I had in PAI module

gr_grid2->check_changed_data ( ... )

but when I comment it, selection stayed on Grid1.

Maybe it will work for someone. 🙂