<?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: program optimization in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646822#M1285014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use select staement to fetch the data from a table and then from other table fetch the data with select for all entries from other table into other interbnal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now  play with ur internal tables which has all the data..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 May 2009 06:41:02 GMT</pubDate>
    <dc:creator>kanishakgupta1</dc:creator>
    <dc:date>2009-05-05T06:41:02Z</dc:date>
    <item>
      <title>program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646817#M1285009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need your expert opinion, can you please suggest on how can i optimize this code? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT ekko&lt;SUB&gt;ebeln eket&lt;/SUB&gt;eindt ekko&lt;SUB&gt;lifnr ekko&lt;/SUB&gt;reswk ekpo~werks&lt;/P&gt;&lt;P&gt;         ekko&lt;SUB&gt;bsart ekko&lt;/SUB&gt;ekgrp ekpo&lt;SUB&gt;ebelp ekpo&lt;/SUB&gt;matnr eket~menge&lt;/P&gt;&lt;P&gt;         eket&lt;SUB&gt;wamng ekpo&lt;/SUB&gt;meins ekpo&lt;SUB&gt;elikz ekpo&lt;/SUB&gt;eglkz ekko~unsez&lt;/P&gt;&lt;P&gt;         ekko&lt;SUB&gt;ihrez ekpo&lt;/SUB&gt;retpo ekko&lt;SUB&gt;bedat ekpo&lt;/SUB&gt;evers eket~wemng&lt;/P&gt;&lt;P&gt;         ekpo&lt;SUB&gt;loekz ekko&lt;/SUB&gt;absgr ekpo~bukrs&lt;/P&gt;&lt;P&gt;    FROM   ekko&lt;/P&gt;&lt;P&gt;    JOIN   ekpo&lt;/P&gt;&lt;P&gt;    ON     ekpo&lt;SUB&gt;ebeln EQ ekko&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;    JOIN   eket&lt;/P&gt;&lt;P&gt;    ON     eket&lt;SUB&gt;ebeln EQ ekpo&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;    AND    eket&lt;SUB&gt;ebelp EQ ekpo&lt;/SUB&gt;ebelp&lt;/P&gt;&lt;P&gt;    JOIN   mara&lt;/P&gt;&lt;P&gt;    ON     mara&lt;SUB&gt;matnr EQ ekpo&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;    INTO   CORRESPONDING FIELDS OF TABLE i_tab&lt;/P&gt;&lt;P&gt;    WHERE  ekko~bsart IN s_bsart&lt;/P&gt;&lt;P&gt;    AND    ekko~bedat IN s_bedat&lt;/P&gt;&lt;P&gt;    AND    ekko~ebeln IN s_ebeln&lt;/P&gt;&lt;P&gt;    AND    ekko~ekgrp IN s_ekgrp&lt;/P&gt;&lt;P&gt;    AND    ekko~lifnr IN s_lifnr&lt;/P&gt;&lt;P&gt;    AND    ekko~reswk IN s_reswk&lt;/P&gt;&lt;P&gt;    AND    ekko~absgr IN s_absgr&lt;/P&gt;&lt;P&gt;    AND    ekpo~werks IN s_werks&lt;/P&gt;&lt;P&gt;    AND    ekpo~evers IN s_evers&lt;/P&gt;&lt;P&gt;    AND    ekpo~matnr IN s_matnr&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   AND    ekpo~loekz EQ space&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    AND    eket~eindt IN s_eindt&lt;/P&gt;&lt;P&gt;    AND    mara~mtart IN s_mtart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:21:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646817#M1285009</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646818#M1285010</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;First based on the selection screen data, fetch the data from the table EKKO into some internal table T_EKKO. Now only for the T_EKKO entries by adding other conditions fetch the data from the EKPO into internal table T_EKPO. Like that using the for all entries and check the sy-subrc = 0, after every select, you can improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to check the internal table is not initial before using FOR ALL ENTRIES statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santhosh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:26:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646818#M1285010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646819#M1285011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use select for all entreies queries for fertching the data from single tables into internal tables.&lt;/P&gt;&lt;P&gt;sort the internal tables based on common fields.]&lt;/P&gt;&lt;P&gt;Then appling loop read the data from the internal tables using binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also use field symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kanishak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:32:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646819#M1285011</guid>
      <dc:creator>kanishakgupta1</dc:creator>
      <dc:date>2009-05-05T06:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646820#M1285012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so will I completely disregard the use of JOIN tables in the existing code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:35:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646820#M1285012</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646821#M1285013</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 the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ekko&lt;SUB&gt;ebeln ekko&lt;/SUB&gt;bsart ekko&lt;SUB&gt;lifnr ekko&lt;/SUB&gt;ekgrp ekko~bedat &lt;/P&gt;&lt;P&gt;ekko&lt;SUB&gt;ihrez ekko&lt;/SUB&gt;unsez ekko&lt;SUB&gt;reswk ekko&lt;/SUB&gt;absgr &lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;ebelp ekpo&lt;/SUB&gt;matnr ekpo&lt;SUB&gt;bukrs ekpo&lt;/SUB&gt;werks  ekpo&lt;SUB&gt;meins ekpo&lt;/SUB&gt;evers &lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;retpo ekpo&lt;/SUB&gt;elikz ekpo&lt;SUB&gt;eglkz ekpo&lt;/SUB&gt;loekz &lt;/P&gt;&lt;P&gt;eket&lt;SUB&gt;menge eket&lt;/SUB&gt;eindt eket&lt;SUB&gt;wamng eket&lt;/SUB&gt;wemng&lt;/P&gt;&lt;P&gt;FROM ekko&lt;/P&gt;&lt;P&gt;JOIN ekpo&lt;/P&gt;&lt;P&gt;ON ekpo&lt;SUB&gt;ebeln EQ ekko&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;JOIN eket&lt;/P&gt;&lt;P&gt;ON eket&lt;SUB&gt;ebeln EQ ekpo&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;AND eket&lt;SUB&gt;ebelp EQ ekpo&lt;/SUB&gt;ebelp&lt;/P&gt;&lt;P&gt;JOIN mara&lt;/P&gt;&lt;P&gt;ON mara&lt;SUB&gt;matnr EQ ekpo&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE i_tab&lt;/P&gt;&lt;P&gt;WHERE ekko~ebeln IN s_ebeln&lt;/P&gt;&lt;P&gt;AND ekko~bsart IN s_bsart&lt;/P&gt;&lt;P&gt;AND ekko~lifnr IN s_lifnr&lt;/P&gt;&lt;P&gt;AND ekko~ekgrp IN s_ekgrp&lt;/P&gt;&lt;P&gt;AND ekko~bedat IN s_bedat&lt;/P&gt;&lt;P&gt;AND ekko~reswk IN s_reswk&lt;/P&gt;&lt;P&gt;AND ekko~absgr IN s_absgr&lt;/P&gt;&lt;P&gt;AND ekpo~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;AND ekpo~werks IN s_werks&lt;/P&gt;&lt;P&gt;AND ekpo~evers IN s_evers&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;AND ekpo~loekz EQ space&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AND eket~eindt IN s_eindt&lt;/P&gt;&lt;P&gt;AND mara~mtart IN s_mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If at all needed, you can use only Select statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ekko&lt;SUB&gt;ebeln ekko&lt;/SUB&gt;bsart ekko&lt;SUB&gt;lifnr ekko&lt;/SUB&gt;ekgrp ekko~bedat &lt;/P&gt;&lt;P&gt;ekko&lt;SUB&gt;ihrez ekko&lt;/SUB&gt;unsez ekko&lt;SUB&gt;reswk ekko&lt;/SUB&gt;absgr &lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;ebelp ekpo&lt;/SUB&gt;matnr ekpo&lt;SUB&gt;bukrs ekpo&lt;/SUB&gt;werks  ekpo&lt;SUB&gt;meins ekpo&lt;/SUB&gt;evers &lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;retpo ekpo&lt;/SUB&gt;elikz ekpo&lt;SUB&gt;eglkz ekpo&lt;/SUB&gt;loekz &lt;/P&gt;&lt;P&gt;eket&lt;SUB&gt;menge eket&lt;/SUB&gt;eindt eket&lt;SUB&gt;wamng eket&lt;/SUB&gt;wemng&lt;/P&gt;&lt;P&gt;FROM ekko&lt;/P&gt;&lt;P&gt;JOIN ekpo&lt;/P&gt;&lt;P&gt;ON ekpo&lt;SUB&gt;ebeln EQ ekko&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;JOIN eket&lt;/P&gt;&lt;P&gt;ON eket&lt;SUB&gt;ebeln EQ ekpo&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;AND eket&lt;SUB&gt;ebelp EQ ekpo&lt;/SUB&gt;ebelp&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE i_tab&lt;/P&gt;&lt;P&gt;WHERE ekko~ebeln IN s_ebeln&lt;/P&gt;&lt;P&gt;AND ekko~bsart IN s_bsart&lt;/P&gt;&lt;P&gt;AND ekko~lifnr IN s_lifnr&lt;/P&gt;&lt;P&gt;AND ekko~ekgrp IN s_ekgrp&lt;/P&gt;&lt;P&gt;AND ekko~bedat IN s_bedat&lt;/P&gt;&lt;P&gt;AND ekko~reswk IN s_reswk&lt;/P&gt;&lt;P&gt;AND ekko~absgr IN s_absgr&lt;/P&gt;&lt;P&gt;AND ekpo~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;AND ekpo~werks IN s_werks&lt;/P&gt;&lt;P&gt;AND ekpo~evers IN s_evers&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;AND ekpo~loekz EQ space&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AND eket~eindt IN s_eindt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, Select matnr from mara into it_mara for all entries in i_tab where matnr = i_tab-matnr and mtart in s_mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_mara.&lt;/P&gt;&lt;P&gt;delete those entries in i_tab where it_matnr &amp;lt;&amp;gt; i_tab-matnr.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Best Regards,&lt;/P&gt;&lt;P&gt;Suresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:39:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646821#M1285013</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646822#M1285014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use select staement to fetch the data from a table and then from other table fetch the data with select for all entries from other table into other interbnal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now  play with ur internal tables which has all the data..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:41:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646822#M1285014</guid>
      <dc:creator>kanishakgupta1</dc:creator>
      <dc:date>2009-05-05T06:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646823#M1285015</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;It seems you are writing more number of lines of code but it is the preferred one to use FOR ALL ENTRIES etc kind of usage in the select queries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So don't use any JOIN kind of statements in SELECT staments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say even if you do not have data in the dependecy table, if you use JOIN, it unnecessarily hit the data base. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System will get time out dump in production systems, though it works fine in the development systems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santhosh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:41:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646823#M1285015</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646824#M1285016</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;Dont neglect using INNER JOINs. Because your selection condition (input condition) is like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope if you go for some other way other than using INNER JOINs you will lose some data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Best Regards,&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:41:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646824#M1285016</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646825#M1285017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using the view WB2_V_EKKO_EKPO2 it contains entries of both EKKO and EKPO for all the fields, just the filed names have extension _I. Chek for the view in ur system first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: vijetasap on May 5, 2009 8:45 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 06:45:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646825#M1285017</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T06:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646826#M1285018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have tons of IN operators in your select, the ranges could hold anything, from nothing (=everything) to a single value. Runtime and access path will vary based on the contents of the ranges.&lt;/P&gt;&lt;P&gt;Don't believe the "use FOR ALL ENTRIES" tips, the JOIN conditions look OK at quick glance.&lt;/P&gt;&lt;P&gt;Also: &lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 07:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646826#M1285018</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-05-05T07:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646827#M1285019</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;1) Split the join for better performance.&lt;/P&gt;&lt;P&gt;2) While joining the table use MANDT field inthe on condition for better perfromance.&lt;/P&gt;&lt;P&gt;30 Avoid using 'Into corresponding fields' in the SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the below optimized code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; Split the JOIN first fetch teh data from EKKO &amp;amp; EKPO into internal tbale I_EKKO using below SQL .&lt;/P&gt;&lt;P&gt;SELECT ekko&lt;SUB&gt;ebeln  EKKO&lt;/SUB&gt;EBELP ekko&lt;SUB&gt;lifnr ekko&lt;/SUB&gt;reswk ekpo~werks&lt;/P&gt;&lt;P&gt;ekko&lt;SUB&gt;bsart ekko&lt;/SUB&gt;ekgrp ekpo&lt;SUB&gt;ebelp ekpo&lt;/SUB&gt;matnr &lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;meins ekpo&lt;/SUB&gt;elikz ekpo&lt;SUB&gt;eglkz ekko&lt;/SUB&gt;unsez&lt;/P&gt;&lt;P&gt;ekko&lt;SUB&gt;ihrez ekpo&lt;/SUB&gt;retpo ekko&lt;SUB&gt;bedat ekpo&lt;/SUB&gt;evers &lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;loekz ekko&lt;/SUB&gt;absgr ekpo~bukrs&lt;/P&gt;&lt;P&gt;FROM ekko&lt;/P&gt;&lt;P&gt;JOIN ekpo&lt;/P&gt;&lt;P&gt;ON ekpo&lt;SUB&gt;MANDT EQ ekko&lt;/SUB&gt;MANDT and ekpo&lt;SUB&gt;ebeln EQ ekko&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;INTO TABLE i_ekko&lt;/P&gt;&lt;P&gt;WHERE ekko~bsart IN s_bsart&lt;/P&gt;&lt;P&gt;AND ekko~bedat IN s_bedat&lt;/P&gt;&lt;P&gt;AND ekko~ebeln IN s_ebeln&lt;/P&gt;&lt;P&gt;AND ekko~ekgrp IN s_ekgrp&lt;/P&gt;&lt;P&gt;AND ekko~lifnr IN s_lifnr&lt;/P&gt;&lt;P&gt;AND ekko~reswk IN s_reswk&lt;/P&gt;&lt;P&gt;AND ekko~absgr IN s_absgr&lt;/P&gt;&lt;P&gt;AND ekpo~werks IN s_werks&lt;/P&gt;&lt;P&gt;AND ekpo~evers IN s_evers&lt;/P&gt;&lt;P&gt;AND ekpo~matnr IN s_matnr&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;AND ekpo~loekz EQ space.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt;then Query EKET with I_EKKO-EBELN &amp;amp; EBELP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select  ebeln ebelp menge eindt&lt;/P&gt;&lt;P&gt;           wamng wemng&lt;/P&gt;&lt;P&gt;          from EKET &lt;/P&gt;&lt;P&gt;            into table i_EKET&lt;/P&gt;&lt;P&gt;           for all entries in I_EKKO&lt;/P&gt;&lt;P&gt;        where ebeln = i_ekko-ebeln and&lt;/P&gt;&lt;P&gt;                 ebelp = i_ekko-ebelp &lt;/P&gt;&lt;P&gt;                AND eket~eindt IN s_eindt.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;sort i_eket by ebeln ebelp.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt;Then Query MARA with with I_EKKO.&lt;/P&gt;&lt;P&gt;      MOve the data from i_EKKO to I_EKKO_TMP.&lt;/P&gt;&lt;P&gt;       Sort I_EKKO_TMP  by MATNR.&lt;/P&gt;&lt;P&gt;       Delete the duplicates from I_EKKO_TMP comparing MATNR.&lt;/P&gt;&lt;P&gt;-&amp;gt;use the below SQL to fetch the data mara.&lt;/P&gt;&lt;P&gt;select MATNR into I_MARA&lt;/P&gt;&lt;P&gt;                     from MARA&lt;/P&gt;&lt;P&gt;                     for all entries in I_EKKO_TMP&lt;/P&gt;&lt;P&gt;                      where matnr = i_EKKO_TMP-matnr&lt;/P&gt;&lt;P&gt;                     AND mara~mtart IN s_mtart.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;   sort i_mara by matnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;then loop the table I_EKKO and reasd I_EKET and I_MARA and popualte the final internal table.&lt;/P&gt;&lt;P&gt;Check the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at I_EKKO.&lt;/P&gt;&lt;P&gt;  Read tbale i_MATA with key MATNR = I_EKKO-MATNR.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--&lt;/STRONG&gt;Move fieldds from i_EKKO to itab fields*&lt;/P&gt;&lt;P&gt;  read table i_eket eith key ebeln = i_ekko-ebeln &lt;/P&gt;&lt;P&gt;                                        ebelp = i_ekko-ebelp.&lt;/P&gt;&lt;P&gt;   if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;--&lt;/STRONG&gt;Move fieldds from i_EKET to itab fields*&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;     Append itab.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 11:35:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646827#M1285019</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T11:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646828#M1285020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, OK, OK - this is all my fault. I thought by combining some useful links into one, people would have more information at their finger tips and it would help and I could remove the sticky from &lt;SPAN __jive_macro_name="thread" id="1174072"&gt;&lt;/SPAN&gt; and reduce some clutter at the top.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've added back the sticky. Please read it if you haven't already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 13:36:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646828#M1285020</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T13:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646829#M1285021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it's really amazing that people continue to suggest FOR ALL ENTRIES as the ultimate performance solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of last comments even suggested to add MANDT in the join. That one I would say is rarer. I find it strange that people give these kind of advices when they obviously never tried it themselves (bectause I'm sure that never solved a performance issue...).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 14:33:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646829#M1285021</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2009-05-05T14:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646830#M1285022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ideally you want to identify a suitable index on EKKO, and get rid of any superflous selection options.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 14:38:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646830#M1285022</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-05T14:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646831#M1285023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Yes, it's really amazing that people continue to suggest FOR ALL ENTRIES as the ultimate performance solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please join us in keeping such misinformation in check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I find disturbing as well is that often the OP does not comment on the answers.&lt;/P&gt;&lt;P&gt;Solved? Not a problem anymore? Overwhelmed by the replies?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2009 14:44:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646831#M1285023</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-05-05T14:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646832#M1285024</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;Thank you for all your suggestions, as of now I haven't tried them yet because I am not sure what is the best solution for this. I will keep you posted as soon as i have applied the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 03:13:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646832#M1285024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T03:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: program optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646833#M1285025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
