Skip to Content
0
Aug 28, 2019 at 05:21 AM

GET_SELECTED_ROWS not working second time

173 Views

Hello,

I have seen many questions regarding the same but no solution work for me.

PROBLEM: GET_SELECTED_ROWS returns the selected index the first time when a button is triggered but does not return any value the second time even after refreshing the internal table and grid.

Even setting the SEL_MODE does not work for me.

CALL SCREEN 9000.
MODULE STATUS_9000 OUTPUT.
 SET PF-STATUS 'STATUS'.
 IF MATRL_R = 'X'.
 SET TITLEBAR 'TITLE'.
 ELSE.
 SET TITLEBAR 'TITLE1'.
 ENDIF.
 CREATE OBJECT CONTAINER
 EXPORTING
 CONTAINER_NAME = 'CCONTAINER'.
 CREATE OBJECT SPLITTER
 EXPORTING
 PARENT = CONTAINER
 ROWS = 2
 COLUMNS = 1.
 CALL METHOD SPLITTER->GET_CONTAINER
 EXPORTING
 ROW = 1
 COLUMN = 1
 RECEIVING
 CONTAINER = CONTAINER_1.
 CALL METHOD SPLITTER->GET_CONTAINER
 EXPORTING
 ROW = 2
 COLUMN = 1
 RECEIVING
 CONTAINER = CONTAINER_2.
 CREATE OBJECT GRID1
 EXPORTING
 I_PARENT = CONTAINER_1.
 CREATE OBJECT GRID2
 EXPORTING
 I_PARENT = CONTAINER_2.
 IF MATRL_R = 'X'.
 PERFORM M_OO.
 ELSE.
 PERFORM S_OO.
 ENDIF.
ENDMODULE. 

MODULE USER_COMMAND_9000 INPUT.
 CASE SY-UCOMM.
 WHEN 'BACK'.
 LEAVE TO SCREEN 0.
 WHEN 'CANCEL'.
 LEAVE PROGRAM.
 WHEN 'EXIT'.
 LEAVE TO SCREEN 0.
 WHEN 'DISPLAY' .
 IF MATRL_R = 'X'.
 PERFORM LINE_MATERIAL.
 CALL METHOD GRID2->REFRESH_TABLE_DISPLAY
 EXPORTING
 I_SOFT_REFRESH = 'X'.
 ELSE.
 PERFORM LINE_SALES.
 CALL METHOD GRID1->REFRESH_TABLE_DISPLAY
 EXPORTING
 I_SOFT_REFRESH = 'X'.
 ENDIF.
 CLEAR SY-UCOMM.
 ENDCASE.
ENDMODULE.
FORM M_OO.
 GS_LAYOUT-GRID_TITLE = 'Material Report'.
* gs_layout-SEL_MODE = 'A'.
 CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
 EXPORTING
 IS_LAYOUT = GS_LAYOUT
 CHANGING
 IT_OUTTAB = IT_FINAL
 IT_FIELDCATALOG = IT_FCAT.
ENDFORM.
FORM S_OO.
 GS_LAYOUT-GRID_TITLE = 'Sales Report'.
* gs_layout-SEL_MODE = 'A'.
 CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
 EXPORTING
 IS_LAYOUT = GS_LAYOUT
 CHANGING
 IT_FIELDCATALOG = IT_FCAT1
 IT_OUTTAB = IT_VBAK.
ENDFORM.
CALL METHOD GRID1->GET_SELECTED_ROWS
 IMPORTING
 ET_INDEX_ROWS = ROWS.
 LOOP AT ROWS INTO WA_ROWS.
 READ TABLE IT_MARA INTO WA_MARA INDEX WA_ROWS-INDEX.
 WA_FINAL-MATNR = WA_MARA-MATNR.
 WA_FINAL-ERSDA = WA_MARA-ERSDA.
 WA_FINAL-ERNAM = WA_MARA-ERNAM.
 WA_FINAL-LAEDA = WA_MARA-LAEDA.
 WA_FINAL-MTART = WA_MARA-MTART.
 WA_FINAL-MATKL = WA_MARA-MATKL.
 WA_FINAL-MEINS = WA_MARA-MEINS.
 READ TABLE IT_MARD INTO WA_MARD WITH KEY MATNR = WA_FINAL-MATNR.
 WA_FINAL-LGORT = WA_MARD-LGORT.
 WA_FINAL-WERKS = WA_MARD-WERKS.
 APPEND WA_FINAL TO IT_FINAL.
ENDLOOP.

For Full Code

Please Refer full-code.txt

THANK YOU

Attachments

full-code.txt (14.8 kB)