Skip to Content
0
Jan 06, 2015 at 11:21 AM

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

4164 Views

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!