<?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: Custom table update is creating performance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888200#M1479604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs&lt;/P&gt;&lt;P&gt;      belnr = wa_bseg-belnr&lt;/P&gt;&lt;P&gt;      gjahr = wa_bseg-gjahr.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the READ MUST use a BINARY SEARCH or better a sorted table !!!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;As all the fields are primary keys, so i think it should not create any issues. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much problem is with Modify statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Don't use the MODIFY, you must figure out, which lines are in the table (UPDATE) and which ones are&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;new, then use the ARRAY changes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODIFY zsaptotoslog FROM TABLE i_zsaptotoslog_ins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your suggestion. Please explain it more, because I am very new in ABAP, so unable to make it out properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nutan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Apr 2010 12:52:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-30T12:52:04Z</dc:date>
    <item>
      <title>Custom table update is creating performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888198#M1479602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These logs were generated on mentioned days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On 23rd April:&lt;/P&gt;&lt;P&gt;09:45:36	@0S@ Finishing numbr BSEG recs is ... 3,562&lt;/P&gt;&lt;P&gt;11:04:32	@08@ 3,562 Transmitted Items stored to ZSAPtoTOSlog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On 27th April:&lt;/P&gt;&lt;P&gt;10:30:29	@0S@ Finishing numbr BSEG recs is ... 14,616&lt;/P&gt;&lt;P&gt;13:36:51	@08@ 14,616 Transmitted Items stored to ZSAPtoTOSlog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per the log for 3,562 records 1hr 15 minutes is taken but for 14,616 records 3 hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ZSAPtoTOSlog is a custom table.&lt;/P&gt;&lt;P&gt; This code is taking a lot time......&lt;/P&gt;&lt;P&gt;FORM f_record_into_log.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      New form for 112443&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Record transmission into LOG database&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update with XBLNR and Todays date&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CLEAR wa_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_bseg INTO wa_bseg.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  At new Company code, doc. number and Fiscal year.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    AT NEW gjahr.&lt;/P&gt;&lt;P&gt;      CLEAR wa_bkpf.&lt;/P&gt;&lt;P&gt;      CLEAR wa_zsaptotoslog_ins.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Read table I_BKPF with key company,number and year.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs&lt;/P&gt;&lt;P&gt;                                              belnr = wa_bseg-belnr&lt;/P&gt;&lt;P&gt;                                              gjahr = wa_bseg-gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     If the record is found&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;        wa_zsaptotoslog_ins-xblnr = wa_bkpf-xblnr.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-mandt = sy-mandt.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-bukrs = wa_bseg-bukrs.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-belnr = wa_bseg-belnr.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-gjahr = wa_bseg-gjahr.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-buzei = wa_bseg-buzei.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-augcp = wa_bseg-augcp.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-augbl = wa_bseg-augbl.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-wrbtr = wa_bseg-wrbtr.&lt;/P&gt;&lt;P&gt;    wa_zsaptotoslog_ins-intdate = v_today.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Add entry into internal table for Log&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    APPEND wa_zsaptotoslog_ins TO i_zsaptotoslog_ins.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MODIFY zsaptotoslog FROM TABLE i_zsaptotoslog_ins.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;commit.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ID 'ZFI_SDF' TYPE 'I' NUMBER 065 WITH icon_green_light&lt;/P&gt;&lt;P&gt;    sy-dbcnt 'Transmitted Items stored to ZSAPtoTOSlog'.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    MESSAGE ID 'ZFI_SDF' TYPE 'I' NUMBER 065 WITH icon_information&lt;/P&gt;&lt;P&gt;    sy-dbcnt 'Transmitted Items stored to ZSAPtoTOSlog'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " f_record_into_log&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me to tune this as it is causing performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nutan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Apr 2010 06:33:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888198#M1479602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-30T06:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Custom table update is creating performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888199#M1479603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is nothing new, you have the usual problems:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT i_bseg INTO wa_bseg.
* At new Company code, doc. number and Fiscal year.
AT NEW gjahr.
CLEAR wa_bkpf.
CLEAR wa_zsaptotoslog_ins.
&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Read table I_BKPF with key company,number and year.
&amp;gt;&amp;gt;&amp;gt;&amp;gt; READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs
&amp;gt;&amp;gt;&amp;gt;&amp;gt;       belnr = wa_bseg-belnr
&amp;gt;&amp;gt;&amp;gt;&amp;gt;       gjahr = wa_bseg-gjahr.
* the READ MUST use a BINARY SEARCH or better a sorted table !!!

