<?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 Appending dynamic Internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645731#M1572646</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;I am trying to create dynamic internal tables which can store data and can be used for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;further processing in the program.Say,I have 4 ztable names maintained in TVRAVC table then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should be able to create 4 internal tables which can store data and can be used for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;further processing like looping,read etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols:&amp;lt;table&amp;gt; type standard table,
              &amp;lt;fs_t&amp;gt; type any.
 
data:     lr_data type ref to data,

*Creating dynmaic internal tables for further processing
data:g_var1(4) type c value 'itab_',
     g_var2(7) type c.
loop at g_t_rec assigning &amp;lt;fs_t&amp;gt;.
clear:g_t_tvarvc,g_source.
read table g_t_tvarvc with key name = c_tty1
                               low  = &amp;lt;fs_t&amp;gt;+0(2).
if sy-subrc = 0.
g_source  = g_t_tvarvc-low                            "KK
g_tabname = g_t_tvarvc-high.                          "ZTABLE1
concatenate g_var1 g_source into g_var2               "here i will get itab_KK
create data lr_data  type table of (g_tabname).  
assign lr_data-&amp;gt;* to &amp;lt;table&amp;gt;.                         "here I got the Ztable structure
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to get the internal table as ITAB_KK into which I can move the g_t_rec internal table data.Similary I intend to get 4 internal tables.Kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;KIran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Feb 2011 09:54:17 GMT</pubDate>
    <dc:creator>kiran_k8</dc:creator>
    <dc:date>2011-02-09T09:54:17Z</dc:date>
    <item>
      <title>Appending dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645731#M1572646</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;I am trying to create dynamic internal tables which can store data and can be used for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;further processing in the program.Say,I have 4 ztable names maintained in TVRAVC table then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should be able to create 4 internal tables which can store data and can be used for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;further processing like looping,read etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols:&amp;lt;table&amp;gt; type standard table,
              &amp;lt;fs_t&amp;gt; type any.
 
data:     lr_data type ref to data,

*Creating dynmaic internal tables for further processing
data:g_var1(4) type c value 'itab_',
     g_var2(7) type c.
loop at g_t_rec assigning &amp;lt;fs_t&amp;gt;.
clear:g_t_tvarvc,g_source.
read table g_t_tvarvc with key name = c_tty1
                               low  = &amp;lt;fs_t&amp;gt;+0(2).
if sy-subrc = 0.
g_source  = g_t_tvarvc-low                            "KK
g_tabname = g_t_tvarvc-high.                          "ZTABLE1
concatenate g_var1 g_source into g_var2               "here i will get itab_KK
create data lr_data  type table of (g_tabname).  
assign lr_data-&amp;gt;* to &amp;lt;table&amp;gt;.                         "here I got the Ztable structure
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to get the internal table as ITAB_KK into which I can move the g_t_rec internal table data.Similary I intend to get 4 internal tables.Kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;KIran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 09:54:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645731#M1572646</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2011-02-09T09:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Appending dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645732#M1572647</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;Get field list of fields in main internal table G_T_REC and ITAB_* using methods of class cl_abap_structdescr and compare the field names of each and move the values from g_t_rec to itab_*.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(refer: &lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5157190"&gt;&lt;/A&gt; - Jerry Coleman)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;l_t_compdescr1  = l_r_structdescr-&amp;gt;components. " of g_t_rec
 l_t_compdescr2  = l_r_structdescr-&amp;gt;components. " of itab_kk

LOOP AG g_t_rec.
  LOOP AT l_t_compdescr1 
    READ TABLE l_t_compdescr2 WITH KEY name = l_t_compdescr1-name
    IF success.
      itab_kk-(l_t_compdescr1-name) = g_t_rec-(l_t_compdescr1-name).
      .....
      APPEND itab_kk.
    ENDIIF.
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you got my point.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 12:46:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645732#M1572647</guid>
      <dc:creator>asik_shameem</dc:creator>
      <dc:date>2011-02-09T12:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Appending dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645733#M1572648</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;The steps you performed can create the dynamic tables &lt;/P&gt;&lt;P&gt;for further processing like loop at or read table  try using &lt;STRONG&gt;assign component&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*got data from TVARVC into IT_TVARVC
create d_tab type table of (IT_TVARVC-HIGH).      "suppose HIGH have table name
create d_wa type (IT_TVARVC-HIGH).
assign d_tab-&amp;gt;* to &amp;lt;ftab&amp;gt;.
select * from (IT_TVARVC-HIGH) into table &amp;lt;ftab&amp;gt;
        where (condn).                             "dynamic condn
loop at &amp;lt;ftab&amp;gt; assiging &amp;lt;fwa&amp;gt;.
assign component sy-tabix  of structure &amp;lt;ftab&amp;gt; to &amp;lt;fld&amp;gt;.   "assigning values to fields
endloop.
* same for read stat
read table &amp;lt;ftab&amp;gt; assiging &amp;lt;fwa&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anmol.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 13:27:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-dynamic-internal-table/m-p/7645733#M1572648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-09T13:27:27Z</dc:date>
    </item>
  </channel>
</rss>

