<?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: Perfomance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988275#M1162057</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see no real performance problem here. What is the rest of the code inside the LOOP?&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, 14 Jan 2009 16:52:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-14T16:52:27Z</dc:date>
    <item>
      <title>Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988274#M1162056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gui's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing performance problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In t_hdr i have 15 fields and in t_item i have 40 fields  I used forall entries but out put is changing &lt;/P&gt;&lt;P&gt;please anybody help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_hdr.&lt;/P&gt;&lt;P&gt;    select buzei buzid koart shkzg mwskz dmbtr hwbas sgtxt vbund kostl&lt;/P&gt;&lt;P&gt;           aufnr anln1 anln2 hkont kunnr lifnr matnr werks ebeln ebelp&lt;/P&gt;&lt;P&gt;           zekkn rewrt prctr txjcd projk&lt;/P&gt;&lt;P&gt;    into (t_item-buzei, t_item-buzid, t_item-koart, t_item-shkzg,&lt;/P&gt;&lt;P&gt;          t_item-mwskz, t_item-dmbtr, t_item-hwbas, t_item-sgtxt,&lt;/P&gt;&lt;P&gt;          t_item-vbund, t_item-kostl, t_item-aufnr, t_item-anln1,&lt;/P&gt;&lt;P&gt;          t_item-anln2, t_item-hkont, t_item-kunnr, t_item-lifnr,&lt;/P&gt;&lt;P&gt;          t_item-matnr, t_item-werks, t_item-ebeln, t_item-ebelp,&lt;/P&gt;&lt;P&gt;          t_item-zekkn, t_item-rewrt, t_item-prctr, t_item-txjcd,&lt;/P&gt;&lt;P&gt;          t_item-projk)&lt;/P&gt;&lt;P&gt;    from bseg&lt;/P&gt;&lt;P&gt;   where bukrs  = t_hdr-bukrs&lt;/P&gt;&lt;P&gt;     and belnr  = t_hdr-belnr&lt;/P&gt;&lt;P&gt;     and gjahr  = t_hdr-gjahr&lt;/P&gt;&lt;P&gt;     and hkont in s_hkont&lt;/P&gt;&lt;P&gt;     and mwskz in s_mwskz&lt;/P&gt;&lt;P&gt;     and kostl in s_kostl&lt;/P&gt;&lt;P&gt;     and prctr in s_prctr&lt;/P&gt;&lt;P&gt;     and werks in s_werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Skip record if not in selection screen range for state&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      check t_item-txjcd(2) in s_state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if t_item-shkzg  = c_debit.  "S&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      if t_item-shkzg  = c_credit. "H&lt;/P&gt;&lt;P&gt;        t_item-dmbtr = t_item-dmbtr * ( -1 ).&lt;/P&gt;&lt;P&gt;        t_item-rewrt = t_item-rewrt * ( -1 ).&lt;/P&gt;&lt;P&gt;        t_item-hwbas = t_item-hwbas * ( -1 ).&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 16:46:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988274#M1162056</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-14T16:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988275#M1162057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see no real performance problem here. What is the rest of the code inside the LOOP?&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, 14 Jan 2009 16:52:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988275#M1162057</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-14T16:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988276#M1162058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob i am send the rest of the code please find it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at t_hdr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select buzei buzid koart shkzg mwskz dmbtr hwbas sgtxt vbund kostl&lt;/P&gt;&lt;P&gt;           aufnr anln1 anln2 hkont kunnr lifnr matnr werks ebeln ebelp&lt;/P&gt;&lt;P&gt;           zekkn rewrt prctr txjcd projk&lt;/P&gt;&lt;P&gt;    into (t_item-buzei, t_item-buzid, t_item-koart, t_item-shkzg,&lt;/P&gt;&lt;P&gt;          t_item-mwskz, t_item-dmbtr, t_item-hwbas, t_item-sgtxt,&lt;/P&gt;&lt;P&gt;          t_item-vbund, t_item-kostl, t_item-aufnr, t_item-anln1,&lt;/P&gt;&lt;P&gt;          t_item-anln2, t_item-hkont, t_item-kunnr, t_item-lifnr,&lt;/P&gt;&lt;P&gt;          t_item-matnr, t_item-werks, t_item-ebeln, t_item-ebelp,&lt;/P&gt;&lt;P&gt;          t_item-zekkn, t_item-rewrt, t_item-prctr, t_item-txjcd,&lt;/P&gt;&lt;P&gt;          t_item-projk)&lt;/P&gt;&lt;P&gt;    from bseg&lt;/P&gt;&lt;P&gt;   where bukrs  = t_hdr-bukrs&lt;/P&gt;&lt;P&gt;     and belnr  = t_hdr-belnr&lt;/P&gt;&lt;P&gt;     and gjahr  = t_hdr-gjahr&lt;/P&gt;&lt;P&gt;     and hkont in s_hkont&lt;/P&gt;&lt;P&gt;     and mwskz in s_mwskz&lt;/P&gt;&lt;P&gt;     and kostl in s_kostl&lt;/P&gt;&lt;P&gt;     and prctr in s_prctr&lt;/P&gt;&lt;P&gt;     and werks in s_werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Skip record if not in selection screen range for state&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      check t_item-txjcd(2) in s_state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if t_item-shkzg  = c_debit.  "S&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      if t_item-shkzg  = c_credit. "H&lt;/P&gt;&lt;P&gt;        t_item-dmbtr = t_item-dmbtr * ( -1 ).&lt;/P&gt;&lt;P&gt;        t_item-rewrt = t_item-rewrt * ( -1 ).&lt;/P&gt;&lt;P&gt;        t_item-hwbas = t_item-hwbas * ( -1 ).&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**&amp;amp;MWB 04/08/2005 ... add additional US Bayer Tax dept requested fields&lt;/P&gt;&lt;P&gt;      clear: t_item-basetax, t_item-accrtax, t_item-vendtax,&lt;/P&gt;&lt;P&gt;             t_item-taxrate, t_item-invbase, t_item-invtax.&lt;/P&gt;&lt;P&gt;**&amp;amp;MWB ... end insert 04/08/2005&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear t_item-hwbas.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      move-corresponding t_hdr to t_item.&lt;/P&gt;&lt;P&gt;      append t_item.&lt;/P&gt;&lt;P&gt;      clear  t_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 17:09:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988276#M1162058</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-14T17:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988277#M1162059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I might be doing SELECT before the loop and then do READ TABLE inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Close duplicate thread.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 17:17:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988277#M1162059</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2009-01-14T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988278#M1162060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is still no real problem. How many records in t_hdr? That's likely the source of any problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you should close the other post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 17:28:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988278#M1162060</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-14T17:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988279#M1162061</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;There are 41 records in t_hdr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 17:36:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988279#M1162061</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-14T17:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988280#M1162062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you think there is a performance problem?&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, 14 Jan 2009 17:38:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988280#M1162062</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-14T17:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Perfomance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988281#M1162063</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;There are couple of things that need to be carefully assessed in your logic.&lt;/P&gt;&lt;P&gt;1. BSEG is a cluster table, doing SELECT .. ENDSELECT will surely have worse performance than SELECT..INTO TABLE.&lt;/P&gt;&lt;P&gt;2. Since BSEG is a cluster table and only have BUKRS, BELNR, GJAHR and BUZEI as it's primary key, it would cost more to use additional key in where condition. The reason is in cluster table, other fields that is not included as primary key will be stored in database as Raw type. Which mean if you put more field in where condition, the selection process will not be executed directly in DB server. SAP application will need to translate that raw data into each fields and do filtering.&lt;/P&gt;&lt;P&gt;3. It is better to do one by one MOVE instead of move corresponding especially if a lot of field involved since there is overhead cost to search field that has the same name before moving the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence, I would suggest the logic be changed into something like below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if t_hdr[] is not initial.
