<?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: combining data from multiple tables using loops in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263023#M490761</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;*Move all the required fields from ITAB1 TO FINAL_TAB, may be using MOVE-CORRESPONDING if field names are matching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB2 WITH KEY FIELD1 = ITAB1-FIELD1.&lt;/P&gt;&lt;P&gt;Move all the required fields from ITAB2 TO FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB3 WITH KEY FIELD1 = ITAB1-FIELD1.&lt;/P&gt;&lt;P&gt;Move all the required fields from ITAB2 TO FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or else, you can write a join query to fetch data from tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2007 15:03:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-25T15:03:58Z</dc:date>
    <item>
      <title>combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263020#M490758</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 have 4 tables, each of them having a field for link with another table. Table1 is linked with table2, table2 with table3 and table3 with table4. There are different number of rows in all tables.&lt;/P&gt;&lt;P&gt;I need to combine all the fields from these tables in one final table. For the cases in which i have more child rows corresponding to one parent row, in the final table there will be two rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Ioan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 14:59:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263020#M490758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T14:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263021#M490759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the tables are internal tables, so the data is already extrated from system tables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ioan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:02:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263021#M490759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263022#M490760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use Joins to combine the tables with key fields and to fetch the data from them&lt;/P&gt;&lt;P&gt;see the sample code  using joins&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;        a~vbeln                   " Billing Doc Number&lt;/P&gt;&lt;P&gt;        a~fktyp                   " Billing Category&lt;/P&gt;&lt;P&gt;        a~vbtyp                   " Sales Doc category&lt;/P&gt;&lt;P&gt;        a~fkdat                   " Billing doc date&lt;/P&gt;&lt;P&gt;        a~fkart                   " Billing doc type&lt;/P&gt;&lt;P&gt;        a~bukrs                   " Company code&lt;/P&gt;&lt;P&gt;        a~kurrf                   " Exchange rate&lt;/P&gt;&lt;P&gt;        a~knumv                   " Condition record Number&lt;/P&gt;&lt;P&gt;        a~waerk                   " Currency&lt;/P&gt;&lt;P&gt;        a~kunag                   " Sold to Party&lt;/P&gt;&lt;P&gt;        b~vrkme                   " Sales Unit&lt;/P&gt;&lt;P&gt;        b~posnr                   " Item Number&lt;/P&gt;&lt;P&gt;        b~charg                   " Batch Number&lt;/P&gt;&lt;P&gt;        b~fkimg                   " Billed quantity&lt;/P&gt;&lt;P&gt;        b~werks                   " Plant&lt;/P&gt;&lt;P&gt;        b~matnr                   " Material Number&lt;/P&gt;&lt;P&gt;        b~netwr                   " Net Value of Bill Doc&lt;/P&gt;&lt;P&gt;        b~wavwr                   " Cost in Doc Currency&lt;/P&gt;&lt;P&gt;        c~kdmat                   " Customer Material&lt;/P&gt;&lt;P&gt;                 into table itab_bill&lt;/P&gt;&lt;P&gt;                 from vbrk as a join vbrp as b&lt;/P&gt;&lt;P&gt;                        on b&lt;SUB&gt;vbeln = a&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;                        join vbap as c&lt;/P&gt;&lt;P&gt;                        on b&lt;SUB&gt;aubel = c&lt;/SUB&gt;vbeln and&lt;/P&gt;&lt;P&gt;                           b&lt;SUB&gt;aupos = c&lt;/SUB&gt;posnr&lt;/P&gt;&lt;P&gt;                  where a~vbeln in s_vbeln and&lt;/P&gt;&lt;P&gt;                        a~fkdat in s_fkdat and&lt;/P&gt;&lt;P&gt;                        a~bukrs in s_bukrs and&lt;/P&gt;&lt;P&gt;                        a~vtweg in s_vtweg and&lt;/P&gt;&lt;P&gt;                        a~vkorg in s_vkorg and&lt;/P&gt;&lt;P&gt;                        a~spart in s_spart and&lt;/P&gt;&lt;P&gt;                        a~fkart in s_fkart and&lt;/P&gt;&lt;P&gt;                        b~werks in s_werks and&lt;/P&gt;&lt;P&gt;                        a~kunag in s_kunag and&lt;/P&gt;&lt;P&gt;                        a~sfakn eq ' ' and&lt;/P&gt;&lt;P&gt;                        a~fksto eq ' ' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all are internal tables&lt;/P&gt;&lt;P&gt;then loop the first and read all the others in that with keys and append all the tables data into a final internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at ITAB1.&lt;/P&gt;&lt;P&gt;move-corresponding fields to ITAB1 to itab.&lt;/P&gt;&lt;P&gt;  read table itab2 with key f1 = itab1-f2.&lt;/P&gt;&lt;P&gt;   if sy-ubrc = o&lt;/P&gt;&lt;P&gt;    move the field to final ITAB.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;read table itab3 with key f1 = itab1-f2.&lt;/P&gt;&lt;P&gt;   if sy-ubrc = o&lt;/P&gt;&lt;P&gt;    move the field to final ITAB.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;read table itab4 with key f1 = itab1-f2.&lt;/P&gt;&lt;P&gt;   if sy-ubrc = o&lt;/P&gt;&lt;P&gt;    move the field to final ITAB.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;read table itab5 with key f1 = itab1-f2.&lt;/P&gt;&lt;P&gt;   if sy-ubrc = o&lt;/P&gt;&lt;P&gt;    move the field to final ITAB.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append ITAB&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anji Reddy Vangala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:03:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263022#M490760</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263023#M490761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;*Move all the required fields from ITAB1 TO FINAL_TAB, may be using MOVE-CORRESPONDING if field names are matching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB2 WITH KEY FIELD1 = ITAB1-FIELD1.&lt;/P&gt;&lt;P&gt;Move all the required fields from ITAB2 TO FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB3 WITH KEY FIELD1 = ITAB1-FIELD1.&lt;/P&gt;&lt;P&gt;Move all the required fields from ITAB2 TO FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or else, you can write a join query to fetch data from tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:03:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263023#M490761</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263024#M490762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi loan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. this can be one way of working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) make one final internal table which will contain the requierd fields&lt;/P&gt;&lt;P&gt;    from all the table. Make two tables of such kind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    eg. FinalTab1&lt;/P&gt;&lt;P&gt;          &amp;lt;b&amp;gt;FinalTab2.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b. then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;*------ Table1 Logic&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt; Loop at table1.&lt;/P&gt;&lt;P&gt;    move-corresponding table1 to finaltable1.&lt;/P&gt;&lt;P&gt;    appen final table1.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;*------ Table2 Logic&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;    Loop at finaltable1.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;    finaltable2 = finaltable1.&lt;/P&gt;&lt;P&gt;    Read table2 with key (fields from finaltable1)&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;     Transfer fields of Table2 to finaltable2.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;        append finaltable2.    &lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;  finaltable1[]  = finaltable2[].&lt;/P&gt;&lt;P&gt;  REFRESH FINALTABLE2.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;*------ Table3 Logic&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;    Loop at finaltable1.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;    finaltable2 = finaltable1.&lt;/P&gt;&lt;P&gt;    Read table3 with key (fields from finaltable1)&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;     Transfer fields of Table3 to finaltable2.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;        append finaltable2.    &lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&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;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;  finaltable1[]  = finaltable2[].&lt;/P&gt;&lt;P&gt;  REFRESH FINALTABLE2.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;*------ Table4 Logic&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;    Loop at finaltable1.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;    finaltable2 = finaltable1.&lt;/P&gt;&lt;P&gt;    Read table4 with key (fields from finaltable1)&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;     Transfer fields of Table4 to finaltable2.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;        append finaltable2.    &lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FINALTABLE2  contains the final data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Note :&lt;/P&gt;&lt;P&gt;I forgot to mention ,&lt;/P&gt;&lt;P&gt;since more than 1 child record are there,&lt;/P&gt;&lt;P&gt;use LOOP AT TABLE2, 3 , 4 &lt;/P&gt;&lt;P&gt;  Instead of Just Read&amp;lt;/b&amp;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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:06:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263024#M490762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263025#M490763</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;As Darshill said, you have to you READ instructions. If you have a large number of datas, don't forget to you BINARY SEARCH instructions in order to arrange your performances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mathieu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:06:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263025#M490763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263026#M490764</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;U should create a complex table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF LY_TABLE1,
                FIELD1,
                ...........,
             END    OF LY_TABLE1.
