<?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: Need an optimized version for my code. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492203#M228874</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How many records are we talking about here? How many records could there be in IT_BSIS_BSAS.  If not that many, you will not see a difference in performance.  You might want to focus your attention to the SELECT statements and make sure that they are optimized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another thing, instead of deleting out the records after building IT_WAERS, you can just not add them if it already exists. Inside your loop, read the IT_WAERS with key using BINARY SEARCH, if you get a hit, don't add it.  Then you don't need to delete duplicates after the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Aug 2006 02:06:01 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-08-18T02:06:01Z</dc:date>
    <item>
      <title>Need an optimized version for my code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492201#M228872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently enhancing my report so that when we transport it to production it will &lt;/P&gt;&lt;P&gt;optimized at its best. In one part of my report, there is this code inside a method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_bsis_bsas&amp;gt; LIKE LINE OF it_bsis_bsas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  get currency&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    LOOP AT it_bsis_bsas ASSIGNING &amp;lt;fs_bsis_bsas&amp;gt;.&lt;/P&gt;&lt;P&gt;      MOVE &amp;lt;fs_bsis_bsas&amp;gt;-waers TO wa_waers.&lt;/P&gt;&lt;P&gt;      APPEND wa_waers TO it_waers.&lt;/P&gt;&lt;P&gt;      &amp;lt;fs_bsis_bsas&amp;gt;-year_dum = &amp;lt;fs_bsis_bsas&amp;gt;-bldat+0(4).&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT it_waers BY waers.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM it_waers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, it gets the currencies from table it_bsis_bsas and puts them in a new itab. But&lt;/P&gt;&lt;P&gt;it loops through duplicate currencies and I only need to get one for each currency. &lt;/P&gt;&lt;P&gt;As you can see I am just deleting duplicate values using the DELETE ADJACENT statement.&lt;/P&gt;&lt;P&gt;Is there a faster alternative to this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, In the loop I am moving the waers to a work area then appending it to the itab.&lt;/P&gt;&lt;P&gt;I is there a way to use field-symbols here so theres no need to for the append statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comments and suggestions will be appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 01:58:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492201#M228872</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-08-18T01:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need an optimized version for my code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492202#M228873</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;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get currency&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT it_bsis_bsas ASSIGNING &amp;lt;fs_bsis_bsas&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;AT NEW &amp;lt;fs_bsis_bsas&amp;gt;-waers.&amp;lt;/b&amp;gt;MOVE &amp;lt;fs_bsis_bsas&amp;gt;-waers TO wa_waers.&lt;/P&gt;&lt;P&gt;APPEND wa_waers TO it_waers.&lt;/P&gt;&lt;P&gt;&amp;lt;fs_bsis_bsas&amp;gt;-year_dum = &amp;lt;fs_bsis_bsas&amp;gt;-bldat+0(4).&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ENDAT.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT it_waers BY waers.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;*DELETE ADJACENT DUPLICATES FROM it_waers. "Commented&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 02:02:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492202#M228873</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-18T02:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need an optimized version for my code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492203#M228874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How many records are we talking about here? How many records could there be in IT_BSIS_BSAS.  If not that many, you will not see a difference in performance.  You might want to focus your attention to the SELECT statements and make sure that they are optimized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another thing, instead of deleting out the records after building IT_WAERS, you can just not add them if it already exists. Inside your loop, read the IT_WAERS with key using BINARY SEARCH, if you get a hit, don't add it.  Then you don't need to delete duplicates after the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 02:06:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492203#M228874</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-18T02:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need an optimized version for my code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492204#M228875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the helpful replies. the records really depends on the selection of the user. It can go from 100 records to a thousand. Below are the select statements in the report:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selection screen                             *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_bukrs TYPE t001-bukrs OBLIGATORY,&lt;/P&gt;&lt;P&gt;            p_asof  TYPE bsis-budat OBLIGATORY,&lt;/P&gt;&lt;P&gt;            p_year  TYPE bsis-gjahr OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: s_hkont FOR bsis-hkont NO INTERVALS OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    PERCENTAGE       = 0&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       text             = 'Getting data...'&lt;/P&gt;&lt;P&gt;              .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  get records from BSIS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT hkont zuonr gjahr belnr waers bldat blart dmbtr wrbtr shkzg&lt;/P&gt;&lt;P&gt;    FROM bsis&lt;/P&gt;&lt;P&gt;    INTO  CORRESPONDING FIELDS OF TABLE it_bsis_bsas&lt;/P&gt;&lt;P&gt;    WHERE bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;      AND hkont IN s_hkont&lt;/P&gt;&lt;P&gt;      AND budat &amp;lt;= p_asof.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  get records from BSAS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT hkont zuonr gjahr belnr waers bldat blart dmbtr wrbtr shkzg&lt;/P&gt;&lt;P&gt;    FROM bsas&lt;/P&gt;&lt;P&gt;    APPENDING CORRESPONDING FIELDS OF TABLE it_bsis_bsas&lt;/P&gt;&lt;P&gt;    WHERE bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;      AND hkont IN s_hkont&lt;/P&gt;&lt;P&gt;      AND budat &amp;lt;= p_asof&lt;/P&gt;&lt;P&gt;      AND augdt &amp;gt; p_asof.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  if itab has no records, raise event&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF it_bsis_bsas[] IS INITIAL.&lt;/P&gt;&lt;P&gt;      RAISE EVENT no_data EXPORTING hkont = s_hkont-low.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 02:20:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492204#M228875</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-08-18T02:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need an optimized version for my code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492205#M228876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;iF YOU HAVE YOUR TABLE DEFINED LIKE THIS:&lt;/P&gt;&lt;P&gt;data it_waers type sorted table of ty_waers with unique key waers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yOU CAN:&lt;/P&gt;&lt;P&gt;INSERT WA_WAERS INTO TABLE IT_WAERS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will only insert one entry per currency. Duplicates will not happen and it will not fall over when they are attempted to be added. So you don't need to sort or remove adj duplicates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 02:42:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-an-optimized-version-for-my-code/m-p/1492205#M228876</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2006-08-18T02:42:11Z</dc:date>
    </item>
  </channel>
</rss>

