<?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: Table Join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442517#M1053910</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what ive done is created 2 internal tables:&lt;/P&gt;&lt;P&gt;1. itab1 for KNKK&lt;/P&gt;&lt;P&gt;2. itab2 for S067&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then copy all necessary fields from these 2 tables to the internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then made a loop..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;  read table itab2 index sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if itab1-KKBER = itab2-KKBER and itab1-KUNNR = itab2-KNKLI.&lt;/P&gt;&lt;P&gt;   GT_DATA-KKBER = itab1-KKBER.&lt;/P&gt;&lt;P&gt;   GT_DATA-KUNNR = itab1-KUNNR.&lt;/P&gt;&lt;P&gt;   GT_DATA-KLIMK = itab1-KLIMK.&lt;/P&gt;&lt;P&gt;   GT_DATA-SKFOR = itab1-SKFOR + itab1-SSOBL + itab2-OLIKW + itab2-OFAKW.&lt;/P&gt;&lt;P&gt;   append GT_DATA.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i expected that there should be 3 match found..as ive checked it manually.&lt;/P&gt;&lt;P&gt;(meaning the if statment will be TRUE 3 times)&lt;/P&gt;&lt;P&gt;but unfortunately it only display the last found matched entry.&lt;/P&gt;&lt;P&gt;my desired output would be 3 matches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Sep 2008 08:16:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-09T08:16:02Z</dc:date>
    <item>
      <title>Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442504#M1053897</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;I am just a novice ABAP programmer and cant get an idea how to join 2 tables. the scenario is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have 2 tables with 3 fields:&lt;/P&gt;&lt;P&gt;1. Tab1 - f1a, f1b, f1c&lt;/P&gt;&lt;P&gt;2. Tab2 - f2a, f2b, f3b&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 internal table with 3 fields:&lt;/P&gt;&lt;P&gt;1.  itab - f1, f2, f3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the condition is:&lt;/P&gt;&lt;P&gt;if Tab1-f1a = Tab2-f2a and Tab1-f1b = Tab2-f2b&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;itab-f1 = Tab1-f1a&lt;/P&gt;&lt;P&gt;itab-f2 = Tab1-f1b&lt;/P&gt;&lt;P&gt;itab-f3 = Tab1-f1c + Tab2-f2c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;appreciate your help. Thanks&lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 03:31:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442504#M1053897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T03:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442505#M1053898</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;Loop at tab1 into wa_tab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table tab2 into wa_tab2 &lt;/P&gt;&lt;P&gt;                       with key f2a = wa_tab1-f1a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-f1 = wa_tab1-f1a&lt;/P&gt;&lt;P&gt;itab-f2 = wa_tab1-f1b&lt;/P&gt;&lt;P&gt;itab-f3 = wa_tab1-f1c + wa_tab2-f2c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&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;&lt;/P&gt;&lt;P&gt;Sharin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 03:58:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442505#M1053898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T03:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442506#M1053899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul wrote :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;i have 2 tables with 3 fields:
1. Tab1 - f1a, f1b, f1c
2. Tab2 - f2a, f2b, f3b

1 internal table with 3 fields:
1. itab - f1, f2, f3

the condition is:
if Tab1-f1a = Tab2-f2a and Tab1-f1b = Tab2-f2b
then
itab-f1 = Tab1-f1a
itab-f2 = Tab1-f1b
itab-f3 = Tab1-f1c + Tab2-f2c&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make your select query something like this below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select * 
    into corresponding fields of itab
   from tab1
    join tab2 on tab1-f1a = tab2f2a
     and tab1-f1b = tab2-f1b.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 05:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442506#M1053899</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T05:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442507#M1053900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Sharin, thanks for the response.. tab1 and tab2 are DDIC tables cant use loop command, right? i used select statements but it almost made me fooled. stil cant get my desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hi Swapna, ive pattern my script to your supplied code but doesnt generated output. seemed the data didnt pulled from tables to internal table. Any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 05:23:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442507#M1053900</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T05:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442508#M1053901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;First ,you need to take 2 internal table compatible to Tab1 and Tab2 say, itab1 and itab2 respectively


then select (field list)
          from TAB1
          into  itab1.

and select (field list)
          from TAB2
          into  itab2.


