<?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: problem in joins in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432929#M543960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Table MAKT is not necessary, the material text is stored in both VBAP (ARKTX) and EKPO(TXZ01). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with the others that it is a VERY bad idea to join a Sales Order to a Purchase Order via the material number. Could you please provide more infomation about the business requirement? There is special case in SD of a 'Third Party Order'  where there is a direct link between PO &amp;amp; SO, but otherwise not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jul 2007 17:36:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-05T17:36:27Z</dc:date>
    <item>
      <title>problem in joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432926#M543957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i had a program which i couldnt get the results.so i  divided this program and made the first two tables seperately and the rest of ther tables seperately as different programs. then iam able to get the results, but when i gave everything in one program im not getting .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my seperate codes : &lt;/P&gt;&lt;P&gt;first two tables are joined as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT T&lt;SUB&gt;MNGRP S&lt;/SUB&gt;BAUTL INTO CORRESPONDING FIELDS OF TABLE ITAB1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        FROM QMSM AS T LEFT OUTER JOIN QMFE AS S ON S&lt;SUB&gt;QMNUM = T&lt;/SUB&gt;QMNUM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                WHERE ( T~MNCOD EQ '3050'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  AND T~MNCOD NE '3100' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  AND T~MNGRP IN CODGROUP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL SCREEN 0001.&lt;/P&gt;&lt;P&gt;rest of the tables joined as follows :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;MAKTX B&lt;/SUB&gt;VBELN B&lt;SUB&gt;POSNR C&lt;/SUB&gt;EBELN C&lt;SUB&gt;EBELP C&lt;/SUB&gt;MENGE C&lt;SUB&gt;WEMNG C&lt;/SUB&gt;EINDT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             INTO CORRESPONDING FIELDS OF TABLE STAB FROM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ( MAKT AS A INNER JOIN VBAP AS B ON A&lt;SUB&gt;MATNR = B&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             INNER JOIN EKPO AS D ON A&lt;SUB&gt;MATNR = D&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             INNER JOIN EKET AS C ON D&lt;SUB&gt;EBELN = C&lt;/SUB&gt;EBELN )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             WHERE B~WERKS IN PLANT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             AND B~MATNR IN MATERIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             AND A~SPRAS = 'D'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL SCREEN 0001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the above two codes were given in two different programs. then i got the result &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when i gave together as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       A~OTGRP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       A~BAUTL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       B~MAKTX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       C~VBELN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       C~POSNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       E~EBELN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       E~EBELP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       E~MENGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       E~WEMNG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       E~EINDT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      INTO CORRESPONDING FIELDS OF TABLE STAB FROM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ( QMSM AS F INNER JOIN QMFE AS A ON A&lt;SUB&gt;QMNUM = F&lt;/SUB&gt;QMNUM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          LEFT OUTER JOIN MAKT AS B ON A&lt;SUB&gt;MATNR = B&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          INNER JOIN VBAP AS C ON B&lt;SUB&gt;MATNR = C&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          INNER JOIN EKPO AS D ON B&lt;SUB&gt;MATNR = D&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          INNER JOIN EKET AS E ON D&lt;SUB&gt;EBELN = E&lt;/SUB&gt;EBELN )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          WHERE C~WERKS IN PLANT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          AND C~MATNR IN MATERIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                        AND B~SPRAS = 'D'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          AND A~OTGRP IN CODGRUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          AND F~MNCOD = '3050'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL SCREEN 0001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so could anybody help me in this aspect????????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2007 11:32:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432926#M543957</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-05T11:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: problem in joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432927#M543958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem could data may not be there for the conditions you entered in the query.&lt;/P&gt;&lt;P&gt;Please check with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  A~OTGRP&lt;/P&gt;&lt;P&gt;	A~BAUTL&lt;/P&gt;&lt;P&gt;	B~MAKTX&lt;/P&gt;&lt;P&gt;	C~VBELN&lt;/P&gt;&lt;P&gt;	C~POSNR&lt;/P&gt;&lt;P&gt;	E~EBELN&lt;/P&gt;&lt;P&gt;	E~EBELP&lt;/P&gt;&lt;P&gt;	E~MENGE&lt;/P&gt;&lt;P&gt;	E~WEMNG&lt;/P&gt;&lt;P&gt;	E~EINDT&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE STAB FROM&lt;/P&gt;&lt;P&gt;( QMSM AS F INNER JOIN QMFE AS A &lt;/P&gt;&lt;P&gt;    ON A&lt;SUB&gt;QMNUM = F&lt;/SUB&gt;QMNUM&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN MAKT AS B &lt;/P&gt;&lt;P&gt;    ON A&lt;SUB&gt;MATNR = B&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;INNER JOIN VBAP AS C &lt;/P&gt;&lt;P&gt;    ON B&lt;SUB&gt;MATNR = C&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;INNER JOIN EKPO AS D &lt;/P&gt;&lt;P&gt;    ON A&lt;SUB&gt;MATNR = D&lt;/SUB&gt;MATNR  "&amp;lt;----&lt;/P&gt;&lt;HR originaltext="------" /&gt;&lt;P&gt;Replace B&lt;SUB&gt;MATNR with A&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;INNER JOIN EKET AS E &lt;/P&gt;&lt;P&gt;    ON D&lt;SUB&gt;EBELN = E&lt;/SUB&gt;EBELN )&lt;/P&gt;&lt;P&gt;WHERE  C~WERKS IN PLANT&lt;/P&gt;&lt;P&gt;   AND C~MATNR IN MATERIAL&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;AND B~SPRAS = 'D'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  AND A~OTGRP IN CODGRUP&lt;/P&gt;&lt;P&gt;  AND F~MNCOD = '3050'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a note: Avoid using too many joins this will affect performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;A.Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2007 14:11:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432927#M543958</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-05T14:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: problem in joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432928#M543959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;In the first you used LEFT OUTER Join between QMSM and QMFE&lt;/P&gt;&lt;P&gt;but here you are using INNER JOIN change this&lt;/P&gt;&lt;P&gt;and use INNER JOIN with MAKT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A~OTGRP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A~BAUTL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B~MAKTX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C~VBELN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C~POSNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E~EBELN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E~EBELP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E~MENGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E~WEMNG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E~EINDT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE STAB FROM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( QMSM AS F &amp;lt;b&amp;gt;LEFT OUTER&amp;lt;/b&amp;gt; JOIN QMFE AS A &lt;/P&gt;&lt;P&gt;ON A&lt;SUB&gt;QMNUM = F&lt;/SUB&gt;QMNUM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;INNER&amp;lt;/b&amp;gt; JOIN MAKT AS B ON A&lt;SUB&gt;MATNR = B&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INNER JOIN VBAP AS C ON B&lt;SUB&gt;MATNR = C&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INNER JOIN EKPO AS D ON B&lt;SUB&gt;MATNR = D&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INNER JOIN EKET AS E ON D&lt;SUB&gt;EBELN = E&lt;/SUB&gt;EBELN )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE C~WERKS IN PLANT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND C~MATNR IN MATERIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;AND B~SPRAS = 'D'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND A~OTGRP IN CODGRUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND F~MNCOD = '3050'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL SCREEN 0001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi but in real time we never join MAKT, VBAP and EKPO with just MATNR field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points for useful Answers&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2007 16:04:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432928#M543959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-05T16:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: problem in joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432929#M543960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Table MAKT is not necessary, the material text is stored in both VBAP (ARKTX) and EKPO(TXZ01). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with the others that it is a VERY bad idea to join a Sales Order to a Purchase Order via the material number. Could you please provide more infomation about the business requirement? There is special case in SD of a 'Third Party Order'  where there is a direct link between PO &amp;amp; SO, but otherwise not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2007 17:36:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432929#M543960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-05T17:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: problem in joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432930#M543961</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 to use either inner or outer joins for all tables as it contradicts the dependency of fields with each other. Try use ABAP query first to see if the joins work and then go for multiple joins this will be simple to check the dependency of fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this works.&lt;/P&gt;&lt;P&gt;Pls do reward points for my effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ameet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2007 04:28:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-joins/m-p/2432930#M543961</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-06T04:28:06Z</dc:date>
    </item>
  </channel>
</rss>

