<?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 Recycling objects (alv-grid) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991415#M1605641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus.&lt;/P&gt;&lt;P&gt;I must get seven different grids (seven different totals) starting from a gui.&lt;/P&gt;&lt;P&gt;I wouldnu2019t wish to declare seven containers and seven alv-grid, I would prefer declare only one time both objects. So every time I use the FREE instruction and then the CREATE again:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="CODE"&gt;
  DATA: r_cont_2   TYPE REF TO cl_gui_custom_container,
        r_alv_2    TYPE REF TO cl_gui_alv_grid,
        gs_layout2 TYPE lvc_s_layo.
 
  IF NOT r_cont_2 IS INITIAL.
    FREE r_cont_2.
    CLEAR r_cont_2.
  ENDIF.
  IF NOT r_alv_2 IS INITIAL.
    FREE r_alv_2.
    CLEAR r_alv_2.
  ENDIF.

  CREATE OBJECT r_cont_2
     EXPORTING
         container_name = 'SCR_TXT2'.

  CREATE OBJECT r_alv_2
   EXPORTING
       i_parent = r_cont_2.

  CASE ok_code.
    WHEN '1'.
      CALL METHOD r_alv_2-&amp;gt;set_table_for_first_display
       EXPORTING
           is_layout = gs_layout2
       CHANGING
           it_fieldcatalog = it_fdcat  u201C &amp;lt;&amp;lt;&amp;lt; Changed for table 1!!!
           it_outtab = it_tab1         u201C &amp;lt;&amp;lt;&amp;lt; Table 1
       EXCEPTIONS
           OTHERS = 4.

    WHEN '2'.
      CALL METHOD r_alv_2-&amp;gt;set_table_for_first_display
       EXPORTING
           is_layout = gs_layout2
       CHANGING
           it_fieldcatalog = it_fdcat  u201C &amp;lt;&amp;lt;&amp;lt; Changed for table 2!!!
           it_outtab = it_tab2         u201C &amp;lt;&amp;lt;&amp;lt; Table 2
       EXCEPTIONS
           OTHERS = 4.
u2026u2026..
ENDCASE.
&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I get the first output,  I get the first grid correct (any table, everything is ok). When I get the second output and over, I see the first table again. In debug mode I can see the second new table correctly when I call the method, and I can see the objects full before the FREE instruction, and empty after.&lt;/P&gt;&lt;P&gt;Is there a solution, or must I declare seven alv-grid?&lt;/P&gt;&lt;P&gt;Must I declare seven containers too?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for you replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 May 2011 14:04:41 GMT</pubDate>
    <dc:creator>former_member1161170</dc:creator>
    <dc:date>2011-05-31T14:04:41Z</dc:date>
    <item>
      <title>Recycling objects (alv-grid)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991415#M1605641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus.&lt;/P&gt;&lt;P&gt;I must get seven different grids (seven different totals) starting from a gui.&lt;/P&gt;&lt;P&gt;I wouldnu2019t wish to declare seven containers and seven alv-grid, I would prefer declare only one time both objects. So every time I use the FREE instruction and then the CREATE again:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="CODE"&gt;
  DATA: r_cont_2   TYPE REF TO cl_gui_custom_container,
        r_alv_2    TYPE REF TO cl_gui_alv_grid,
        gs_layout2 TYPE lvc_s_layo.
 
  IF NOT r_cont_2 IS INITIAL.
    FREE r_cont_2.
    CLEAR r_cont_2.
  ENDIF.
  IF NOT r_alv_2 IS INITIAL.
    FREE r_alv_2.
    CLEAR r_alv_2.
  ENDIF.

  CREATE OBJECT r_cont_2
     EXPORTING
         container_name = 'SCR_TXT2'.

  CREATE OBJECT r_alv_2
   EXPORTING
       i_parent = r_cont_2.

  CASE ok_code.
    WHEN '1'.
      CALL METHOD r_alv_2-&amp;gt;set_table_for_first_display
       EXPORTING
           is_layout = gs_layout2
       CHANGING
           it_fieldcatalog = it_fdcat  u201C &amp;lt;&amp;lt;&amp;lt; Changed for table 1!!!
           it_outtab = it_tab1         u201C &amp;lt;&amp;lt;&amp;lt; Table 1
       EXCEPTIONS
           OTHERS = 4.

    WHEN '2'.
      CALL METHOD r_alv_2-&amp;gt;set_table_for_first_display
       EXPORTING
           is_layout = gs_layout2
       CHANGING
           it_fieldcatalog = it_fdcat  u201C &amp;lt;&amp;lt;&amp;lt; Changed for table 2!!!
           it_outtab = it_tab2         u201C &amp;lt;&amp;lt;&amp;lt; Table 2
       EXCEPTIONS
           OTHERS = 4.
u2026u2026..
ENDCASE.
&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I get the first output,  I get the first grid correct (any table, everything is ok). When I get the second output and over, I see the first table again. In debug mode I can see the second new table correctly when I call the method, and I can see the objects full before the FREE instruction, and empty after.&lt;/P&gt;&lt;P&gt;Is there a solution, or must I declare seven alv-grid?&lt;/P&gt;&lt;P&gt;Must I declare seven containers too?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for you replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 14:04:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991415#M1605641</guid>
      <dc:creator>former_member1161170</dc:creator>
      <dc:date>2011-05-31T14:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Recycling objects (alv-grid)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991416#M1605642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use one instance for alv and container . Change fieldcat , layout using SET_FRONTEND_FIELDCATALOG&lt;/P&gt;&lt;P&gt;SET_FRONTEND_LAYOUT methods , than refresh grid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 14:19:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991416#M1605642</guid>
      <dc:creator>huseyindereli</dc:creator>
      <dc:date>2011-05-31T14:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Recycling objects (alv-grid)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991417#M1605643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wonderful !!!&lt;/P&gt;&lt;P&gt;It's perfect !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 14:40:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/recycling-objects-alv-grid/m-p/7991417#M1605643</guid>
      <dc:creator>former_member1161170</dc:creator>
      <dc:date>2011-05-31T14:40:19Z</dc:date>
    </item>
  </channel>
</rss>

