<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639359#M284864</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;Just as you wrote it can't do a join using BSEG because is a cluster table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U can replace the join with FOR ALL ENTRIES options if you can create a WHERE condtion only for BKPF table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: T_BKPF LIKE STANDARD TABLE OF BKPF WITH HEADER LINE.
DATA: T_BSEG LIKE STANDARD TABLE OF BSEG WITH HEADER LINE.

SELECT * FROM BKPF INTO TABLE T_BKPF WHERE BUKRS = .....
IF SY-SUBRC = 0.
   SELECT * FROM BSEG INTO TABLE T_BSEG
         FOR ALL ENTRIES IN T_BKPF
                           WHERE BUKRS = T_BKPF-BUKRS
                                 AND BELNR = T_BKPF-BELNR
                                 AND GJAHR = T_BKPF-GJAHR.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to select only a certain kind of item you can use the secondary index tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- BSIS/BSAS Open/Cleared items for G/L account&lt;/P&gt;&lt;P&gt;- BSID/BSAD Open/Cleared items for Customer account&lt;/P&gt;&lt;P&gt;- BSIK/BSAK Open/Cleared items for Vendor account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are transparent table so you can use them in a join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 19 Nov 2006 10:43:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-19T10:43:19Z</dc:date>
    <item>
      <title>INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639356#M284861</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;I have 2 tables to select from, bkpf (header) bseg (item),&lt;/P&gt;&lt;P&gt;Due to a lot of data I would like to create a view or inner join&lt;/P&gt;&lt;P&gt;From this 2 tables, however because bseg is a Cluster table it can't be done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank Emmanuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 10:32:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639356#M284861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-19T10:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639357#M284862</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 like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. It is recommended that&lt;/P&gt;&lt;P&gt;first select entries from only one table&lt;/P&gt;&lt;P&gt;(say, BKPF),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. After that, using the internal table,&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES, and BSEG table,&lt;/P&gt;&lt;P&gt;select the relevant entries from BSEG table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Performance wise, this will be very fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;if hlped pls mark points&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 10:36:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639357#M284862</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-19T10:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639358#M284863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the statement 'FOR ALL ENTRIES'&lt;/P&gt;&lt;P&gt;Takes a lot of times (more than 24 hours for millions of records), and this&lt;/P&gt;&lt;P&gt;Is the reason that I wanted something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Emmanuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 10:41:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639358#M284863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-19T10:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639359#M284864</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;Just as you wrote it can't do a join using BSEG because is a cluster table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U can replace the join with FOR ALL ENTRIES options if you can create a WHERE condtion only for BKPF table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: T_BKPF LIKE STANDARD TABLE OF BKPF WITH HEADER LINE.
DATA: T_BSEG LIKE STANDARD TABLE OF BSEG WITH HEADER LINE.

SELECT * FROM BKPF INTO TABLE T_BKPF WHERE BUKRS = .....
IF SY-SUBRC = 0.
   SELECT * FROM BSEG INTO TABLE T_BSEG
         FOR ALL ENTRIES IN T_BKPF
                           WHERE BUKRS = T_BKPF-BUKRS
                                 AND BELNR = T_BKPF-BELNR
                                 AND GJAHR = T_BKPF-GJAHR.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to select only a certain kind of item you can use the secondary index tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- BSIS/BSAS Open/Cleared items for G/L account&lt;/P&gt;&lt;P&gt;- BSID/BSAD Open/Cleared items for Customer account&lt;/P&gt;&lt;P&gt;- BSIK/BSAK Open/Cleared items for Vendor account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are transparent table so you can use them in a join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 10:43:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639359#M284864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-19T10:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639360#M284865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using &lt;/P&gt;&lt;P&gt;- BSIS/BSAS Open/Cleared items for G/L account&lt;/P&gt;&lt;P&gt;- BSID/BSAD Open/Cleared items for Customer account&lt;/P&gt;&lt;P&gt;- BSIK/BSAK Open/Cleared items for Vendor account&lt;/P&gt;&lt;P&gt;is the best solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you Emmanuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 10:48:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639360#M284865</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-19T10:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639361#M284866</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 use for all entries and put some where condition as MAX told.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise u can use bsis/bsas, bsik/bsak, bsid/bsad&lt;/P&gt;&lt;P&gt;-&amp;gt; here're fields of bkpf and bseg for different kinds of accounts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;pls mark all helpful answers&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 10:48:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639361#M284866</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-19T10:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639362#M284867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are your selection criteria?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2006 18:13:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/1639362#M284867</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-19T18:13:53Z</dc:date>
    </item>
  </channel>
</rss>

