01-06-2015 11:21 AM
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!
01-06-2015 11:41 AM
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.
01-07-2015 10:58 AM
01-07-2015 11:14 AM
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.
01-06-2015 11:58 AM
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
01-08-2015 6:14 AM
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.
09-08-2020 7:44 AM
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. 🙂