<?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: Problem with BKPF SELECT. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437110#M1648177</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all what you can do is you need to revise the where fields order in the where clause... Try using for all entries make sure you have used correct order of fields in where clause as it will hit the primary index and perform faster...&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Nabheet&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Absolutely incorrect.&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, 04 Jan 2012 18:38:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-01-04T18:38:07Z</dc:date>
    <item>
      <title>Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437108#M1648175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone! Quick question. I'm using a select statement from table BKPF  with joins to WITH_ITEM and LFA1. The thing is that it takes too long to execute, and finally i get a dump timeout. i tried to replace BKPF for BSIK or BSAK in case that helped, but to no avail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the select code, perhaps there's something I'm not noticing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for taking the time to look at it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a good one!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM get_docs TABLES itab_rets STRUCTURE itab_ret.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT b&lt;SUB&gt;budat b&lt;/SUB&gt;belnr b&lt;SUB&gt;blart w&lt;/SUB&gt;wt_qsshh w&lt;SUB&gt;qsatz w&lt;/SUB&gt;wt_qbshh w&lt;SUB&gt;ctnumber w&lt;/SUB&gt;wt_acco w&lt;SUB&gt;wt_withcd l&lt;/SUB&gt;stcd1    l&lt;SUB&gt;stcd3 l&lt;/SUB&gt;fityp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab_rets&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM with_item AS w INNER JOIN bkpf AS b ON w&lt;SUB&gt;belnr = b&lt;/SUB&gt;belnr&lt;/P&gt;&lt;P&gt;INNER JOIN lfa1 AS l ON w&lt;SUB&gt;wt_acco = l&lt;/SUB&gt;lifnr&lt;/P&gt;&lt;P&gt;WHERE ( b&lt;SUB&gt;blart = 'OP' OR b&lt;/SUB&gt;blart = 'OT' OR b~blart = 'OE' ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND w~witht = '15' &lt;/P&gt;&lt;P&gt;AND b~blart IN s_blart&lt;/P&gt;&lt;P&gt;AND b~budat IN s_budat&lt;/P&gt;&lt;P&gt;AND b~belnr IN s_belnr&lt;/P&gt;&lt;P&gt;AND b~gjahr IN s_gjahr&lt;/P&gt;&lt;P&gt;AND b~bukrs EQ s_bukrs&lt;/P&gt;&lt;P&gt;AND b~bldat IN s_bldat&lt;/P&gt;&lt;P&gt;AND w~wt_qsshh &amp;lt;&amp;gt; 0&lt;/P&gt;&lt;P&gt;AND w~wt_qbshh &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 17:37:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437108#M1648175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T17:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437109#M1648176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First of all what you can do is you need to revise the where fields order in the where clause... Try using for all entries make sure you have used correct order of fields in where clause as it will hit the primary index and perform faster...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 17:42:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437109#M1648176</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2012-01-04T17:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437110#M1648177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all what you can do is you need to revise the where fields order in the where clause... Try using for all entries make sure you have used correct order of fields in where clause as it will hit the primary index and perform faster...&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Nabheet&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Absolutely incorrect.&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, 04 Jan 2012 18:38:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437110#M1648177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T18:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437111#M1648178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I think breaking the query into independent selects and using for all entries along with primary index if possible will be a better solution. Please let us know if we can correct it in some other way ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 18:45:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437111#M1648178</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2012-01-04T18:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437112#M1648179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The order of the fields in the where is irrelevant. This has been shown many times in these forums.&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, 04 Jan 2012 18:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437112#M1648179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T18:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437113#M1648180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sir It was concerning bkpf if we use in where clause the fields as bukrs belnr gjhar it will then refer to primary index ...is this understanding incorrect..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 18:53:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437113#M1648180</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2012-01-04T18:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437114#M1648181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not necessarily correct. THhe OP is using an IN operator on these fields, so if they are empty, the index will likely not be used. But you said:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;used correct order of fields in where&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The orde of the fields in the where clause doesn't matter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A better answer to the question would be to suggest to the OP to run a trace (ST05) and see what index (probably none) was actually used.&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, 04 Jan 2012 18:59:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437114#M1648181</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T18:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437115#M1648182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob for the clarifications:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 19:01:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437115#M1648182</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2012-01-04T19:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437116#M1648183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok lets concentrate on romero's problem. shall we &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; we had enough discussion on this in SDN. nabheet, just scroll though them when you are free.. i know you are a busy guy...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;romeo,&lt;/P&gt;&lt;P&gt;i would suggest to break down the query,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. select from BKPF, here keep the key field(combination) only in the where clause and take out the nonkey fields&lt;/P&gt;&lt;P&gt;after the select statement(into table lt_bkpf) , use delete lt_bkpf where &amp;lt;non key field&amp;gt; NE s_&amp;lt;fields&amp;gt;(what ever u have)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. select from with_item with a for all entries in lt_bkpf only with belnr(or add key fields if you have any, i am not infront of sap write now). again follow the delete for non key fields as described in step 1.&lt;/P&gt;&lt;P&gt;and what is this?? avoid writing these&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; AND w~wt_qsshh &amp;lt;&amp;gt; 0&lt;/P&gt;&lt;P&gt;&amp;gt; AND w~wt_qbshh &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. selecting entries from LFA1.&lt;/P&gt;&lt;P&gt;just copy lt_withit to another internal table lt_withit_temp. sort lt_withit_temp by wt_acco. then delete adjacent duplicates from lt_withit_temp comparing wt_acco. so you have unique wt_acco values now&lt;/P&gt;&lt;P&gt;now hit LFA1 with for all entries in lt_withit_temp where lifnr = lt_withit_temp-wt_acco&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try these and let me know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 19:43:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437116#M1648183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T19:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437117#M1648184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope - that's wrong too &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Given that the OP hasn't given enough information (the trace) to give a good answer, I would only suggest trying:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT b~budat b~belnr b~blart w~wt_qsshh w~qsatz
       w~wt_qbshh w~ctnumber w~wt_acco w~wt_withcd
       l~stcd1 l~stcd3 l~fityp