* If the record is found

....

*Don't use the MODIFY, you must figure out, which lines are in the table (UPDATE) and which ones are
* new, then use the ARRAY changes
MODIFY zsaptotoslog FROM TABLE i_zsaptotoslog_ins.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Apr 2010 07:28:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888199#M1479603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-30T07:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom table update is creating performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888200#M1479604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs&lt;/P&gt;&lt;P&gt;      belnr = wa_bseg-belnr&lt;/P&gt;&lt;P&gt;      gjahr = wa_bseg-gjahr.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the READ MUST use a BINARY SEARCH or better a sorted table !!!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;As all the fields are primary keys, so i think it should not create any issues. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much problem is with Modify statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Don't use the MODIFY, you must figure out, which lines are in the table (UPDATE) and which ones are&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;new, then use the ARRAY changes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODIFY zsaptotoslog FROM TABLE i_zsaptotoslog_ins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your suggestion. Please explain it more, because I am very new in ABAP, so unable to make it out properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nutan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Apr 2010 12:52:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888200#M1479604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-30T12:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Custom table update is creating performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888201#M1479605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Siegfried: * the READ MUST use a BINARY SEARCH or better a sorted table !!!&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; As all the fields are primary keys, so i think it should not create any issues. &lt;/P&gt;&lt;P&gt;&amp;gt; Nutan&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remember you are talking about an INTERNAL table here. Have you declared it as SORTED table? If not you'll have the performance issues Siegfried is describing. Please post here how you declared i_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; As all the fields are primary keys, so i think it should not create any issues. &lt;/P&gt;&lt;P&gt;&amp;gt; Much problem is with Modify statement.&lt;/P&gt;&lt;P&gt;&amp;gt; Nutan&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From my experience much time is spent optimizing because one &lt;STRONG&gt;thinks&lt;/STRONG&gt; and &lt;STRONG&gt;assumes&lt;/STRONG&gt; the problem is somewhere and often it's somewhere else. The rule is don't &lt;EM&gt;think&lt;/EM&gt;: measure it (with SE30, for example) and then you can be sure and optimize what really needs to be optimized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rui Dantas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Apr 2010 14:19:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888201#M1479605</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2010-04-30T14:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Custom table update is creating performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888202#M1479606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nutan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general, if you have a large number of entries in internal tables (hundred is a large number in this case) and you want to avoid performance issues, &lt;STRONG&gt;do not use internal table of type STANDARD&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Therefore we suggest to use sorted tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: i_bkpf type sorted table of bkpf
             with unique key bukrs belnr gjahr,
      i_bseg type sorted table of bseg
             with unique key bukrs belnr gjahr buzei.

field-symbols: &amp;lt;bkpf&amp;gt; type bkfp,
               &amp;lt;bseg&amp;gt; type bseg.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additionally, do not use LOOP itab INTO or READ TABLE itab INTO, but ASSIGNING field symbol (pointer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at i_bseg assigning &amp;lt;bseg&amp;gt;.
...
  read table i_bkpf assigning &amp;lt;bkpf&amp;gt;
       with table key bukrs = &amp;lt;bseg&amp;gt;-bukrs
                      belnr = &amp;lt;bseg&amp;gt;-belnr
                      gjahr = &amp;lt;bseg&amp;gt;-gjahr.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And finally, do not use MODIFY, but INSERT, if you know the table entries do not exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  insert zsaptotoslog FROM TABLE i_zsaptotoslog_ins.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let us know by how much your runtime improved with those changes &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yep&lt;/P&gt;&lt;P&gt;Jürgen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: sattlerj on May 3, 2010 2:23 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: sattlerj on May 3, 2010 2:24 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 02:22:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888202#M1479606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-03T02:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Custom table update is creating performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888203#M1479607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;changed the modify statement to insert. It worked fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Oct 2010 12:28:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/custom-table-update-is-creating-performance-issue/m-p/6888203#M1479607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-19T12:28:45Z</dc:date>
    </item>
  </channel>
</rss>

