<?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: Inner join help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245694#M1013432</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear sir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please guide me how can I write it in effecient way????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jul 2008 06:30:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-30T06:30:18Z</dc:date>
    <item>
      <title>Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245690#M1013428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am Debugging one report and I want to know the meaning of following Query, That what this querri is doing and what result will come, Please guide me as soon as possible.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT a&lt;SUB&gt;budat b&lt;/SUB&gt;matnr b&lt;SUB&gt;werks c&lt;/SUB&gt;mtart SUM( b~menge ) AS xmenge&lt;/P&gt;&lt;P&gt;  INTO (budat, matnr, werks, mtart, menge)&lt;/P&gt;&lt;P&gt;  FROM ( ( mkpf AS a INNER JOIN mseg AS b ON a&lt;SUB&gt;mblnr = b&lt;/SUB&gt;mblnr )&lt;/P&gt;&lt;P&gt;                     INNER JOIN mara AS c ON b&lt;SUB&gt;matnr = c&lt;/SUB&gt;matnr )&lt;/P&gt;&lt;P&gt;  WHERE a~budat IN p_budat&lt;/P&gt;&lt;P&gt;  AND b~bwart =  '101'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AND ( b&lt;SUB&gt;lgort = 'FGSL' )"OR b&lt;/SUB&gt;lgort = 'JWSL' OR b~lgort = 'SCRL' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    AND a~mjahr = mjahr&lt;/P&gt;&lt;P&gt;    GROUP BY a&lt;SUB&gt;budat b&lt;/SUB&gt;matnr b&lt;SUB&gt;werks c&lt;/SUB&gt;mtart&lt;/P&gt;&lt;P&gt;    ORDER BY a&lt;SUB&gt;budat b&lt;/SUB&gt;matnr b&lt;SUB&gt;werks c&lt;/SUB&gt;mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    itab-budat = budat.&lt;/P&gt;&lt;P&gt;    itab-matnr = matnr.&lt;/P&gt;&lt;P&gt;    itab-werks = werks.&lt;/P&gt;&lt;P&gt;    itab-mtart = mtart.&lt;/P&gt;&lt;P&gt;    itab-menge = menge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND itab.&lt;/P&gt;&lt;P&gt;    CLEAR: itab, budat, matnr, werks, mtart, menge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 05:54:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245690#M1013428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T05:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245691#M1013429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shelly,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This query is an Inner join among 3 table MARA,MKPF and MSEG on field MKPF -budat MSEG-matnr MSEG-werks MARA-mtart.&lt;/P&gt;&lt;P&gt;And sums up on field MESG-menge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that Where  condition,GROUP BY and ORDER BY are self explanetory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finaly the required fields are taken into internal table itab, which is an INTERNAL TABLE with header line so have same name for work area and internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finaly the buffer is cleared with CLEAR keyword.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are Anlysing it, let me tell you &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Using iNNER JOIN among 3 tables leads to major performance ISSUE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Using of Internal table with header line is OBSOLATE in SAP&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:02:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245691#M1013429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245692#M1013430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friend,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This select query actually storing total goods receipts (101) quantity (menge) against all material (matnr) within specified date (budat) and storage location (lgort) shoule be FGSL/JWSL/SCRL, material document year (MJHAR) should be provdie value mjhar, in internal table &lt;STRONG&gt;itab&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: this select query consume a lot of memory area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Krishnendu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:07:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245692#M1013430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245693#M1013431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can You please guide me how can I write it in efficient way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warm Regards&lt;/P&gt;&lt;P&gt;Shelly Malik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:29:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245693#M1013431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245694#M1013432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear sir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please guide me how can I write it in effecient way????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:30:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245694#M1013432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245695#M1013433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can You please guide me how can I write it in efficient way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warm Regards&lt;/P&gt;&lt;P&gt;Shelly Malik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:31:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245695#M1013433</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245696#M1013434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi shelly,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&lt;STRONG&gt;Instead of use Inner join use FOR ALL ENTRIES&lt;/STRONG&gt;. For detail concept check&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;2. Use Internal table without header line for your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:35:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245696#M1013434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245697#M1013435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friend,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ohh! i will guide you to write in efficeien way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SELECT data from MKPF, MSEG and MARA using inner join into an internal table. Where condition will be like as it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can not use SUM(MENGE) use only MENGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use group by, order by with those clause on that internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Loop that internal table and use &lt;STRONG&gt;AT END OF BUDAT. SUM. END AT&lt;/STRONG&gt; it will sum as required. Within that AT END AT pass values to an work are like itab. APPEND itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the work are before appending, if you are not getting all value, pass to and local work area before AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;\[removed by moderator\]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Krishnendu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Jan Stallkamp on Jul 30, 2008 4:24 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 06:53:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245697#M1013435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T06:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245698#M1013436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shelly,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check this link&lt;/P&gt;&lt;P&gt;[JOINS vs. FOR ALL ENTRIES - Which Performs Better?|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6050] &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 07:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-help/m-p/4245698#M1013436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T07:00:36Z</dc:date>
    </item>
  </channel>
</rss>

