<?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: BW End Routine Logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312966#M1636628</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;Why wouldn't you simply execute this sort statement before the main processing loop and add the logic for ZCUST into the loop with the temporary copy of the internal table?  Looking at your code it appears you are executing this sort for every loop pass instead of doing it once and continually reading the records in sorted order.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort TEMP_RESULT_PACKAGE by DIVISION DISTR_CHAN SALESORG CUST_SALES /BIC/ZBRO /BIC/ZSREP /BIC/ZREMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ryan Crosby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Dec 2011 13:16:43 GMT</pubDate>
    <dc:creator>Ryan-Crosby</dc:creator>
    <dc:date>2011-12-05T13:16:43Z</dc:date>
    <item>
      <title>BW End Routine Logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312964#M1636626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have written the following BW end routine but performance is too slow because of the number of loops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have introduced the third loop since we need the records in the specific order to populate ZCUST. Can someone advise on how I can optimize - can I get the results without introducing the third loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$ begin of routine - insert your code only below this line -&lt;/P&gt;&lt;P&gt;data: TEMP_RESULT_PACKAGE like RESULT_PACKAGE,&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE type &lt;U&gt;TY&lt;/U&gt;S_TG_1,&lt;/P&gt;&lt;P&gt;WA type &lt;U&gt;TY&lt;/U&gt;S_TG_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEMP_RESULT_PACKAGE] = RESULT_PACKAGE[.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from RESULT_PACKAGE&lt;/P&gt;&lt;P&gt;comparing DIVISION DISTR_CHAN SALESORG CUST_SALES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at RESULT_PACKAGE into WA_RESULT_PACKAGE.&lt;/P&gt;&lt;P&gt;clear WA.&lt;/P&gt;&lt;P&gt;loop at TEMP_RESULT_PACKAGE into WA&lt;/P&gt;&lt;P&gt;where DIVISION = WA_RESULT_PACKAGE-DIVISION&lt;/P&gt;&lt;P&gt;and DISTR_CHAN = WA_RESULT_PACKAGE-DISTR_CHAN&lt;/P&gt;&lt;P&gt;and SALESORG = WA_RESULT_PACKAGE-SALESORG&lt;/P&gt;&lt;P&gt;and CUST_SALES = WA_RESULT_PACKAGE-CUST_SALES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-SHIP_TO is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-SHIP_TO = WA-SHIP_TO.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if not WA-CUST_HIE01 is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-CUST_HIE01 = WA-CUST_HIE01.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-CUST_HIE02 is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-BILLTOPRTY is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-BILLTOPRTY = WA-BILLTOPRTY.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-PAYER is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-PAYER = WA-PAYER.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-/BIC/OSSLSREP is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-/BIC/ZSREP = WA-/BIC/ZSREP.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-/BIC/OSBRO is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-/BIC/ZBRO = WA-/BIC/ZBRO.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-/BIC/OSCTREMP is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-/BIC/ZREMP = WA-/BIC/ZREMP.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not WA-/BIC/OSOPR is initial.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-/BIC/ZPRI = WA-/BIC/ZPRI.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;sort TEMP_RESULT_PACKAGE by DIVISION DISTR_CHAN SALESORG CUST_SALES /BIC/ZBRO /BIC/ZSREP /BIC/ZREMP.&lt;/P&gt;&lt;P&gt;clear WA.&lt;/P&gt;&lt;P&gt;loop at TEMP_RESULT_PACKAGE into WA&lt;/P&gt;&lt;P&gt;where DIVISION = WA_RESULT_PACKAGE-DIVISION&lt;/P&gt;&lt;P&gt;and DISTR_CHAN = WA_RESULT_PACKAGE-DISTR_CHAN&lt;/P&gt;&lt;P&gt;and SALESORG = WA_RESULT_PACKAGE-SALESORG&lt;/P&gt;&lt;P&gt;and CUST_SALES = WA_RESULT_PACKAGE-CUST_SALES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT WA-/BIC/ZCUST IS INITIAL.&lt;/P&gt;&lt;P&gt;WA_RESULT_PACKAGE-/bic/ZCUST = WA-/BIC/ZCUST.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;modify RESULT_PACKAGE from WA_RESULT_PACKAGE.&lt;/P&gt;&lt;P&gt;clear WA_RESULT_PACKAGE.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Dec 2011 18:09:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312964#M1636626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-04T18:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: BW End Routine Logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312965#M1636627</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;I have to suggestions for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. use typed field-symbols for every loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I try to understand, what you are doing: you will at least be sure, that every necessary/key infoobject is filled with the same value from your result_package. &lt;/P&gt;&lt;P&gt;I would try to separate it in two steps: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  1) build up your temp_result_package and make your assignments. &lt;/P&gt;&lt;P&gt;  2) do only a efficient read-table (sorted/hashed with key DIVISION DISTR_CHAN SALESORG CUST_SALES /BIC/ZBRO /BIC/ZSREP /BIC/ZREMP and field-symbols) on your inside your loop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. by using field-symbols, your modify table is obsolete and costs a lot of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Hendrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2011 10:05:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312965#M1636627</guid>
      <dc:creator>hendrik_brandes</dc:creator>
      <dc:date>2011-12-05T10:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: BW End Routine Logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312966#M1636628</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;Why wouldn't you simply execute this sort statement before the main processing loop and add the logic for ZCUST into the loop with the temporary copy of the internal table?  Looking at your code it appears you are executing this sort for every loop pass instead of doing it once and continually reading the records in sorted order.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort TEMP_RESULT_PACKAGE by DIVISION DISTR_CHAN SALESORG CUST_SALES /BIC/ZBRO /BIC/ZSREP /BIC/ZREMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ryan Crosby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2011 13:16:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bw-end-routine-logic/m-p/8312966#M1636628</guid>
      <dc:creator>Ryan-Crosby</dc:creator>
      <dc:date>2011-12-05T13:16:43Z</dc:date>
    </item>
  </channel>
</rss>

