<?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/6561150#M1431364</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;Here is the codeyou need (if I understood what you need ;o)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  lt_ekbe	TYPE TABLE OF ekbe,&lt;/P&gt;&lt;P&gt;  ls_ekbe	TYPE ekbe,&lt;/P&gt;&lt;P&gt;  lt_bkpf	TYPE TABLE OF bkpf,&lt;/P&gt;&lt;P&gt;  ls_bkpf	TYPE bkpf,&lt;/P&gt;&lt;P&gt;  lv_belnr	TYPE belnr,&lt;/P&gt;&lt;P&gt;  lt_belnr	TYPE TABLE OF belnr.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;SELECT * INTO TABLE lt_bkpf&lt;/P&gt;&lt;P&gt;FROM bkpf&lt;/P&gt;&lt;P&gt;WHERE "Your condition".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT lt_bkpf INTO ls_bkpf.&lt;/P&gt;&lt;P&gt;  lv_belnr = ls_bkpf-awkey(10).&lt;/P&gt;&lt;P&gt;  APPEND lv_belnr TO lt_belnr.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * INTO TABLE lt_ekbe&lt;/P&gt;&lt;P&gt;FROM ekbe&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_belnr&lt;/P&gt;&lt;P&gt;WHERE belnr = lt_belnr. "(Don't rememeber if you have to put lt_belnr &lt;STRONG&gt;-BELNR&lt;/STRONG&gt;  )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":monkey_face:"&gt;🐵&lt;/span&gt;&lt;/P&gt;&lt;P&gt;KR,&lt;/P&gt;&lt;P&gt;Luis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Feb 2010 15:49:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-09T15:49:47Z</dc:date>
    <item>
      <title>join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561144#M1431358</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 want 2 join bkpf and ekbe table.&lt;/P&gt;&lt;P&gt;I use this relation &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ekbe-belnr = bkpf-awkey+0(10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it cant work.&lt;/P&gt;&lt;P&gt;So, plz anybody can say me way for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Urvi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 09:32:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561144#M1431358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T09:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561145#M1431359</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;XBLNR is common field use this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or  use this&lt;/P&gt;&lt;P&gt;Ekbe-belnr = bkpf-belnr&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;plz check fields AWTYP and AWKEY&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;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 10:06:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561145#M1431359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T10:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561146#M1431360</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;For both the tables you can use the join condition based on the field BELNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jatender&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 11:16:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561146#M1431360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T11:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561147#M1431361</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;Get the records from the table BKPF and then use the awkey+0&lt;SPAN __jive_macro_name="10"&gt;&lt;/SPAN&gt; and select data from EKBE using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;belnr =  it_bkpf-awkey+0(10)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abhijit G. Borkar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 12:25:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561147#M1431361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T12: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/6561148#M1431362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Both the table have the field BELNR.  So can compare with it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 12:49:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561148#M1431362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T12:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561149#M1431363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi,&lt;/P&gt;&lt;P&gt;&amp;gt; Both the table have the field BELNR.  So can compare with it.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But they're different BELNRs: BKPF contains the accounting document BELNR and EKBE the material document BELNR.  So, you can't join them.  To the OP, you can't use a SUBSTR with a JOIN in Open SQL, so you can't do what you want to do in a single SELECT; you'll need a couple of SELECTs and a FOR ALL ENTRIES.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 14:32:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561149#M1431363</guid>
      <dc:creator>christine_evans</dc:creator>
      <dc:date>2010-02-09T14:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561150#M1431364</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;Here is the codeyou need (if I understood what you need ;o)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  lt_ekbe	TYPE TABLE OF ekbe,&lt;/P&gt;&lt;P&gt;  ls_ekbe	TYPE ekbe,&lt;/P&gt;&lt;P&gt;  lt_bkpf	TYPE TABLE OF bkpf,&lt;/P&gt;&lt;P&gt;  ls_bkpf	TYPE bkpf,&lt;/P&gt;&lt;P&gt;  lv_belnr	TYPE belnr,&lt;/P&gt;&lt;P&gt;  lt_belnr	TYPE TABLE OF belnr.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;SELECT * INTO TABLE lt_bkpf&lt;/P&gt;&lt;P&gt;FROM bkpf&lt;/P&gt;&lt;P&gt;WHERE "Your condition".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT lt_bkpf INTO ls_bkpf.&lt;/P&gt;&lt;P&gt;  lv_belnr = ls_bkpf-awkey(10).&lt;/P&gt;&lt;P&gt;  APPEND lv_belnr TO lt_belnr.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * INTO TABLE lt_ekbe&lt;/P&gt;&lt;P&gt;FROM ekbe&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_belnr&lt;/P&gt;&lt;P&gt;WHERE belnr = lt_belnr. "(Don't rememeber if you have to put lt_belnr &lt;STRONG&gt;-BELNR&lt;/STRONG&gt;  )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":monkey_face:"&gt;🐵&lt;/span&gt;&lt;/P&gt;&lt;P&gt;KR,&lt;/P&gt;&lt;P&gt;Luis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 15:49:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561150#M1431364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-09T15:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561151#M1431365</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;In select statement try like below&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Invoice details&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;     IF Pt_account_document_head_table[] Is Not Initial.&lt;/P&gt;&lt;P&gt;        Select Belnr Gjahr Lifnr&lt;/P&gt;&lt;P&gt;               Budat Bldat Cpudt&lt;/P&gt;&lt;P&gt;               Rmwwr Waers&lt;/P&gt;&lt;P&gt;            Into table Pt_Invoice_Header_Table&lt;/P&gt;&lt;P&gt;            From Rbkp&lt;/P&gt;&lt;P&gt;           For All Entries in Pt_Account_Document_Head_Table&lt;/P&gt;&lt;P&gt;         Where belnr Eq Pt_Account_Document_Head_Table-Object_Key(10) And&lt;/P&gt;&lt;P&gt;               Belnr In s_Inum   And&lt;/P&gt;&lt;P&gt;               Cpudt In s_IentDt And&lt;/P&gt;&lt;P&gt;               Bldat In s_IdocDt And&lt;/P&gt;&lt;P&gt;               Budat In s_IposDt.&lt;/P&gt;&lt;P&gt;     Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Ramakrishna P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Mar 2010 11:14:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561151#M1431365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-02T11:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: join query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561152#M1431366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The select query will not give the desired result if you are using the fields having different data type or field length in  where caluse as you used for field BKPF-AWKEY. Instead of using the where condition as 'ekbe-belnr = bkpf-awkey+0(10)' directly , first fetch the data from bkpf table. Apeend the first ten chracters of field AWKEY in another internal table and use 'Sekect For ALL ENTRIES' for this internal table while fetching the data from EKBE table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve your problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 11:37:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-query/m-p/6561152#M1431366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T11:37:29Z</dc:date>
    </item>
  </channel>
</rss>

