<?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: Help to improve code and performance in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481303#M1418984</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;This is my code i do it in chunk for 100 users since i dont want to &lt;STRONG&gt;upload the memory&lt;/STRONG&gt; all the table content of the table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DO.
  APPEND LINES OF it_unq_bnames
  FROM lv_from_index TO lv_to_index TO lt_chunk_table.
  IF lt_chunk_table IS INITIAL .
    EXIT.
  ENDIF.
*---------
  SELECT *
  FROM ztst_rs_data
  INTO TABLE lt_copy_db
  FOR ALL ENTRIES IN lt_chunk_table
  WHERE bname = lt_chunk_table-bname.

  IF sy-subrc = 0."The entry already exist in the DB
*    Check if there is no new user in the table .
    LOOP AT lt_chunk_table INTO ls_chunk_table.
      READ TABLE lt_copy_db ASSIGNING &amp;lt;fs_copy_db&amp;gt; WITH KEY bname = ls_chunk_table-bname.
      IF sy-subrc NE 0.
        LOOP AT it_rs_final_usrs_data ASSIGNING &amp;lt;fs_rs_finl&amp;gt;
                 WHERE bname = ls_chunk_table-bname.

          MOVE-CORRESPONDING &amp;lt;fs_rs_finl&amp;gt; TO ls_modif_rs.
          APPEND ls_modif_rs TO lt_modif_rs.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
*   Update the old records


    LOOP AT lt_chunk_table INTO ls_chunk_table.
      LOOP AT it_rs_final_usrs_data ASSIGNING &amp;lt;fs_rs_finl&amp;gt; WHERE bname = ls_chunk_table-bname.
        READ TABLE lt_copy_db ASSIGNING &amp;lt;fs_copy_db&amp;gt; WITH KEY
           bname = &amp;lt;fs_rs_finl&amp;gt;-bname
           extid = &amp;lt;fs_rs_finl&amp;gt;-extid
           agr_name = &amp;lt;fs_rs_finl&amp;gt;-agr_name
           consumer_type = &amp;lt;fs_rs_finl&amp;gt;-consumer_type.

        IF sy-subrc NE 0.
          MOVE-CORRESPONDING &amp;lt;fs_rs_finl&amp;gt; TO ls_modif_rs.
*        ls_modif_rs-valid = abap_false.
          APPEND ls_modif_rs TO lt_modif_rs.
        ENDIF.
      ENDLOOP.
    ENDLOOP.

  ELSE.
    APPEND LINES OF lt_chunk_table TO lt_modif_rs."New users
  ENDIF.

  MODIFY zt_rs_data FROM TABLE lt_modif_rs.
*---------Update indexs
  lv_from_index = lv_to_index + 1.
  lv_to_index = lv_to_index + lc_size.
  CLEAR lt_chunk_table.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: James Herb on Jan 14, 2010 10:46 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jan 2010 08:21:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-14T08:21:51Z</dc:date>
    <item>
      <title>Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481302#M1418983</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;I facing an perfomance probelm With my program and i want your help to give me &lt;/P&gt;&lt;P&gt;Ideas how to do that in better way .&lt;/P&gt;&lt;P&gt; have table with records in DB which i need to modify from internal table via job.&lt;/P&gt;&lt;P&gt;1. if we start from scratch (fill the db table in the first time ) all the records should be valid (column valid mark as abap_true) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.next run if user new data (Roles ) will arrive to the table the records should be valid automatically &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.  if some records are not occur in the next run of the job the record in the table should be not valid (One role for user or if user user is not exist in itab table job all the roles should &lt;/P&gt;&lt;P&gt;be marked as invalid ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I improve my code the KPI is for 100000 users .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I give Simple example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the first run i have users in the itab ( Job that update the db) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;users roles valid_flag &lt;/P&gt;&lt;P&gt;user1  rol1     X&lt;/P&gt;&lt;P&gt;user1  rol2     X&lt;/P&gt;&lt;P&gt;user1  rol3     X&lt;/P&gt;&lt;P&gt;user2  rol1     X&lt;/P&gt;&lt;P&gt;user2  rol2     X&lt;/P&gt;&lt;P&gt;user2  rol3     X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This what I have in the internal table and what should be in the db table also .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume that the job in the next run I have in the itab that update the table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user1   rol1  X&lt;/P&gt;&lt;P&gt;user1   rol2  X&lt;/P&gt;&lt;P&gt;user1   rol4  X&lt;/P&gt;&lt;P&gt;user2   rol1  X&lt;/P&gt;&lt;P&gt;user2   rol5  X&lt;/P&gt;&lt;P&gt;user2   rol6  X&lt;/P&gt;&lt;P&gt;user3   rol1  X&lt;/P&gt;&lt;P&gt;user3   rol5  X&lt;/P&gt;&lt;P&gt;user3   rol3  X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so after the following run the DB table should look like .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;users roles valid_flag &lt;/P&gt;&lt;P&gt;user1 rol1 X&lt;/P&gt;&lt;P&gt;user1 rol2 X&lt;/P&gt;&lt;P&gt;user1 rol3 &lt;/P&gt;&lt;P&gt;user1 rol4 X&lt;/P&gt;&lt;P&gt;user2 rol1 X&lt;/P&gt;&lt;P&gt;user2 rol2 &lt;/P&gt;&lt;P&gt;user2 rol3 &lt;/P&gt;&lt;P&gt;user2 rol5 X&lt;/P&gt;&lt;P&gt;user2 rol6 X&lt;/P&gt;&lt;P&gt;user3 rol1 X&lt;/P&gt;&lt;P&gt;user3 rol5 X&lt;/P&gt;&lt;P&gt;user3 rol3 X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The old records are not deleted there are just mark as not valid and if we have new records &lt;/P&gt;&lt;P&gt;they are inserted to the table with valid flag .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following post I share my code its working but since i new to abap i think that i can use your advice &lt;/P&gt;&lt;P&gt;maybe to do it in simple way ,keep in mind that its not that simple since there is some edge case in this issue .&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;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 08:17:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481302#M1418983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T08:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481303#M1418984</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;This is my code i do it in chunk for 100 users since i dont want to &lt;STRONG&gt;upload the memory&lt;/STRONG&gt; all the table content of the table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DO.
  APPEND LINES OF it_unq_bnames
  FROM lv_from_index TO lv_to_index TO lt_chunk_table.
  IF lt_chunk_table IS INITIAL .
    EXIT.
  ENDIF.