select bukrs belnr gjahr buzei buzid koart shkzg mwskz dmbtr hwbas sgtxt vbund kostl
aufnr anln1 anln2 hkont kunnr lifnr matnr werks ebeln ebelp
zekkn rewrt prctr txjcd projk
into table t_item
from bseg
for all entries in t_hdr
where bukrs = t_hdr-bukrs
and belnr = t_hdr-belnr
and gjahr = t_hdr-gjahr.
*as far as i know, you should use only primary key for selection,
*however you're free to try combine all the selection criteria
*in where condition and compare the performance
    if sy-subrc = 0.
	delete t_item where not hkont in s_hkont.
	delete t_item where not mwskz in s_mwskz.
	delete t_item where not kostl in s_kostl.
	delete t_item where not prctr in s_prctr.
	delete t_item where not werks in s_werks.
    endif.
endif.

loop at t_item assigning &amp;lt;fs_item&amp;gt;.
Skip record if not in selection screen range for state 
  if &amp;lt;fs_item&amp;gt;-txjcd(2) not in s_state.
    delete &amp;lt;fs_item&amp;gt;.
    continue.
  endif.
  if &amp;lt;fs_item&amp;gt;-shkzg = c_credit. "H
    &amp;lt;fs_item&amp;gt;-dmbtr = &amp;lt;fs_item&amp;gt;-dmbtr * ( -1 ).
    &amp;lt;fs_item&amp;gt;-rewrt = &amp;lt;fs_item&amp;gt;-rewrt * ( -1 ).
    &amp;lt;fs_item&amp;gt;-hwbas = &amp;lt;fs_item&amp;gt;-hwbas * ( -1 ).
  endif.
**&amp;amp;MWB 04/08/2005 ... add additional US Bayer Tax dept requested fields
clear: &amp;lt;fs_item&amp;gt;-basetax, &amp;lt;fs_item&amp;gt;-accrtax, &amp;lt;fs_item&amp;gt;-vendtax,
&amp;lt;fs_item&amp;gt;-taxrate, &amp;lt;fs_item&amp;gt;-invbase, &amp;lt;fs_item&amp;gt;-invtax.
**&amp;amp;MWB ... end insert 04/08/2005

clear &amp;lt;fs_item&amp;gt;-hwbas.
*
*assume t_hdr is already sorted by bukr belnr gjahr
read table t_hdr into w_hdr with key bukrs = &amp;lt;fs_item&amp;gt;-bukrs
                                     belnr = &amp;lt;fs_item&amp;gt;-belnr
                                     gjahr = &amp;lt;fs_item&amp;gt;-gjahr
                            binary search.

*move your neccesary header data here
...
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do try it and compare the performance. Hope it's help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abraham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2009 03:23:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/perfomance-issue/m-p/4988281#M1162063</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-15T03:23:12Z</dc:date>
    </item>
  </channel>
</rss>

