<?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 Internal Table having mulitple structures. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234242#M1209755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rao,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One small suggession. Check whether this is useful in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of having two different internal tables with a common key, you can create one internal table with all the fields available in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Types:
Begin of g_struct3,
column1 type c ,
column2 type c ,
column3 type c ,
column4 type c ,
column5 type c ,
End of g_struct3.

data: it_struct3 type standard table of g_struct3.

data: w_struct3 type g_struct3.

w_struct3-column1 = 'A'.
w_struct3-column2 = 'B'.
w_struct3-column3 = 'C'.
w_struct3-column4 = 'D'.
w_struct3-column5 = 'E'.

append w_struct3 to it_struct3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your internal table will have the data like shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A B C D E&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What ever manipulations you want to make with two internal tables (having a common key), you can do those manipulations with one internal table (having all those fields available) also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Feb 2009 05:02:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-26T05:02:53Z</dc:date>
    <item>
      <title>Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234236#M1209749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to create one internal table to extract data of multiple structures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g.  I have two structures :   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types:&lt;/P&gt;&lt;P&gt;Begin of  g_struct1,&lt;/P&gt;&lt;P&gt; column1 type c , &lt;/P&gt;&lt;P&gt; column2 type c ,&lt;/P&gt;&lt;P&gt;Begin of  g_struct1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Begin of  g_struct2,&lt;/P&gt;&lt;P&gt; column3 type c ,&lt;/P&gt;&lt;P&gt; column4 type c ,&lt;/P&gt;&lt;P&gt; column5 type c ,&lt;/P&gt;&lt;P&gt;Begin of  g_struct2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_struct1 type g_struct1,&lt;/P&gt;&lt;P&gt;        w_struct2 type g_struct3,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; w_struct1-column1 = 'A'.&lt;/P&gt;&lt;P&gt; w_struct1-column2 = 'B'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; w_struct2-column3 = 'C'.&lt;/P&gt;&lt;P&gt; w_struct2-column4 = 'D'.&lt;/P&gt;&lt;P&gt; w_struct2-column5 = 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the above two structures i want to build internal table and create a common key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expected Data in Internal Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1AB&lt;/P&gt;&lt;P&gt;1CDE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:02:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234236#M1209749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234237#M1209750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rao,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you elabrate your requirement .so that it is more convenient get a solution for your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:05:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234237#M1209750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234238#M1209751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:15:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234238#M1209751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234239#M1209752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i did not understood ur queryy properly, but, do u mean like below,(with assumption that, each itab1 and itab2 does contans same # of recs)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ind type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;consolidated_itab is ur result itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table itab1 lines sy-tfill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do sy-tfill times.&lt;/P&gt;&lt;P&gt;add 1 to idx.&lt;/P&gt;&lt;P&gt;read itab1 index idx&lt;/P&gt;&lt;P&gt;consolidated_itab-key = idx.&lt;/P&gt;&lt;P&gt;consolidated_itab-field1 = itab1-field1.&lt;/P&gt;&lt;P&gt;append consolidated_itab&lt;/P&gt;&lt;P&gt;clear consolidated_itab&lt;/P&gt;&lt;P&gt;read itab2 index idx&lt;/P&gt;&lt;P&gt;consolidated_itab-key = idx.&lt;/P&gt;&lt;P&gt;consolidated_itab-field1 = itab2-field1.&lt;/P&gt;&lt;P&gt;append consolidated_itab&lt;/P&gt;&lt;P&gt;clear consolidated_itab&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there r syntax errors, pls. check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanq&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:17:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234239#M1209752</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234240#M1209753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;          do like this,&lt;/P&gt;&lt;P&gt; data: begin of t_itab occurs 0,&lt;/P&gt;&lt;P&gt;         include structure t_struct1.&lt;/P&gt;&lt;P&gt;         include structure t_struct2.&lt;/P&gt;&lt;P&gt;data: end of t_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:19:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234240#M1209753</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234241#M1209754</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;try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create one more field which would be common for both structures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types:&lt;/P&gt;&lt;P&gt;Begin of g_struct1,&lt;/P&gt;&lt;P&gt;comm type i,&lt;/P&gt;&lt;P&gt;column1 type c , &lt;/P&gt;&lt;P&gt;column2 type c ,&lt;/P&gt;&lt;P&gt;Begin of g_struct1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Begin of g_struct2,&lt;/P&gt;&lt;P&gt;comm type i,&lt;/P&gt;&lt;P&gt;column3 type c ,&lt;/P&gt;&lt;P&gt;column4 type c ,&lt;/P&gt;&lt;P&gt;column5 type c ,&lt;/P&gt;&lt;P&gt;Begin of g_struct2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_struct1 type g_struct1,&lt;/P&gt;&lt;P&gt;w_struct2 type g_struct3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab1 like standard table of w_struct1,&lt;/P&gt;&lt;P&gt;itab2 like standard table of w_struct2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_struct1-comm = 1.&lt;/P&gt;&lt;P&gt;w_struct1-column1 = 'A'.&lt;/P&gt;&lt;P&gt;w_struct1-column2 = 'B'.&lt;/P&gt;&lt;P&gt;append w_struct1 to itab1.&lt;/P&gt;&lt;P&gt;clear w_struct1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_struct2-comm = 1.&lt;/P&gt;&lt;P&gt;w_struct2-column3 = 'C'.&lt;/P&gt;&lt;P&gt;w_struct2-column4 = 'D'.&lt;/P&gt;&lt;P&gt;w_struct2-column5 = 'E'.&lt;/P&gt;&lt;P&gt;append w_struct2 to itab2.&lt;/P&gt;&lt;P&gt;clear w_struct2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:35:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234241#M1209754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234242#M1209755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rao,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One small suggession. Check whether this is useful in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of having two different internal tables with a common key, you can create one internal table with all the fields available in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Types:
