<?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: Creating new variable with variant name in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151119#M1368608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the way to do!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much Sandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Sep 2009 11:37:44 GMT</pubDate>
    <dc:creator>michael_fallenbchel</dc:creator>
    <dc:date>2009-09-14T11:37:44Z</dc:date>
    <item>
      <title>Creating new variable with variant name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151114#M1368603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem with my new function module:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a function module to easily make an ALV on a dynpro. In this function, I create the container (create object cl_gui_custom_container), and then the grid (create object cl_gui_alv_grid).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After thsi, I set the field catalogue, the layout...and then I made the ALV using method "set_table_for_first_display" of cl_gui_alv_grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No problem, everything works perfect. Until now: I have a dynpro with a tabstrip, in 2 of those tabs I want to have an ALV. I filled the tables, made the containers in the Tabs of the dynpro. BUt it won't work perfetct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem now is that the function creates the container one time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
      EXPORTING
        container_name = container_name.
    CREATE OBJECT grid
      EXPORTING
        i_parent = g_custom_container.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first table/ALV will be filled. Then the function will be called a second time (second ALV, an other Tab). Function comes to create the container - but it still exists. So no new container will be created, instead the data of the second table will be shown in the first ALV.&lt;/P&gt;&lt;P&gt;Ok, I tried to remove the if-statement (IF g_custom_container IS INITIAL.). OK, works, until I change data in one of the ALVs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My idea is to create the container dynamically, with different names. I called the function this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'ZZ_CREATE_ALV'
    EXPORTING
      container_name = 'T_ALV'
      tab_name       = 'GT_FIELDS'
    CHANGING
      output_tab     = gt_fields.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;container_name is the name of the container on the dynpro/tab, tab_name is the name of the used table (as string), and output_tab is the table itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, the question: is it possible to make the name if my variant (here, g_custom_container and grid) dynamic, for example tab_name + "_grid" -&amp;gt; GT_FIELDS_GRID? Or any other ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 12:00:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151114#M1368603</guid>
      <dc:creator>michael_fallenbchel</dc:creator>
      <dc:date>2009-09-10T12:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable with variant name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151115#M1368604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use an internal table. First line for first ALV, second line for second ALV.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2009 08:40:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151115#M1368604</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-14T08:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable with variant name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151116#M1368605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first - thanks for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm not sure if I understand you right:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where should I use this table? Could you explain it a little bit more?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2009 08:58:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151116#M1368605</guid>
      <dc:creator>michael_fallenbchel</dc:creator>
      <dc:date>2009-09-14T08:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable with variant name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151117#M1368606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, I try. For example, in your function module add a new importing parameter ALV_ID to identify the ALV. The new internal table (GT_IT) has 3 fields, alv_id, o_container, o_alv_grid. In your function module, instead of IF ... IS INITIAL, you write:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
READ TABLE gt_it INTO gs_it WITH KEY alv_id = alv_id.
IF sy-subrc &amp;lt;&amp;gt; 0.
* create container (gs_it-o_container) and alv control (gs_x-o_alv_grid)
...
APPEND gs_it TO gt_it.
ENDIF.
...
* gs_it-o_alv_grid-&amp;gt;method( ... ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2009 10:03:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151117#M1368606</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-14T10:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable with variant name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151118#M1368607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK Sandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now it's much clearer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But one thing I have to ask - how to fill this internal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2009 10:14:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151118#M1368607</guid>
      <dc:creator>michael_fallenbchel</dc:creator>
      <dc:date>2009-09-14T10:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable with variant name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151119#M1368608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the way to do!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much Sandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2009 11:37:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-new-variable-with-variant-name/m-p/6151119#M1368608</guid>
      <dc:creator>michael_fallenbchel</dc:creator>
      <dc:date>2009-09-14T11:37:44Z</dc:date>
    </item>
  </channel>
</rss>

