<?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: structure dynamic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431793#M1411082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo Natasha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can make use of the RTTS services in ABAP to create dynamic internal tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lineType TYPE REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;        tableType TYPE REF TO cl_abap_tabledescr,&lt;/P&gt;&lt;P&gt;         key TYPE abap_keydescr_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lineType ?=cl_abap_typedescr=&amp;gt;describe_by_name( 'SPFLI' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND 'CARRID' TO key. APPEND 'CONNID' TO key.&lt;/P&gt;&lt;P&gt;tableType = cl_abap_tabledescr=&amp;gt;create(&lt;/P&gt;&lt;P&gt;p_line_type = lineType&lt;/P&gt;&lt;P&gt;p_table_kind = cl_abap_tabledescr=&amp;gt;tablekind_sorted&lt;/P&gt;&lt;P&gt;p_unique = abap_true&lt;/P&gt;&lt;P&gt;p_key = key ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 22 Nov 2009 15:11:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-11-22T15:11:25Z</dc:date>
    <item>
      <title>structure dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431789#M1411078</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;&lt;/P&gt;&lt;P&gt;I have a small requirement. I need to create a structure with fields MATNR,BUKRS,KOKRS and populate some values to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so that the name of the internal table should vary like "CEO" + "the value of a field ERKRS(which will be populated in the loop IT_TKA01-erkrs)"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the value of field ERKRS = 101. The name of the structure should be CEO101.&lt;/P&gt;&lt;P&gt;if the value of field ERKRS = 102.The name of the structure should be CEO102.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then it should be populated with some values and pass it to an  function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone let me know how to handle this situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Natasha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 15:03:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431789#M1411078</guid>
      <dc:creator>former_member423024</dc:creator>
      <dc:date>2009-11-21T15:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: structure dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431790#M1411079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Natasha, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If structure fields are same or you are inserting records into same database table then no need to implement this logic,just make an extra field in your table and structure as identifier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, as you need to populate different internal tables , then just use IF statement and then insert record based on this and pass the internal table to FM in same IF body.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Harsh Bhalla on Nov 21, 2009 9:03 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 15:32:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431790#M1411079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-21T15:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: structure dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431791#M1411080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi harsha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply. But you didn't get me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to create a data object whose &lt;STRONG&gt;name&lt;/STRONG&gt; varies with in a loop,  I have to pass always 3 values to it. It will hold always 3 values only as a record.  But the name should vary accordingly in the loop&lt;/P&gt;&lt;P&gt;(as explained in the previous query)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do reply about this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Natasha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Nov 2009 06:05:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431791#M1411080</guid>
      <dc:creator>former_member423024</dc:creator>
      <dc:date>2009-11-22T06:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: structure dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431792#M1411081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand it correctly you would like to use dynamic structures names (which can change during the loop).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at following example how to use dynamic variables in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[https://wiki.sdn.sap.com/wiki/display/ABAP/Dynamic&lt;EM&gt;Internal&lt;/EM&gt;table|https://wiki.sdn.sap.com/wiki/display/ABAP/Dynamic&lt;EM&gt;Internal&lt;/EM&gt;table]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is an example for a dynamic internal table, try to analyse the statements and map it to dynamic structures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe this is too complicated, in your case you can also use a simple IF statement and based on the result fill structure 1 or 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Nov 2009 12:23:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431792#M1411081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-22T12:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: structure dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431793#M1411082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo Natasha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can make use of the RTTS services in ABAP to create dynamic internal tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lineType TYPE REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;        tableType TYPE REF TO cl_abap_tabledescr,&lt;/P&gt;&lt;P&gt;         key TYPE abap_keydescr_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lineType ?=cl_abap_typedescr=&amp;gt;describe_by_name( 'SPFLI' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND 'CARRID' TO key. APPEND 'CONNID' TO key.&lt;/P&gt;&lt;P&gt;tableType = cl_abap_tabledescr=&amp;gt;create(&lt;/P&gt;&lt;P&gt;p_line_type = lineType&lt;/P&gt;&lt;P&gt;p_table_kind = cl_abap_tabledescr=&amp;gt;tablekind_sorted&lt;/P&gt;&lt;P&gt;p_unique = abap_true&lt;/P&gt;&lt;P&gt;p_key = key ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Nov 2009 15:11:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/structure-dynamic/m-p/6431793#M1411082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-22T15:11:25Z</dc:date>
    </item>
  </channel>
</rss>

