<?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: Slow Report in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096926#M102345</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Earlier, I posted an &lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="650769"&gt;&lt;/A&gt; of how to do this and the performance boost you can get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Dec 2005 16:29:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-12T16:29:24Z</dc:date>
    <item>
      <title>Slow Report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096924#M102343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have inherited a program that produces a list in such a manner that an itab with usually about 150,000 records has a nested loop within another itab usually containing about the same number of recs. I have successfully lessened the processing time for some other programs doing similar processing, but this one isn't quite the same. Any suggestions on how to speed up the following code.  Your comments are greatly appreciated, as the report is taking many hours to run because of this part of the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   LOOP AT i_state INTO wa_i_state.&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;     IF wa_i_state-rfarea = '1'.&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;       LOOP AT i_pl_lob_rec INTO wa_i_pl_lob_rec&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                            WHERE bukrs    = wa_i_state-bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND racct    = wa_i_state-racct&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND rprctr   = wa_i_state-rprctr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND zzreint  = wa_i_state-zzreint&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND rfarea   = wa_i_state-rfarea&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND rzzregio = wa_i_state-rzzregio.&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;         lob_total = lob_total + wa_i_pl_lob_rec-hsl.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       ENDLOOP.&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;     ELSE.&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;       LOOP AT i_wp_lob_rec INTO wa_i_wp_lob_rec&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                             WHERE bukrs    = wa_i_state-bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND racct    = wa_i_state-racct&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND rprctr   = wa_i_state-rprctr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND zzreint  = wa_i_state-zzreint&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND rfarea   = wa_i_state-rfarea&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              AND rzzregio = wa_i_state-rzzregio.&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;         lob_total = lob_total + wa_i_wp_lob_rec-hsl.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       ENDLOOP.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     ENDIF.&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;     difference = wa_i_state-hsl - lob_total.&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;     WRITE AT  /2 wa_i_state-bukrs.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT   9 wa_i_state-racct.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  21 wa_i_state-rprctr.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  34 wa_i_state-zzreint.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  42 wa_i_state-rfarea.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  49 wa_i_state-rzzregio.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  55 wa_i_state-rzzlob.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  68(20) wa_i_state-hsl.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT  90(20) lob_total.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     WRITE AT 112(20) difference.&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;     CLEAR: lob_total.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ENDLOOP.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is how I sped up processing time with another program, but it didn't contain a conditional like the above code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT i_lob INTO wa_i_lob WHERE rfarea = '1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      AT END OF racct.&lt;/P&gt;&lt;P&gt;        SUM.&lt;/P&gt;&lt;P&gt;        wa_i_report_rec-bukrs     = wa_i_lob-bukrs.&lt;/P&gt;&lt;P&gt;        wa_i_report_rec-racct     = wa_i_lob-racct.&lt;/P&gt;&lt;P&gt;        wa_i_report_rec-offsethsl = wa_i_lob-hsl.&lt;/P&gt;&lt;P&gt;        APPEND wa_i_report_rec TO i_report_rec.&lt;/P&gt;&lt;P&gt;      ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT i_allocs INTO wa_i_allocs.&lt;/P&gt;&lt;P&gt;      CLEAR: wa_i_allocs-docty, wa_i_allocs-docnr, wa_i_allocs-docln,&lt;/P&gt;&lt;P&gt;             wa_i_allocs-sgtxt, wa_i_allocs-budat, wa_i_allocs-poper,&lt;/P&gt;&lt;P&gt;             wa_i_allocs-ryear, wa_i_allocs-glx_budat, wa_i_allocs-bukrs,&lt;/P&gt;&lt;P&gt;             wa_i_allocs-usnam, wa_i_allocs-rtcur, wa_i_allocs-lcurr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      wa_i_report_rec-aemyhsl = wa_i_report_rec-aemyhsl +&lt;/P&gt;&lt;P&gt;                                wa_i_allocs-hsl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      AT END OF racct.&lt;/P&gt;&lt;P&gt;        wa_i_report_rec-racct    = wa_i_allocs-racct.&lt;/P&gt;&lt;P&gt;        MULTIPLY wa_i_report_rec-aemyhsl BY -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        MODIFY TABLE i_report_rec FROM wa_i_report_rec&lt;/P&gt;&lt;P&gt;                                  TRANSPORTING aemyhsl.&lt;/P&gt;&lt;P&gt;        CLEAR wa_i_report_rec-aemyhsl.&lt;/P&gt;&lt;P&gt;      ENDAT.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT i_report_rec INTO wa_i_report_rec.&lt;/P&gt;&lt;P&gt;      wa_i_report_rec-diffhsl = wa_i_report_rec-offsethsl +&lt;/P&gt;&lt;P&gt;                                 wa_i_report_rec-aemyhsl.&lt;/P&gt;&lt;P&gt;      MODIFY TABLE i_report_rec FROM wa_i_report_rec&lt;/P&gt;&lt;P&gt;                                TRANSPORTING diffhsl.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF NOT i_report_rec IS INITIAL.&lt;/P&gt;&lt;P&gt;      CREATE OBJECT offset_grid&lt;/P&gt;&lt;P&gt;             EXPORTING i_parent = offset_container.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SET SCREEN 100.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2005 16:12:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096924#M102343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-12T16:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Slow Report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096925#M102344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace the nested loops with binary reads (to get the first matching record) add 1 to the index of that record to get the next matching record. Keep adding 1 and doing indexed reads until either the key changes or you run out of records. This is the most efficient way to get rid of nested loops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2005 16:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096925#M102344</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-12T16:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Slow Report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096926#M102345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Earlier, I posted an &lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="650769"&gt;&lt;/A&gt; of how to do this and the performance boost you can get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2005 16:29:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096926#M102345</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-12T16:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Slow Report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096927#M102346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rob. This works well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2005 19:20:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096927#M102346</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-12T19:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Slow Report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096928#M102347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you ask most developers how to tune a report, they'll concentrate on the SELECT statements, but in my experience, nested loops over large tables can be far worse.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2005 19:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/slow-report/m-p/1096928#M102347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-12T19:35:33Z</dc:date>
    </item>
  </channel>
</rss>