*---------
  SELECT *
  FROM ztst_rs_data
  INTO TABLE lt_copy_db
  FOR ALL ENTRIES IN lt_chunk_table
  WHERE bname = lt_chunk_table-bname.

  IF sy-subrc = 0."The entry already exist in the DB
*    Check if there is no new user in the table .
    LOOP AT lt_chunk_table INTO ls_chunk_table.
      READ TABLE lt_copy_db ASSIGNING &amp;lt;fs_copy_db&amp;gt; WITH KEY bname = ls_chunk_table-bname.
      IF sy-subrc NE 0.
        LOOP AT it_rs_final_usrs_data ASSIGNING &amp;lt;fs_rs_finl&amp;gt;
                 WHERE bname = ls_chunk_table-bname.

          MOVE-CORRESPONDING &amp;lt;fs_rs_finl&amp;gt; TO ls_modif_rs.
          APPEND ls_modif_rs TO lt_modif_rs.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
*   Update the old records


    LOOP AT lt_chunk_table INTO ls_chunk_table.
      LOOP AT it_rs_final_usrs_data ASSIGNING &amp;lt;fs_rs_finl&amp;gt; WHERE bname = ls_chunk_table-bname.
        READ TABLE lt_copy_db ASSIGNING &amp;lt;fs_copy_db&amp;gt; WITH KEY
           bname = &amp;lt;fs_rs_finl&amp;gt;-bname
           extid = &amp;lt;fs_rs_finl&amp;gt;-extid
           agr_name = &amp;lt;fs_rs_finl&amp;gt;-agr_name
           consumer_type = &amp;lt;fs_rs_finl&amp;gt;-consumer_type.

        IF sy-subrc NE 0.
          MOVE-CORRESPONDING &amp;lt;fs_rs_finl&amp;gt; TO ls_modif_rs.
*        ls_modif_rs-valid = abap_false.
          APPEND ls_modif_rs TO lt_modif_rs.
        ENDIF.
      ENDLOOP.
    ENDLOOP.

  ELSE.
    APPEND LINES OF lt_chunk_table TO lt_modif_rs."New users
  ENDIF.

  MODIFY zt_rs_data FROM TABLE lt_modif_rs.
*---------Update indexs
  lv_from_index = lv_to_index + 1.
  lv_to_index = lv_to_index + lc_size.
  CLEAR lt_chunk_table.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: James Herb on Jan 14, 2010 10:46 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 08:21:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481303#M1418984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T08:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481304#M1418985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two areas where most of the time is lost.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Loop inside Loop&lt;/P&gt;&lt;P&gt;2. Read Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Loop inside Loop: That we have to analyze in our own scenario and we can be the best judge whether it is required or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Read Table;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   In your case,  use Read Table BINARY SEARCH. (It will DRASTICALLY Improve the performance).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Before Read Table, Make sure the internal table is sorted by USER and ROLE. (as per your example)&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 10:04:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481304#M1418985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T10:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481305#M1418986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Amit ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes i know that this not good but there is a way to avoid that in my case ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: James Herb on Jan 14, 2010 12:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 11:54:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481305#M1418986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T11:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481306#M1418987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is one point where it can be improved (There are other points also, which I am analyzing in the mean time).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the changes below with @@@@@&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*"@@@@@@  First Sort immediately after your select.
SORT lt_copy_db by bname   extid  agr_name  consumer_type


