<?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 Tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650792#M879266</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;You can do as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

First get all the data from BKPF for the fields belnr, blart, bldat and bukrs into one internal table as this is the header table for document .

select bukrs belnr blart bldat budat from bkpf into table gt_bkpf where &amp;lt;condition&amp;gt;.

"Then go to BSEG table using BKPF details

select bukrs belnr blart saknr kostl from bseg into table gt_bseg  for all entries of gt_bkpf where &amp;lt;condition&amp;gt;.

"Then go to ZTable using the details of BSEG gt_bseg using for all entries .

select co_num, co_name from ztable into table gt_table where &amp;lt;condition&amp;gt;.

"You can use the gt_table for the output.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="13" __jive_macro_name="size"&gt;Please use the fields depends upon your requirement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 12 Apr 2008 18:10:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-12T18:10:21Z</dc:date>
    <item>
      <title>Join Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650790#M879264</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 have a scenario where I have got three tables two std ones and the third one is the custom one bseg,bkpf and ztest, and based on three fields i.e. belnr, blart and bukrs( which is in all the three tables )to join these tables and need to retreive the following the data from each table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From BSEG - -  -&amp;gt; saknr,kostl&lt;/P&gt;&lt;P&gt;From BKPF- - - - &amp;gt; blart,bldat &lt;/P&gt;&lt;P&gt;and &lt;/P&gt;&lt;P&gt;From Ztest -&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;&amp;gt; co_num, co_name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So can you please tell me how can I achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Rajeev !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2008 17:51:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650790#M879264</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-12T17:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Join Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650791#M879265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;types: begin of ty_itab,&lt;/P&gt;&lt;P&gt;             saknr  type ..&lt;/P&gt;&lt;P&gt;             kostl   type ...&lt;/P&gt;&lt;P&gt;             blart   type ....&lt;/P&gt;&lt;P&gt;             co_num type ....&lt;/P&gt;&lt;P&gt;             co_name type...&lt;/P&gt;&lt;P&gt;types: end  of ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type table of ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select BSEG~saknr &lt;/P&gt;&lt;P&gt;          BSEG~kostl&lt;/P&gt;&lt;P&gt;          BKPF~blart &lt;/P&gt;&lt;P&gt;          BKPF~bldat&lt;/P&gt;&lt;P&gt;          ztest~co_num&lt;/P&gt;&lt;P&gt;          ztest~co_name&lt;/P&gt;&lt;P&gt;from bseg inner join&lt;/P&gt;&lt;P&gt;        bkpf&lt;/P&gt;&lt;P&gt;        on bseg&lt;SUB&gt;belnr = bkpr&lt;/SUB&gt;belnr&lt;/P&gt;&lt;P&gt;        and bseg&lt;SUB&gt;blart = bkpf&lt;/SUB&gt;blart&lt;/P&gt;&lt;P&gt;        and bseg&lt;SUB&gt;bukrs = bkpf&lt;/SUB&gt;bukrs inner join&lt;/P&gt;&lt;P&gt;        ztest on ztest&lt;SUB&gt;belnr = bseg&lt;/SUB&gt;belnr&lt;/P&gt;&lt;P&gt;        and ztest&lt;SUB&gt;blart = bseg&lt;/SUB&gt;blart&lt;/P&gt;&lt;P&gt;        and ztest&lt;SUB&gt;bukrs = bseg&lt;/SUB&gt;bukrs&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where .....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2008 18:03:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650791#M879265</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-12T18:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Join Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650792#M879266</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;You can do as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

First get all the data from BKPF for the fields belnr, blart, bldat and bukrs into one internal table as this is the header table for document .

select bukrs belnr blart bldat budat from bkpf into table gt_bkpf where &amp;lt;condition&amp;gt;.

"Then go to BSEG table using BKPF details

select bukrs belnr blart saknr kostl from bseg into table gt_bseg  for all entries of gt_bkpf where &amp;lt;condition&amp;gt;.

"Then go to ZTable using the details of BSEG gt_bseg using for all entries .

select co_num, co_name from ztable into table gt_table where &amp;lt;condition&amp;gt;.

"You can use the gt_table for the output.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="13" __jive_macro_name="size"&gt;Please use the fields depends upon your requirement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2008 18:10:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-tables/m-p/3650792#M879266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-12T18:10:21Z</dc:date>
    </item>
  </channel>
</rss>