INTO CORRESPONDING FIELDS OF TABLE itab_rets

FROM with_item AS w
  INNER JOIN bkpf AS b ON w~belnr = b~belnr
  INNER JOIN lfa1 AS l ON w~wt_acco = l~lifnr
  WHERE ( b~blart = 'OP' OR b~blart = 'OT' OR b~blart = 'OE' )

  AND w~witht = '15'
  AND b~blart IN s_blart
  AND b~budat IN s_budat
  AND b~belnr IN s_belnr
  AND b~gjahr IN s_gjahr
  AND b~bukrs EQ s_bukrs
  AND b~bldat IN s_bldat
  AND w~wt_qsshh &amp;lt;&amp;gt; 0
  AND w~wt_qbshh &amp;lt;&amp;gt; 0

  AND b~bstat = space.   &amp;lt;== Add&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I should have added that because of the select-options that could be empty, I don't think this will help much.&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Jan 4, 2012 2:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 19:52:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437117#M1648184</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T19:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437118#M1648185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob, you are the man. i am not doubting what you said but clarify me on one thing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FROM with_item AS w
  INNER JOIN bkpf AS b ON w~belnr = b~belnr
  INNER JOIN lfa1 AS l ON w~wt_acco = l~lifnr&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this means first get the data from W and B, get the combination with you and then hit L .. right? being non distinct, repetitive keys for LFA1, how is this helping performance?&lt;/P&gt;&lt;P&gt;and what is wrong in breaking down the query?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 19:58:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437118#M1648185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T19:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437119#M1648186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My point was that properly constructed joins are faster than for all entries and that &amp;lt;&amp;gt; in the where (if used correctly) will not hurt.&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, 04 Jan 2012 20:03:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437119#M1648186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T20:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437120#M1648187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;agree again, but lets consider a worst case scenario.. ALL the select options are blank :P, now what!! the join will hurt or not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ya so whats fed into where clause really does matter here... So romero, save us from this &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 20:05:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437120#M1648187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T20:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437121#M1648188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at [JOINS vs. FOR ALL ENTRIES - Which Performs Better?|&lt;A class="jive_macro jive_macro_blogpost" href="https://community.sap.com/" __jive_macro_name="blogpost" modifiedtitle="true" __default_attr="43645"&gt;&lt;/A&gt;]. If all select-options were empty I would expect for all entries could be much slower.&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, 04 Jan 2012 20:16:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437121#M1648188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T20:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437122#M1648189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. i have read that. i have some comment specific to this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but before commenting more, lets wait for OP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 20:27:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437122#M1648189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T20:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437123#M1648190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I doubt if that will help. There's plenty of other problems here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But yes, let's wait.&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, 04 Jan 2012 20:33:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437123#M1648190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T20:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437124#M1648191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are 1.8 million entries in BKPF in our system. So, it's a huge table. If you're running your report wide open without any selection options entries in selection screen in any primary key of any of the three tables, it's gonna give you a timeout. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the program with the same input parameters which is giving time out and run &lt;STRONG&gt;SM50&lt;/STRONG&gt; in another session , it will show which table is being read during program run, using that you can figure out which table is taking too long, from that information you'd have to put more restriction in the where condition (on preferably primary keys)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Jeevan Sagar on Jan 4, 2012 4:47 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 21:47:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437124#M1648191</guid>
      <dc:creator>sjeevan</dc:creator>
      <dc:date>2012-01-04T21:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437125#M1648192</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 get records from BKPF table and put one internal table. based on this internal table, get records from WITH_ITEM tables and then LFA1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use theree SELECT statements instead of INNER JOIN statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this one is helps for you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2012 12:09:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437125#M1648192</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-05T12:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437126#M1648193</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;To my point of view, separate SELECT statements will be quicker than one with JOINs. Joining three tables that are as large as these must take that much time. Also, keep the WHERE conditions in the primary key where possible, starting with the leftmost fields - this will significantly limit the number of entries at the beginning of the processing. Moreover, INTO TABLE works faster than INTO CORRESPONDING FIELDS OF TABLE (but note that you have to define local types accordingly). All this is described in TAW* &amp;amp; BC* SAP training courses saying about DB operations performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT budat belnr blart
  FROM bkpf
  INTO TABLE it_bkpf
  WHERE bukrs IN s_bukrs AND
	belnr IN s_belnr AND
	gjahr IN s_gjahr AND
	blart IN s_blart AND
	bldat IN s_bldat AND
	budat IN s_budat.