F sy-subrc = 0."The entry already exist in the DB
*    Check if there is no new user in the table .
    LOOP AT lt_chunk_table INTO ls_chunk_table.
      READ TABLE lt_copy_db ASSIGNING &amp;lt;fs_copy_db&amp;gt; WITH KEY bname = ls_chunk_table-bname.
*"@@@@@@  add the suffix binary search
    BINARY SEARCH.

      IF sy-subrc NE 0.
        LOOP AT it_rs_final_usrs_data ASSIGNING &amp;lt;fs_rs_finl&amp;gt;
                 WHERE bname = ls_chunk_table-bname.
 
          MOVE-CORRESPONDING &amp;lt;fs_rs_finl&amp;gt; TO ls_modif_rs.
          APPEND ls_modif_rs TO lt_modif_rs.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
*   Update the old records
 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am quite sure this will improve the performance. Can you please check if you find feasible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit Mittal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 12:22:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481306#M1418987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T12:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481307#M1418988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Amit ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help expert .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This improve my performance but not dramatically &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From your point of view did you do that different (all the code) ?  for this kind of problem ?&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;James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: James Herb on Jan 14, 2010 1:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 12:56:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481307#M1418988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T12:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481308#M1418989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly, use the same concept in the 2nd part of the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See @@@@&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

 LOOP AT lt_chunk_table INTO ls_chunk_table.
      LOOP AT it_rs_final_usrs_data ASSIGNING &amp;lt;fs_rs_finl&amp;gt; WHERE bname = ls_chunk_table-bname.
        READ TABLE lt_copy_db ASSIGNING &amp;lt;fs_copy_db&amp;gt; WITH KEY
           bname = &amp;lt;fs_rs_finl&amp;gt;-bname
           extid = &amp;lt;fs_rs_finl&amp;gt;-extid
           agr_name = &amp;lt;fs_rs_finl&amp;gt;-agr_name
           consumer_type = &amp;lt;fs_rs_finl&amp;gt;-consumer_type
*"@@@@@@@@@@ 
     BINARY SEARCH.
 
        IF sy-subrc NE 0.
          MOVE-CORRESPONDING &amp;lt;fs_rs_finl&amp;gt; TO ls_modif_rs.
*        ls_modif_rs-valid = abap_false.
          APPEND ls_modif_rs TO lt_modif_rs.
        ENDIF.
      ENDLOOP.
    ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit  m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:02:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481308#M1418989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T13:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481309#M1418990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Amit ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This improvement is little since the table which i copy from DB is&lt;/P&gt;&lt;P&gt;table with 100 records at a time ,&lt;/P&gt;&lt;P&gt;What do you think about all the logic,&lt;/P&gt;&lt;P&gt;Did You handle differently ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  &amp;amp; Regards&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:13:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481309#M1418990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T13:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481310#M1418991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not used your code. BUT, I had also exactly same issue where the number of records was HUGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was also using read table, and loop inside loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I applied the logic of binary search, and BINGO... it reduced the performance DRAMATICALLY.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   You will also notice it when the number of records is high.&lt;/P&gt;&lt;P&gt;   The the logic without binary and with binary and you will know the difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   To check, virtually double..triple... add as many records, to your internal table using abap code, (you can add same duplicate records), and then you can TEST with both the logic. (without going to QA or PRD server). Then you will definitely appreciate the performance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Other over all logic seems to be fine. But I am still analyzing it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:34:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481310#M1418991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T13:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481311#M1418992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;couldn't you simply update all records from your table with valid_flag = space and then modify.&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT lt_value into ls_values. " Here you can make an auxiliar table deleting duplicate users to improve performance.
  UPDATE db_table SET valid_flag = space
    WHERE user = ls_values-user.
ENDLOOP.

MODIFY db_table FROM TABLE lt_value.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another point, where do you get the next execution? Is in another DB Table? If it is, you can try to join this tables to get updated results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Frisoni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:37:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481311#M1418992</guid>
      <dc:creator>guilherme_frisoni</dc:creator>
      <dc:date>2010-01-14T13:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481312#M1418993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Amit ,&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;I wait for your conclusion .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:41:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481312#M1418993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T13:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481313#M1418994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI  Frisoni    	  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish that it was that simple , but its not believe me....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have just one table that need to be update via Job .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:44:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481313#M1418994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T13:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481314#M1418995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Amit ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found bug in my code when i try to enter new users to the table ,&lt;/P&gt;&lt;P&gt;I try to handle it now , what happen is when i add new users i add him duplicate .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: James Herb on Jan 14, 2010 3:07 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 14:05:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481314#M1418995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T14:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481315#M1418996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai &lt;/P&gt;&lt;P&gt;i am also anbeginer i f u want try to create by means of line type and row type  and give that name inthe coding&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 14:48:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481315#M1418996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T14:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help to improve code and performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481316#M1418997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use always subroutines&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 14:59:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-improve-code-and-performance/m-p/6481316#M1418997</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-14T14:59:48Z</dc:date>
    </item>
  </channel>
</rss>