TYPES: BEGIN OF LY_TABLE2,
                FIELD1,
                FIELD2,
                ...........,
             END    OF LY_TABLE2.
TYPES: BEGIN OF LY_TABLE3,
                FIELD2,
                FIELD3,
                ...........,
             END    OF LY_TABLE3.
TYPES: BEGIN OF LY_TABLE4,
                FIELD3,
                FIELD4,
                ...........,
             END    OF LY_TABLE4.

TYPES:  TY_ITAB1 TYPE TABLE OF LY_ITAB1,
              TY_ITAB2 TYPE TABLE OF LY_ITAB2,
              TY_ITAB3 TYPE TABLE OF LY_ITAB3,
              TY_ITAB4 TYPE TABLE OF LY_ITAB4.

TYPES: BEGIN OF ST_ITAB34,
               L3 TYPE LY_ITAB3,
               T4 TYPE TY_ITAB4,
             END   OF ST_ITAB34.

TYPES: TY_ITAB34 TYPE TABLE OF ST_ITAB34.

TYPES: BEGIN OF ST_ITAB234,
                L2   TYPE LY_ITAB2,
                T34  TYPE TY_ITAB34,
             END   OF ST_ITAB234.

TYPES: TY_ITAB234 TYPE TABLE OF ST_ITAB234.
 