Begin of g_struct3,
column1 type c ,
column2 type c ,
column3 type c ,
column4 type c ,
column5 type c ,
End of g_struct3.

data: it_struct3 type standard table of g_struct3.

data: w_struct3 type g_struct3.

w_struct3-column1 = 'A'.
w_struct3-column2 = 'B'.
w_struct3-column3 = 'C'.
w_struct3-column4 = 'D'.
w_struct3-column5 = 'E'.

append w_struct3 to it_struct3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your internal table will have the data like shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A B C D E&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What ever manipulations you want to make with two internal tables (having a common key), you can do those manipulations with one internal table (having all those fields available) also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 05:02:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234242#M1209755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T05:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal Table having mulitple structures.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234243#M1209756</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;To have multiply structures in one table and later be able to address them within one table row, do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"first structure
types: begin of g_struct1,
              column1 type c ,
              column2 type c ,
           end of g_struct1.

"second one
types: begin of g_struct2,
           column3 type c ,
           column4 type c ,
           column5 type c ,
         end of g_struct2.

"compound type of these two structures
types: begin of g_struct.
  include type g_struct1 as first_struct.
  include type g_struct2 as sec_struct.
types: end of g_struct.

"table type of compound structures type
types: g_tab type table of g_struct with key .....   "list your key fields here (will become common key)

"declare your table
data: gt_tab type g_tab with header line.

"now you address table components (all 5 columns) normally i.e.
gt_tab-column1 = ...
gt_tab-column2 = ...
...
gt_tab-column5 = ...

"but you can also address entire structures within the table (not only its components) i.e. when passing to 
"subroutine

perform my_sub using gt_tab-first_struct1    "pass all components of first structure (2 first columns)
                                       gt_tab-sec_struct2.   "pass all components of sec one (3 last columns)


form my_sub using f_struct1 type g_struct1
                                 f_struct2 type g_struct2.
"here you still can adress the componetns separately like
f_strcut1-column1 = ...
...
f_strcut2-column4 =...

"but also address them like
move-corresponding f_struct1 to ....  "move  all components at once
endform.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way you can achieve structures' multiplicity in one table using desired fields as key fields (which will be a common key to those two structures) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2009 23:10:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-table-having-mulitple-structures/m-p/5234243#M1209756</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-02-28T23:10:26Z</dc:date>
    </item>
  </channel>
</rss>

