<?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 Joins in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087280#M977238</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aarav,&lt;/P&gt;&lt;P&gt;U've to find a condition which links them, other wise, how were U planning to join all the tables in one shot?&lt;/P&gt;&lt;P&gt;Find a relation, loop at one itab, read the other with key and move the corresponding entries into the final table, say it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz assign points, if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Jul 2008 15:32:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-02T15:32:39Z</dc:date>
    <item>
      <title>Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087265#M977223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ahve joined 4 tables in my report , I just wante dto know is this the right way to do it and if it is  not what are the repurcurssions of this kind of joint and if anyone can please tell me what will be the best way to join these tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually earlier I had just 2 tables joined in this report but unfortunately we had to club 8 fileds from other two tables whaich made me join additional 2 billing tbales to the existing one. &lt;/P&gt;&lt;P&gt;     INTO CORRESPONDING FIELDS OF TABLE gt_sel&lt;/P&gt;&lt;P&gt;     FROM vbak AS a&lt;/P&gt;&lt;P&gt;         INNER JOIN vbap AS b ON a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;         INNER JOIN vbkd AS d ON a&lt;SUB&gt;vbeln = d&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;         INNER JOIN fplt AS e ON d&lt;SUB&gt;fplnr = e&lt;/SUB&gt;fplnr&lt;/P&gt;&lt;P&gt;         INNER JOIN fpla AS f ON e&lt;SUB&gt;fplnr = f&lt;/SUB&gt;fplnr&lt;/P&gt;&lt;P&gt;         LEFT OUTER JOIN tvlvt AS g ON b&lt;SUB&gt;vkaus = g&lt;/SUB&gt;abrvw&lt;/P&gt;&lt;P&gt;         LEFT OUTER JOIN zsdsched AS c ON b&lt;SUB&gt;vbeln = c&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;                                      AND b&lt;SUB&gt;posnr = c&lt;/SUB&gt;posnr&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 17:24:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087265#M977223</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T17:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087266#M977224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aarav,&lt;/P&gt;&lt;P&gt;before you join any tables, first analyse the relation between the tables.&lt;/P&gt;&lt;P&gt;And, as a rule of thumb, do not join more than 3-4 tables. &lt;/P&gt;&lt;P&gt;In your case, you've joined 6 tables!--not recommended.&lt;/P&gt;&lt;P&gt;I would suggest you to split the queries into 2:&lt;/P&gt;&lt;P&gt;1st query joining vbak, vbap, vbkd.&lt;/P&gt;&lt;P&gt;2nd : fplt, fpla, etc..&lt;/P&gt;&lt;P&gt;the 1st and 2nd can be connected by the use of FOR ALL ENTRIES option in SAP.&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 17:37:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087266#M977224</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T17:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087267#M977225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first thing is using JOINS is not at all performance issue.. It will have a heavy load on DATABASE..&lt;/P&gt;&lt;P&gt;Rather you for FOR ALL ENTERIES addition of SELECT..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will be very easy and give u a good performance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select * from &amp;lt;table1&amp;gt; into ITAB1.