TYPES: BEGIN OF ST_ITAB1234,
                L1   TYPE LY_ITAB1,
                T234  TYPE TY_ITAB234,
             END   OF ST_ITAB234.

TYPES: TY_ITAB1234 TYPE TABLE OF ST_ITAB1234.

LOOP AT ITAB1.
  REFRESH ITAB1234-T234.
  ITAB1234-L1 = ITAB1.
  LOOP AT ITAB2 WHERE FIELD1 = ITAB1-FIELD1.
    REFRESH ITAB234-T234.
    ITAB234-L2 = ITAB2.
    LOOP AT ITAB3 WHERE FIELD2 = ITAB2-FIELD2.
      REFRESH ITAB34-T4.
      ITAB34-L3 = ITAB3.
      LOOP AT ITAB4 WHERE FIELD3 = ITAB3-FIELD3.
        APPEND ITAB4 TO ITAB34-T4.
      ENDLOOP.
      APPEND ITAB34 TO ITAB234-T34.
    ENDLOOP.
    APPEND ITAB234 TO ITAB1234-T234.
  ENDLOOP.
  APPEND ITAB1234.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:10:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263026#M490764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263027#M490765</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;What if in ITAB2 i have 3 rows with the same key value? In the final table there must be three rows. In these three rows, the fields corresponding to the first table must have same values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ioan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:10:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263027#M490765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263028#M490766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop at the table which has more records with the keyt field and then based on that read the rest of the tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:17:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263028#M490766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263029#M490767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After the first READ using a BINARY SEARCH, you can READ using the index. check this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:23:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263029#M490767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263030#M490768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can write a loop within loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;CLEAR FINAL_TAB.&lt;/P&gt;&lt;P&gt;*Move all the required fields from ITAB1 TO FINAL_TAB, may be using MOVE-CORRESPONDING if field names are matching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB2 WITH KEY FIELD1 = ITAB1-FIELD1.&lt;/P&gt;&lt;P&gt;Move all the required fields from ITAB2 TO FINAL_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;LOOP AT ITAB3 WHERE FIELD1 = ITAB1-FIELD1.&lt;/P&gt;&lt;P&gt;Move all the required fields from ITAB3 TO FINAL_TAB.&lt;/P&gt;&lt;P&gt;Do not clear the fields which are copied from ITAB1 &amp;amp; ITAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND FINAL_TAB.&lt;/P&gt;&lt;P&gt;ENDLOOP.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:33:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263030#M490768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: combining data from multiple tables using loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263031#M490769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears that your code is working but when i don't have any child rows in table3 for example, the parent rows from table2 ar not coppied.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can be done something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ioan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 16:47:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/combining-data-from-multiple-tables-using-loops/m-p/2263031#M490769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T16:47:44Z</dc:date>
    </item>
  </channel>
</rss>