then,   loop at itab1.
            read table itab2 index sy-tabix.

             if itab1-f1a = itab2-f2a and itab1-f1b = itab2-f2b

             itab-f1 = Tab1-f1a
             itab-f2 = Tab1-f1b
             itab-f3 = Tab1-f1c + Tab2-f2c
              
 endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 05:29:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442508#M1053901</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T05:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442509#M1053902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt; But the problem on thess scripts is that it only display the last matches found on condition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab1-f1a = itab2-f2a and itab1-f1b = itab2-f2b&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;need to display all matches found and add f1c and f2c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 07:17:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442509#M1053902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T07:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442510#M1053903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi, I think that the two tables are ddic table ,so you can't use loop command on those table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So create three types .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;one for TAb1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;one for tab2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;one for itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                          &lt;STRONG&gt;try this  and see if this is useful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;types : begin of t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if1a type Tab1-f1a,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if1b type Tab1-f1b,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if1c type Tab1-f1c,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;end of t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;begin of t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;if2a type Tab2-f2a,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;if2b type Tab2-f2b,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if2c type Tab2-f2c,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;end of t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;begin of t_tab3,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f1 type Tab1-f1a,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f2 type Tab1-f1b,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f3 type tab1-f1c,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;end of t_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data : i_tab1 type standard table of t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;i_tab2 type standard table of t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;i_tab3 type standard table of t_tab3,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;wa_tab1 type t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;wa_tab2 type t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;wa_tab3 type t_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;start-of-selection.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;select f1a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f1b&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;f1c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;from tab1 into table i_tab1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select f2a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;f2b&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;f2c from Tab2 into table i_tab2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not i-tab1 is initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;loop at i_tab1 into wa_tab1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;select  if2a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if2b&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if2c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;from i_tab2 into wa_tab3 where wa_tab1-f1a = wa_tab3-f1a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;and  wa_tab1-f1b = wa_tab3-f1b.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;if not wa_tab3  is initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;wa_tab3-f1 =  wa_tab1-f1a.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;wa_tab3-f2 = wa_tab1-f1b.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;wa_ tab3-f3 = wa_tab1-f3a + wa_tab3-f3.  " I added the value in wa_tab3-f3 because it actuall contain the valut in f2b field in Tab2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;append wa_tab3 to i_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;clear wa_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&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;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;please let me know if it works or not.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 08:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442510#M1053903</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T08:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442511#M1053904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi, I think that the two tables are ddic table ,so you can't use loop command on those table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So create three types .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;one for TAb1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;one for tab2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;one for itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                          &lt;STRONG&gt;try this  and see if this is useful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;types : begin of t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if1a type Tab1-f1a,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if1b type Tab1-f1b,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if1c type Tab1-f1c,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;end of t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;begin of t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;if2a type Tab2-f2a,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;if2b type Tab2-f2b,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if2c type Tab2-f2c,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;end of t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;begin of t_tab3,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f1 type Tab1-f1a,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f2 type Tab1-f1b,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f3 type tab1-f1c,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;end of t_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data : i_tab1 type standard table of t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;i_tab2 type standard table of t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;i_tab3 type standard table of t_tab3,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;wa_tab1 type t_tab1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;wa_tab2 type t_tab2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;wa_tab3 type t_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;start-of-selection.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;select f1a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;f1b&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;f1c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;from tab1 into table i_tab1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select f2a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;f2b&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;f2c from Tab2 into table i_tab2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not i-tab1 is initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;loop at i_tab1 into wa_tab1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;select  if2a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if2b&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;             &lt;STRONG&gt;if2c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;from i_tab2 into wa_tab3 where wa_tab1-f1a = wa_tab3-f1a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;and  wa_tab1-f1b = wa_tab3-f1b.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;if not wa_tab3  is initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;wa_tab3-f1 =  wa_tab1-f1a.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;wa_tab3-f2 = wa_tab1-f1b.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;wa_ tab3-f3 = wa_tab1-f3a + wa_tab3-f3.  " I added the value in wa_tab3-f3 because it actuall contain the valut in f2b field in Tab2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;append wa_tab3 to i_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;clear wa_tab3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&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;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;please let me know if it works or not.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 08:01:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442511#M1053904</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T08:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442512#M1053905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Jayati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;got errors on the scripts you suggested. Mabye better if i will give you the actual tables and fields i am using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 tables with their respective fields:&lt;/P&gt;&lt;P&gt;1. KNKK - KKBER, KUNNR, SKFOR&lt;/P&gt;&lt;P&gt;2. S067 - KKBER, KNKLI, OLIKW&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i made an internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of GT_DATA occurs 0,&lt;/P&gt;&lt;P&gt;   KKBER type KNKK-KKBER, &lt;/P&gt;&lt;P&gt;   KUNNR type KNKK-KUNNR,&lt;/P&gt;&lt;P&gt;   KLIMK type KNKK-KLIMK,&lt;/P&gt;&lt;P&gt;   SKFOR type KNKK-SKFOR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the requirements is:&lt;/P&gt;&lt;P&gt;if KNKK-KKBER = S067-KKBER AND KNKK-KUNNR = S067-KNKLI&lt;/P&gt;&lt;P&gt;then,&lt;/P&gt;&lt;P&gt;GT_DATA-SKFOR = KNKK-SKFOR + S067-OLIKW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all data should be displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Paul Warren Pili on Sep 9, 2008 3:23 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 01:22:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442512#M1053905</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T01:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442513#M1053906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Paul.&lt;/P&gt;&lt;P&gt;I think there is no matched record.&lt;/P&gt;&lt;P&gt;And you should try to find the matched records manually first.&lt;/P&gt;&lt;P&gt;If you find at least one, there are problems still on your script,&lt;/P&gt;&lt;P&gt;but if there isn't one at all, there is no problem on the several scripts above also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 01:58:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442513#M1053906</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T01:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442514#M1053907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kieat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yeah. there is. the problem on looping in internal table is that it only displayed the last found match entry. and i need to find all matched entries. &lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 02:29:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442514#M1053907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T02:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442515#M1053908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be the entry displayed is in the header line of GT_DATA.&lt;/P&gt;&lt;P&gt;Did you debug your scripts?&lt;/P&gt;&lt;P&gt;Are there records in the internal table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 06:20:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442515#M1053908</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T06:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442516#M1053909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select data from the two database tables (tab1 and tab2) into internal tables (itab1 and itab2)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT F1A F1B F1C FROM TAB1 INTO ITAB1.&lt;/P&gt;&lt;P&gt;SELECT F2A F2B F2C FROM TAB2 INTO ITAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1 INTO WA_TAB1.&lt;/P&gt;&lt;P&gt;    READ ITAB2 INTO WA_TAB2 WITH KEY F2A = WA_TAB1-F1A AND F2B = WA_TAB1-F1B.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;         WA_TAB2-F2C = WA_TAB2-F2C + WA_TAB1-F1C.&lt;/P&gt;&lt;P&gt;         MOVE: WA_TAB1-F1A TO WA_TAB-F3A,&lt;/P&gt;&lt;P&gt;                     WA_TAB1-F1B TO WA_TAB-F3B,&lt;/P&gt;&lt;P&gt;                     WA_TAB2-F2C TO WA_TAB-F3C.&lt;/P&gt;&lt;P&gt;             APPEND WA_TAB INTO ITAB.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 07:36:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442516#M1053909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T07:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442517#M1053910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what ive done is created 2 internal tables:&lt;/P&gt;&lt;P&gt;1. itab1 for KNKK&lt;/P&gt;&lt;P&gt;2. itab2 for S067&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then copy all necessary fields from these 2 tables to the internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then made a loop..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;  read table itab2 index sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if itab1-KKBER = itab2-KKBER and itab1-KUNNR = itab2-KNKLI.&lt;/P&gt;&lt;P&gt;   GT_DATA-KKBER = itab1-KKBER.&lt;/P&gt;&lt;P&gt;   GT_DATA-KUNNR = itab1-KUNNR.&lt;/P&gt;&lt;P&gt;   GT_DATA-KLIMK = itab1-KLIMK.&lt;/P&gt;&lt;P&gt;   GT_DATA-SKFOR = itab1-SKFOR + itab1-SSOBL + itab2-OLIKW + itab2-OFAKW.&lt;/P&gt;&lt;P&gt;   append GT_DATA.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i expected that there should be 3 match found..as ive checked it manually.&lt;/P&gt;&lt;P&gt;(meaning the if statment will be TRUE 3 times)&lt;/P&gt;&lt;P&gt;but unfortunately it only display the last found matched entry.&lt;/P&gt;&lt;P&gt;my desired output would be 3 matches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 08:16:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442517#M1053910</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T08:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442518#M1053911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Try this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;clear gt_data.&lt;/P&gt;&lt;P&gt;read table itab2 with key KKBER = itab1-KKBER &lt;/P&gt;&lt;P&gt;                                  KNKLI = itab1-KUNNR.&lt;/P&gt;&lt;P&gt;if  sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  GT_DATA-KKBER = itab1-KKBER.&lt;/P&gt;&lt;P&gt;  GT_DATA-KUNNR = itab1-KUNNR.&lt;/P&gt;&lt;P&gt;  GT_DATA-KLIMK = itab1-KLIMK.&lt;/P&gt;&lt;P&gt;  GT_DATA-SKFOR = itab1-SKFOR + itab1-SSOBL + itab2-OLIKW + itab2-OFAKW.&lt;/P&gt;&lt;P&gt;  append GT_DATA.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 08:51:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442518#M1053911</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T08:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442519#M1053912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello kieat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No Data has been displayed when i pattern to your suggested script. &lt;/P&gt;&lt;P&gt;Anyone can do this using "inner join statement"? looping on internal tables might not working on this case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 00:20:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442519#M1053912</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-10T00:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442520#M1053913</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;i was able to display all matched entries between 2 tables.&lt;/P&gt;&lt;P&gt;My problem now is i also need to display in my internal tables\ those entries in TAB1 that doesnt match in TAB2. &lt;/P&gt;&lt;P&gt;appreciate your help thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 03:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442520#M1053913</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-10T03:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442521#M1053914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks everyone for the ideas. Problem solved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Sep 2008 03:59:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-join/m-p/4442521#M1053914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-12T03:59:15Z</dc:date>
    </item>
  </channel>
</rss>

