<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GET_SELECTED_ROWS not working second time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106602#M1973179</link>
    <description>&lt;P&gt;If you're using the CL_SALV_TABLE Class with custom Container you have to call the method &lt;/P&gt;&lt;P&gt;GET_METADATA before you can access the selected rows a.s.o.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2019 07:26:32 GMT</pubDate>
    <dc:creator>hohoman</dc:creator>
    <dc:date>2019-08-28T07:26:32Z</dc:date>
    <item>
      <title>GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106600#M1973177</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have seen many questions regarding the same but no solution work for me.&lt;/P&gt;
  &lt;P&gt;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 &lt;STRONG&gt;refreshing the internal table and grid.&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;Even setting the &lt;B&gt;SEL_MODE&lt;/B&gt; does not work for me.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;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-&amp;gt;GET_CONTAINER
 EXPORTING
 ROW = 1
 COLUMN = 1
 RECEIVING
 CONTAINER = CONTAINER_1.
 CALL METHOD SPLITTER-&amp;gt;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-&amp;gt;REFRESH_TABLE_DISPLAY
 EXPORTING
 I_SOFT_REFRESH = 'X'.
 ELSE.
 PERFORM LINE_SALES.
 CALL METHOD GRID1-&amp;gt;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-&amp;gt;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-&amp;gt;SET_TABLE_FOR_FIRST_DISPLAY
 EXPORTING
 IS_LAYOUT = GS_LAYOUT
 CHANGING
 IT_FIELDCATALOG = IT_FCAT1
 IT_OUTTAB = IT_VBAK.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;CALL METHOD GRID1-&amp;gt;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.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;For Full Code &lt;/P&gt;
  &lt;P&gt;Please Refer &lt;A href="https://answers.sap.com/storage/temp/1726748-full-code.txt"&gt;full-code.txt&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;THANK YOU&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 05:21:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106600#M1973177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T05:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106601#M1973178</link>
      <description>&lt;P&gt;First correct your code, you don't need to create again and again the same objects reference (container and grid) only create when initial/inactive. &lt;/P&gt;&lt;P&gt;Also &lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Check exception/return code after method call&lt;/LI&gt;&lt;LI&gt;Use call method cl_gui_cfw=&amp;gt;flush if you don't want to depend on PAI/PBO cycle and implicit call.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 28 Aug 2019 06:37:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106601#M1973178</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2019-08-28T06:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106602#M1973179</link>
      <description>&lt;P&gt;If you're using the CL_SALV_TABLE Class with custom Container you have to call the method &lt;/P&gt;&lt;P&gt;GET_METADATA before you can access the selected rows a.s.o.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 07:26:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106602#M1973179</guid>
      <dc:creator>hohoman</dc:creator>
      <dc:date>2019-08-28T07:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106603#M1973180</link>
      <description>&lt;P&gt;Your code contains errors where you used GRID1 for GRID2 and vice versa.&lt;/P&gt;&lt;P&gt;Note that ET_INDEX_ROWS is deprecated, you should use &lt;STRONG&gt;ET_ROW_NO&lt;/STRONG&gt; as per documentation (but it still works).&lt;/P&gt;&lt;P&gt;+ do what Raymond suggests.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 07:28:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106603#M1973180</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-08-28T07:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106604#M1973181</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/1726753-code.txt"&gt;code.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Kindly find the corrected Code &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chitme&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 08:56:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106604#M1973181</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T08:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106605#M1973182</link>
      <description>&lt;P&gt;Thank you for answering sir, but I'm not using &lt;STRONG&gt;CL_SALV_TABLE&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 09:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106605#M1973182</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T09:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106606#M1973183</link>
      <description>&lt;P&gt;Thank you for answering &lt;SPAN class="mention-scrubbed"&gt;chandchitme&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;As I can see you have added:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;CALL METHOD&lt;STRONG&gt; cl_gui_cfw=&amp;gt;flush.&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;gs_layout-&lt;STRONG&gt;SEL_MODE   = 'D'.&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;AND an Internal table&lt;STRONG&gt; IT_FINAL2.&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;But it does not work the second time &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 09:33:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106606#M1973183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T09:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106607#M1973184</link>
      <description>&lt;P&gt;For me the code working fine and i am getting the values every time for the selected number of rows&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chitme&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 09:38:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106607#M1973184</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T09:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106608#M1973185</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;chandchitme&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm really sorry, I forgot to uncomment a line. &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It works. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 09:41:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106608#M1973185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T09:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106609#M1973186</link>
      <description>&lt;P&gt;&lt;EM&gt;-&amp;gt; you don't need to create again and again the same objects reference (container and grid) only create when initial/inactive&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Thank You, it worked.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF GRID1 IS INITIAL AND GRID2 IS INITIAL.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Aug 2019 10:10:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106609#M1973186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T10:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: GET_SELECTED_ROWS not working second time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106610#M1973187</link>
      <description>&lt;P&gt;Got it, Thank You.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 10:10:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-not-working-second-time/m-p/12106610#M1973187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-28T10:10:39Z</dc:date>
    </item>
  </channel>
</rss>