IF it_bkpf[] IS NOT INITIAL.
  SELECT wt_qsshh qsatz wt_qbshh ctnumber wt_acco wt_withcd
    FROM with_item
    INTO TABLE it_with_item
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs AND
          belnr = it_bkpf-belnr AND
          gjahr = it_bkpf-gjahr AND
	  wt_qsshh = 0 AND
	  wt_wbshh = 0.

  IF it_with_item[] IS NOT INITIAL.
    SELECT stcd1 stcd3 fityp
      FROM lfa1
      INTO TABLE it_lfa1
      FOR ALL ENTRIES IN it_with_item
      WHERE lifnr = it_with_item-wt_acco.
  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2012 13:40:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437126#M1648193</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-05T13:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with BKPF SELECT.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437127#M1648194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest trying to add BUKRS (for performance) and GJAHR (for correct results) to the ON-conditions between WITH_ITEM and BKPF first, as well as the BSTAT addition to the WHERE-clause as suggested by Rob, and only if that doesn't help, twist the code around altogether based on other suggestions in this thread.&lt;/P&gt;&lt;P&gt;Joins work very well when constructed properly, the CBO can decide at runtime about the best access path (e.g. based on filled selection criteria), rather than the developer trying to be smarter by hard-coding a fixed path via FAE-contructs.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2012 13:57:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bkpf-select/m-p/8437127#M1648194</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2012-01-05T13:57:22Z</dc:date>
    </item>
  </channel>
</rss>