select * 
from   &amp;lt;table2&amp;gt; 
into ITAB2
FOR ALL ENTERIES IN ITAB1
WHERE &amp;lt;FIELD1&amp;gt; EQ ITAB1-&amp;lt;FIELD1&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way you do..this will solve your problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narin Nandivada&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 17:38:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087267#M977225</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T17:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087268#M977226</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;Instead of using the JOINS we can go for FOR ALL ENTIRES option in 'Select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First try the values from VBAK based on input selection.&lt;/P&gt;&lt;P&gt;Then for all entires in this VBAK table try to get the vbkd details.&lt;/P&gt;&lt;P&gt;Develop the relations between these tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from &lt;/P&gt;&lt;P&gt;vbak into table&lt;/P&gt;&lt;P&gt;t_vbak&lt;/P&gt;&lt;P&gt;where vbeln in s_vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort vbak by vbeln.&lt;/P&gt;&lt;P&gt;if t_vbak[] is not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from vbkd&lt;/P&gt;&lt;P&gt;into table t_vbkd &lt;/P&gt;&lt;P&gt;for all entires in t_vbak&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;vbeln eq t_vbak-vbeln.&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;like this try to relate the other tables, you can get the reuiqred info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;Chandralekha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 17:43:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087268#M977226</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T17:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087269#M977227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So from each of teh six tables I will have to do the same thing and bring the values into an internal table individually , then realte the internal tables and get the value, right, like I have a very big output to show so I will have to do it separately and then use for all entreis to realte them together. Right. Right now I have used a diffrent approach if you look down in my part of code, do dose that mean I have to change it all and then do the way you suggested.?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF  p_rental = 'X' .

  SELECT a~vbeln a~erdat a~ernam a~audat a~vbtyp a~auart a~vkorg
   a~vtweg a~spart a~vkbur a~guebg a~gueen a~kunnr a~kvgr4
   b~posnr b~matnr b~charg b~matkl b~arktx b~pstyv b~zmeng
   b~zieme b~kdmat b~werks b~lgort b~vstel b~netpr b~kpein
   b~vkaus b~aufnr b~kmein b~shkzg b~oid_extbol b~oid_miscdl
   b~oidrc b~oid_ship AS kunwe b~zzwprofid c~datbi c~datab b~route
   e~fkdat e~nfdat e~fakwr e~fksaf e~afdat
   f~fpart f~bedat f~endat f~horiz g~bezei


     INTO CORRESPONDING FIELDS OF TABLE gt_sel
     FROM vbak AS a
         INNER JOIN vbap AS b ON a~vbeln = b~vbeln
         INNER JOIN vbkd AS d ON a~vbeln = d~vbeln
         INNER JOIN fplt AS e ON d~fplnr = e~fplnr
         INNER JOIN fpla AS f ON e~fplnr = f~fplnr
         LEFT OUTER JOIN tvlvt AS g ON b~vkaus = g~abrvw
         LEFT OUTER JOIN zsdsched AS c ON b~vbeln = c~vbeln
                                      AND b~posnr = c~posnr


     WHERE a~vbeln IN s_vbeln
       AND a~erdat IN s_erdat
       AND a~vbtyp = gc_g
       AND a~ernam IN s_ernam
       AND a~vkorg IN s_vkorg
       AND a~vtweg IN s_vtweg
       AND a~spart IN s_spart
       AND a~vkbur IN s_vkbur
       AND a~guebg IN s_guebg
       AND a~gueen IN s_gueen
       AND a~auart IN s_auart
       AND a~kunnr IN s_kunnr
       AND b~oid_ship IN s_kunwe
       AND b~werks IN s_werks
       AND b~lgort IN s_lgort
       AND b~vstel IN s_vstel
       AND b~route in s_route
       AND b~matnr IN s_matnr
       AND e~afdat IN s_afdat
       AND e~fksaf IN s_fksaf
       AND b~pstyv in s_pstyv.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 17:50:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087269#M977227</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T17:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087270#M977228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before you go and start putting tables into internal tables, be aware of the memory restrictions on your system.  First, I would hope that your basis person did put a restriction on the work processes.  Typically, we limit DIA processes to 1.5GB and BTC to 4GB.  Why?  Because if every code out there sticks everything in memory, we can have hundreds of instances of 1 single user bringing a SAP instance crashing down.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now to your code, basically I see 6 tables:&lt;/P&gt;&lt;P&gt;vbak&lt;/P&gt;&lt;P&gt;vbap&lt;/P&gt;&lt;P&gt;vbkd&lt;/P&gt;&lt;P&gt;fplt&lt;/P&gt;&lt;P&gt;fpla&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First thing, which is the smallest table?  Which is the one where least amount of constant data will be read?  Take that table(s) and follow the instructions above and read it all into an internal table.  Please be aware of scalability as well, if the table is small today it doesn't mean it will be small tomorrow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, what about the larger tables?  Try SELECT ENDSELECT into a temp internal table but with a PACKAGE SIZE parameter to avoid single-record selects (slow).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly, look at what you have done so far.  Check to see if everything is scalable and will last a long time (no maint required), and as an side-effect your program should run faster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 18:19:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087270#M977228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T18:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087271#M977229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, and also, joins between these two sets of tables shouldn't be that bad:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vbak and vbap and vbkd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fplt and fpla&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sometimes, it's also nice to let the DB do some work.  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 18:22:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087271#M977229</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T18:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087272#M977230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well so far even the joins that I have made is not giving me any problem at all , even with performance , its good, the only thing I am worried about is the loss of data which might be happeningby the join. May be some data might be lost when I join these 6 tavbles at a time instead of putting thenm in the internal table as you all had explained, I am just curious to know will it loose some data while we joion and try taking out the output?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 19:14:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087272#M977230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-27T19:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087273#M977231</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;First of all: Even if you get hundereds of answers that you should replace every JOIN by a FOR ALL ENTRIES, don't do that in all cases. It's one of the urban ledgends of SDN that FOR ALL ENTRIES is better in all cases. As far as I can tell in the majority of cases JOIN is faster. Please search for JOIN and FOR ALL ENTRIES, there has been a nice blog about that and some days ago Gareth started a thread here in the forum about that topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you split up your JOIN command into different statements and load everything into internal tables you might increase data transfer massively. That can be a real performance problem!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have analyzed your special case but if you are really interested in performance issues do some tests. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2008 21:43:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087273#M977231</guid>
      <dc:creator>JanStallkamp</dc:creator>
      <dc:date>2008-06-27T21:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087274#M977232</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;  Instead of JOIN use SELECT statements only.&lt;/P&gt;&lt;P&gt;  First select Header table records into an internal table T_VBAK and then SELECT item details using FOR ALL ENTRIES IN TABLE T_VBAK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt;Rajitha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jun 2008 03:58:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087274#M977232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-28T03:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087275#M977233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aarav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     In your select query u have joined five tables. VBAK VBAP VBKD FPLT FPLA. But when we see the relation between these tables VBAK VBAP &amp;amp;  VBKD has some relation. FPLT &amp;amp; FPLA has some relation. Whereas VBAK VBAP VBKD  got no relation with FPLT FPLA. So, you write two joins one with tables VBAK,VBAP VBKD and the other with FPLT FPLA. I think this solves the issue.&lt;/P&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>Sat, 28 Jun 2008 04:13:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087275#M977233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-28T04:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087276#M977234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the performance depends on the table size and the no of fields used in the jion ...for less than 3 tables ...the join or for all entrie is same..when the fields r increasing the join had poor performance....means fields and performce is inversly proportional...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this example for the for all entries usage by many table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ztest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:pa0002,pa0008,pa0021,pa0041.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;      vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;      nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab1 occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0008-pernr,&lt;/P&gt;&lt;P&gt;      begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;      stvor like pa0008-stvor,&lt;/P&gt;&lt;P&gt;      ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;      end of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :begin of itab2 occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0021-pernr,&lt;/P&gt;&lt;P&gt;      favor like pa0021-favor,&lt;/P&gt;&lt;P&gt;      fanam like pa0021-fanam,&lt;/P&gt;&lt;P&gt;      end of itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of itab3 occurs 0,&lt;/P&gt;&lt;P&gt;     pernr like pa0041-pernr,&lt;/P&gt;&lt;P&gt;     dar01 like pa0041-dar01,&lt;/P&gt;&lt;P&gt;     dat01 like pa0041-dat01,&lt;/P&gt;&lt;P&gt;     end of itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of final occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;      vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;      nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;      begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;      stvor like pa0008-stvor,&lt;/P&gt;&lt;P&gt;      ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;       favor like pa0021-favor,&lt;/P&gt;&lt;P&gt;      fanam like pa0021-fanam,&lt;/P&gt;&lt;P&gt;     dar01 like pa0041-dar01,&lt;/P&gt;&lt;P&gt;     dat01 like pa0041-dat01,&lt;/P&gt;&lt;P&gt;     end of final.&lt;/P&gt;&lt;P&gt;select-options:s_pernr for pa0002-pernr.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       vorna&lt;/P&gt;&lt;P&gt;       nachn&lt;/P&gt;&lt;P&gt;       from pa0002&lt;/P&gt;&lt;P&gt;       into table itab&lt;/P&gt;&lt;P&gt;       where pernr in s_pernr.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       begda&lt;/P&gt;&lt;P&gt;       stvor&lt;/P&gt;&lt;P&gt;       ansal&lt;/P&gt;&lt;P&gt;       from pa0008&lt;/P&gt;&lt;P&gt;       into table itab1&lt;/P&gt;&lt;P&gt;       for all entries in itab&lt;/P&gt;&lt;P&gt;       where pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       favor&lt;/P&gt;&lt;P&gt;       fanam&lt;/P&gt;&lt;P&gt;       from pa0021&lt;/P&gt;&lt;P&gt;       into table itab2&lt;/P&gt;&lt;P&gt;       for all entries in itab1&lt;/P&gt;&lt;P&gt;       where pernr = itab1-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       dar01&lt;/P&gt;&lt;P&gt;       dat01&lt;/P&gt;&lt;P&gt;       from pa0041&lt;/P&gt;&lt;P&gt;       into table itab3&lt;/P&gt;&lt;P&gt;       for all entries in itab2&lt;/P&gt;&lt;P&gt;       where pernr = itab2-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;final-pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;final-vorna = itab-vorna.&lt;/P&gt;&lt;P&gt;final-nachn = itab-nachn.&lt;/P&gt;&lt;P&gt;read table itab1 with key pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;final-begda = itab1-begda.&lt;/P&gt;&lt;P&gt;final-stvor = itab1-stvor.&lt;/P&gt;&lt;P&gt;final-ansal = itab1-ansal.&lt;/P&gt;&lt;P&gt;read table itab2 with key pernr = itab1-pernr.&lt;/P&gt;&lt;P&gt;final-favor = itab2-favor.&lt;/P&gt;&lt;P&gt;final-fanam = itab2-fanam.&lt;/P&gt;&lt;P&gt;read table itab3 with key pernr = itab2-pernr.&lt;/P&gt;&lt;P&gt;final-dar01 = itab3-dar01 .&lt;/P&gt;&lt;P&gt;final-dat01 = itab3-dat01.&lt;/P&gt;&lt;P&gt;append final.&lt;/P&gt;&lt;P&gt;clear final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   loop at final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   write:final-pernr ,&lt;/P&gt;&lt;P&gt;final-vorna ,&lt;/P&gt;&lt;P&gt;final-nachn ,&lt;/P&gt;&lt;P&gt;final-begda ,&lt;/P&gt;&lt;P&gt;final-stvor ,&lt;/P&gt;&lt;P&gt;final-ansal ,&lt;/P&gt;&lt;P&gt;final-favor ,&lt;/P&gt;&lt;P&gt;final-fanam ,&lt;/P&gt;&lt;P&gt;final-dar01 ,&lt;/P&gt;&lt;P&gt;final-dat01 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jun 2008 11:06:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087276#M977234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-28T11:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087277#M977235</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;just an additional commentary:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You never need the alias addition AS if you do not JOIN a table on itself. You gain much transparency, i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
