<?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: Join query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321664#M509779</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Murugan,&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;SELECT &amp;lt;i&amp;gt;DISTINCT&amp;lt;/i&amp;gt; A&lt;SUB&gt;AUFNR A&lt;/SUB&gt;KOKRS A&lt;SUB&gt;OBJNR A&lt;/SUB&gt;KDAUF&lt;/P&gt;&lt;P&gt;INTO TABLE T_AUFK&lt;/P&gt;&lt;P&gt;FROM AUFK AS A&lt;/P&gt;&lt;P&gt;INNER JOIN&lt;/P&gt;&lt;P&gt;AUAK AS B&lt;/P&gt;&lt;P&gt;ON A&lt;SUB&gt;OBJNR EQ B&lt;/SUB&gt;OBJNR&lt;/P&gt;&lt;P&gt;WHERE B~PERIO IN S_PERIO&lt;/P&gt;&lt;P&gt;AND B~BUGJAHR IN S_BUGJAH&lt;/P&gt;&lt;P&gt;AND A~WERKS IN S_WERKS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2007 12:27:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-06T12:27:21Z</dc:date>
    <item>
      <title>Join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321662#M509777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to join AUFK and AUAK based on OBJNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here below is  my query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;AUFNR A&lt;/SUB&gt;KOKRS A&lt;SUB&gt;OBJNR A&lt;/SUB&gt;KDAUF&lt;/P&gt;&lt;P&gt;                                 INTO TABLE T_AUFK&lt;/P&gt;&lt;P&gt;                                 FROM AUFK AS A&lt;/P&gt;&lt;P&gt;                                 INNER JOIN&lt;/P&gt;&lt;P&gt;                                 AUAK AS B&lt;/P&gt;&lt;P&gt;                                 ON    A&lt;SUB&gt;OBJNR   EQ B&lt;/SUB&gt;OBJNR&lt;/P&gt;&lt;P&gt;                                 WHERE B~PERIO   IN S_PERIO&lt;/P&gt;&lt;P&gt;                                 AND   B~BUGJAHR IN S_BUGJAH&lt;/P&gt;&lt;P&gt;                                 AND   A~WERKS   IN S_WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is working but not correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the given condition there is a single record only. &lt;/P&gt;&lt;P&gt;The output is 3 records of same information (duplication of single record).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found that in aufk only one record where as in auak the objnr is present in 3 records. I think this may be a reason.  Pls tell me the correct query to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank u.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 12:21:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321662#M509777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T12:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321663#M509778</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;The querry is correct&lt;/P&gt;&lt;P&gt;There may be a 3 settlement Document numbers(BELNR) for the same order(AUFK-OBJNR)&lt;/P&gt;&lt;P&gt;check the field values of BELNR are they same or different.&lt;/P&gt;&lt;P&gt;If they are different it is right.&lt;/P&gt;&lt;P&gt;if they are same they it is wrong.&lt;/P&gt;&lt;P&gt;Then sort the ITAB by AUFNR KOKRS BELNR &lt;/P&gt;&lt;P&gt;and use delete adjacent duplicates from ITAB comparing AUFNR BELNR.&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>Wed, 06 Jun 2007 12:25:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321663#M509778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T12:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321664#M509779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Murugan,&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;SELECT &amp;lt;i&amp;gt;DISTINCT&amp;lt;/i&amp;gt; A&lt;SUB&gt;AUFNR A&lt;/SUB&gt;KOKRS A&lt;SUB&gt;OBJNR A&lt;/SUB&gt;KDAUF&lt;/P&gt;&lt;P&gt;INTO TABLE T_AUFK&lt;/P&gt;&lt;P&gt;FROM AUFK AS A&lt;/P&gt;&lt;P&gt;INNER JOIN&lt;/P&gt;&lt;P&gt;AUAK AS B&lt;/P&gt;&lt;P&gt;ON A&lt;SUB&gt;OBJNR EQ B&lt;/SUB&gt;OBJNR&lt;/P&gt;&lt;P&gt;WHERE B~PERIO IN S_PERIO&lt;/P&gt;&lt;P&gt;AND B~BUGJAHR IN S_BUGJAH&lt;/P&gt;&lt;P&gt;AND A~WERKS IN S_WERKS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 12:27:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321664#M509779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T12:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321665#M509780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try following changed query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A~AUFNR &lt;/P&gt;&lt;P&gt;             B~KOKRS &lt;/P&gt;&lt;P&gt;             B~OBJNR &lt;/P&gt;&lt;P&gt;             A~KDAUF&lt;/P&gt;&lt;P&gt;   INTO TABLE T_AUFK&lt;/P&gt;&lt;P&gt;   FROM AUFK AS A&lt;/P&gt;&lt;P&gt;   INNER JOIN AUAK AS B&lt;/P&gt;&lt;P&gt;   ON A&lt;SUB&gt;OBJNR EQ B&lt;/SUB&gt;OBJNR&lt;/P&gt;&lt;P&gt;WHERE B~PERIO IN S_PERIO&lt;/P&gt;&lt;P&gt;AND B~BUGJAHR IN S_BUGJAH&lt;/P&gt;&lt;P&gt;AND A~WERKS IN S_WERKS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 12:30:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321665#M509780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T12:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321666#M509781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The problem is bcoz there are 3 records maintained for objnr in auak. Since u r fetching values only from aufk, u will be fetching the same records again and again. I am not sure how exactly the two tables are related. If u have more idea on their relation, then u can add some more condition check so that by the objnr in aufk along with some other field will point to only one record in auak. &lt;/P&gt;&lt;P&gt;Otherwise if its not possible, u can fetch the data into the internal table t_aufk.&lt;/P&gt;&lt;P&gt;Then sort the internal table by objnr.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from t_aufk.&lt;/P&gt;&lt;P&gt;these will remove the duplicate records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;anoop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 12:38:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/2321666#M509781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T12:38:22Z</dc:date>
    </item>
  </channel>
</rss>

