<?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: Replacement for inner join. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306043#M791746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhishek,&lt;/P&gt;&lt;P&gt;   First fetch the data from mkpf with  where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the itab.&lt;/P&gt;&lt;P&gt;and use for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If helpful give me the points.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 03 Feb 2008 05:53:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-03T05:53:28Z</dc:date>
    <item>
      <title>Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306034#M791737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following SELECT stmt with inner join which is taking more time to execute......Kindly help me how to improve performance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;WERKS A&lt;/SUB&gt;MATNR A&lt;SUB&gt;MBLNR A&lt;/SUB&gt;MJAHR A&lt;SUB&gt;MENGE A&lt;/SUB&gt;BWART A~SHKZG&lt;/P&gt;&lt;P&gt;                A&lt;SUB&gt;AUFNR  B&lt;/SUB&gt;BUDAT&lt;/P&gt;&lt;P&gt;               INTO CORRESPONDING FIELDS OF TABLE TRANSTAB&lt;/P&gt;&lt;P&gt;    FROM MSEG AS A INNER JOIN MKPF AS B ON A&lt;SUB&gt;MBLNR = B&lt;/SUB&gt;MBLNR AND&lt;/P&gt;&lt;P&gt;                                          A&lt;SUB&gt;MJAHR = B&lt;/SUB&gt;MJAHR&lt;/P&gt;&lt;P&gt;                WHERE A~BUKRS =  BUKRS   AND&lt;/P&gt;&lt;P&gt;                      A~WERKS IN R_WERKS AND&lt;/P&gt;&lt;P&gt;                      A~MATNR IN S_MATNR AND&lt;/P&gt;&lt;P&gt;                      B~BUDAT &amp;gt;= YFDATE  AND&lt;/P&gt;&lt;P&gt;                      B~BUDAT &amp;lt;= P_DATUM AND&lt;/P&gt;&lt;P&gt;                      A~BWART IN (101,102,601,602,641,642).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YOUR HELP IS HIGHLY APPRECIATED....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 04:08:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306034#M791737</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-30T04:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306035#M791738</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;remove Into corresponding and try for all entries for  the same&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 04:28:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306035#M791738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-30T04:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306036#M791739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to use FOR ALL ENTRIES.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 05:11:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306036#M791739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-30T05:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306037#M791740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;WERKS A&lt;/SUB&gt;MATNR A&lt;SUB&gt;MBLNR A&lt;/SUB&gt;MJAHR A&lt;SUB&gt;MENGE A&lt;/SUB&gt;BWART A~SHKZG&lt;/P&gt;&lt;P&gt;A&lt;SUB&gt;AUFNR B&lt;/SUB&gt;BUDAT&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES  OF TABLE TRANSTAB&lt;/P&gt;&lt;P&gt;FROM MSEG AS A INNER JOIN MKPF AS B ON A&lt;SUB&gt;MBLNR = B&lt;/SUB&gt;MBLNR AND&lt;/P&gt;&lt;P&gt;A&lt;SUB&gt;MJAHR = B&lt;/SUB&gt;MJAHR&lt;/P&gt;&lt;P&gt;WHERE A~BUKRS = BUKRS AND&lt;/P&gt;&lt;P&gt;A~WERKS IN R_WERKS AND&lt;/P&gt;&lt;P&gt;A~MATNR IN S_MATNR AND&lt;/P&gt;&lt;P&gt;B~BUDAT &amp;gt;= YFDATE AND&lt;/P&gt;&lt;P&gt;B~BUDAT &amp;lt;= P_DATUM AND&lt;/P&gt;&lt;P&gt;A~BWART IN (101,102,601,602,641,642).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 06:10:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306037#M791740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-30T06:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306038#M791741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not think that this question is answered ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example at the end does not work, because the FOR ALL ENTRIES does not appear in the WHERE clause and the INNER JOIN is still there!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually the FOR ALL ENTRIES will not improve anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is as always INDEXES, INDEXES, INDEXES ... but nobody seems to understand here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 08:27:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306038#M791741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-30T08:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306039#M791742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wouldn't say &lt;EM&gt;nobody&lt;/EM&gt; here understands &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 18:48:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306039#M791742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-30T18:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306040#M791743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhishek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same query can be improved by &lt;/P&gt;&lt;P&gt;1. declaring the fields in the internal table in the order they are present in the database table.&lt;/P&gt;&lt;P&gt;2. Declaring only the required fields which needs to be fetched from the database table.&lt;/P&gt;&lt;P&gt;3. Also if you have declared only the required fields from the database you can remove into corresponding fields of table....instead you can use into table itab&lt;/P&gt;&lt;P&gt;4. Create a range object for BUDAT and provide it in the where clause.&lt;/P&gt;&lt;P&gt;5. Provide the details in the where clause also in the order in which the fields are declared in teh database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make the above changes and try now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the query is still taking more time then try to create an idex on the frequently used fields only if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ranjani.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2008 06:58:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306040#M791743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-31T06:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306041#M791744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case, the use of &lt;STRONG&gt;IN&lt;/STRONG&gt; takes some time to retrieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is not always INDEXES.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 02:21:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306041#M791744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-01T02:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306042#M791745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Goldie - IN may or may not take more time. It depends on selectivity. If the IN is wide open, then the database will not be able to use and index effectively and may have to use a full index scan. I encourage you to run this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ztest_indexed_selects.

PARAMETERS: p_bukrs   LIKE bkpf-bukrs,
            p_blart   LIKE bkpf-blart,
            p_budat   LIKE bkpf-budat,
            p_gjahr   LIKE bkpf-gjahr.
DATA: bkpf  TYPE bkpf.

DATA: bkpf_int TYPE TABLE OF bkpf .

DATA: cc      LIKE bkpf-bukrs,
      doc     LIKE bkpf-belnr,
      start   TYPE i,
      end     TYPE i,
      dif     TYPE i.

START-OF-SELECTION.

* Hardcoded values
* Preliminary select.
  REFRESH bkpf_int.
  SELECT  *
    FROM bkpf
    INTO TABLE bkpf_int
    WHERE bukrs EQ p_bukrs
    AND gjahr EQ p_gjahr
    AND bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z')
    AND blart = p_blart
    AND budat = p_budat.

  DO 5 TIMES.
    REFRESH bkpf_int.
    GET RUN TIME FIELD start.
    SELECT  *
      FROM bkpf
      INTO TABLE bkpf_int
      WHERE bukrs EQ p_bukrs
      AND gjahr EQ p_gjahr
      AND blart = p_blart
      AND budat = p_budat.
    GET RUN TIME FIELD end.
    dif = end - start.
    WRITE: /001 'Time for SELECT without BSTAT', ':', dif,
                 'microseconds'.

    REFRESH bkpf_int.
    GET RUN TIME FIELD start.
    SELECT  *
      FROM bkpf
      INTO TABLE bkpf_int
      WHERE bukrs EQ p_bukrs
      AND gjahr EQ p_gjahr
      AND bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z')
      AND blart = p_blart
      AND budat = p_budat.
    GET RUN TIME FIELD end.
    dif = end - start.
    WRITE: /001 'Time for SELECT with    BSTAT', ':', dif,
                 'microseconds'.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 15:59:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306042#M791745</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-01T15:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for inner join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306043#M791746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhishek,&lt;/P&gt;&lt;P&gt;   First fetch the data from mkpf with  where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the itab.&lt;/P&gt;&lt;P&gt;and use for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If helpful give me the points.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 05:53:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacement-for-inner-join/m-p/3306043#M791746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T05:53:28Z</dc:date>
    </item>
  </channel>
</rss>