WHERE ekko~bsart IN s_bsart
AND ekko~bedat IN s_bedat
AND ekko~ebeln IN s_ebeln
AND ekko~ekgrp IN s_ekgrp
AND ekko~lifnr IN s_lifnr
AND ekko~reswk IN s_reswk
AND ekko~absgr IN s_absgr
AND ekpo~werks IN s_werks
AND ekpo~evers IN s_evers
AND ekpo~matnr IN s_matnr
* AND ekpo~loekz EQ space
AND eket~eindt IN s_eindt
AND mara~mtart IN s_mtart.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The is the other issue which is completely ignored in this forum. This WHERE condition allows lots of different accesses. Not the ranges go to the database, but the actual inputs in the ranges als ranges which are not filled disappear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 12 different ranges, even with simple inputs of one value with equal, I get 2 ** 12 = 4096 different combinations!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Overall you can not expect that each of these combinations work fine, for example if there is onyl an&lt;/P&gt;&lt;P&gt;input in s_werks, then the performance will never be good, no way! But that is a stupid task anyway.&lt;/P&gt;&lt;P&gt;You must find out which tasks make sense and should be supported by indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These, and that will be not only one, you must try to optimize!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With FOR ALL ENTRIES you would have to program different orders of the procesing, starting with one or the other table. A lot of work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the join is will process in different orders automatically and a JOIN is faster than a FAE always&lt;/P&gt;&lt;P&gt;if it works fine. There is only the problem, that such a hard task is not automatically solved by the join in all combinations. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 08:09:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-optimization/m-p/5646833#M1285025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T08:09:13Z</dc:date>
    </item>
  </channel>
</rss>