...
FROM vbap JOIN vbak ON vbap~vbeln = vbaK~vbeln
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will help you and others to read and understand your program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The rule of thumb not to join too many tables means that the database is usually much slower than ABAP. On the other hand, the use of FOR ALL ENTRIES means that you may use a lot of memory. In any case you should make sure that you fetch only the fields you really need and that the joins do not create to many duplicate records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jun 2008 13:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087277#M977235</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2008-06-28T13:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087278#M977236</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;    Instead of so many join condition, go for ALL ENTRIES of itab&lt;/P&gt;&lt;P&gt;and take one more interbal table....&lt;/P&gt;&lt;P&gt;it will surely reduce the load on database..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with luck,&lt;/P&gt;&lt;P&gt;pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jun 2008 13:25:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087278#M977236</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-28T13:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087279#M977237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have joined these two sets of tables as suggested and stored into two different internal tables gt_sel and gt_sel1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone tell me how do I join these two sets of internal table into one so that I get the data into one final table which I can show as output as there is no condition wherin I can use to co-relate them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  SELECT a~vbeln a~erdat a~ernam a~audat a~vbtyp a~auart a~vkorg
   a~vtweg a~spart a~vkbur a~guebg a~gueen a~kunnr a~kvgr4
   b~posnr b~matnr b~charg b~matkl b~arktx b~pstyv b~zmeng
   b~zieme b~kdmat b~werks b~lgort b~vstel b~netpr b~kpein
   b~kmein b~shkzg b~oid_extbol b~oid_miscdl b~oidrc b~oid_ship AS kunwe
   b~zzwprofid c~datbi c~datab b~route
     INTO CORRESPONDING FIELDS OF TABLE gt_sel
     FROM vbak AS a
         INNER JOIN vbap AS b ON a~vbeln = b~vbeln
         inner join vbkd as d on b~vbeln = d~vbeln
         LEFT OUTER JOIN zsdsched AS c ON b~vbeln = c~vbeln AND
                               b~posnr = c~posnr
     WHERE a~vbeln IN s_vbeln
       AND a~erdat IN s_erdat
       AND a~vbtyp = gc_g
       AND a~ernam IN s_ernam
       AND a~vkorg IN s_vkorg
       AND a~vtweg IN s_vtweg
       AND a~spart IN s_spart
       AND a~vkbur IN s_vkbur
       AND a~guebg IN s_guebg
       AND a~gueen IN s_gueen
       AND a~auart IN s_auart
       AND a~kunnr IN s_kunnr
       AND b~oid_ship IN s_kunwe
       AND b~werks IN s_werks
       AND b~lgort IN s_lgort
       AND b~vstel IN s_vstel
       and b~route in s_route
       AND b~matnr IN s_matnr.
       
   SORT gt_sel.    
*-----
select e~fkdat e~nfdat e~fakwr e~fksaf e~afdat
   f~fpart f~bedat f~endat f~horiz g~bezei
   into corresponding fields of table gt_sel1
   from fplt as e
     inner join fpla as f on e~fplnr = f~fplnr
     
     where   e~fksaf in s_fksaf .
      sort gt_sel1. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 15:27:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087279#M977237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T15:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087280#M977238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aarav,&lt;/P&gt;&lt;P&gt;U've to find a condition which links them, other wise, how were U planning to join all the tables in one shot?&lt;/P&gt;&lt;P&gt;Find a relation, loop at one itab, read the other with key and move the corresponding entries into the final table, say it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz assign points, if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 15:32:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087280#M977238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T15:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087281#M977239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The realtion between the two sets of joins is just one vbkd-fplnr and fplt-fplnr. But I am not aware how to join these two internal tables with this relation .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 16:06:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087281#M977239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T16:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Table Joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087282#M977240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 20:10:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-joins/m-p/4087282#M977240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T20:10:07Z</dc:date>
    </item>
  </channel>
</rss>

