<?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 Help in Optimizing code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217769#M135355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts, I have a function module that runs so slow, I just want to seek some advice to help me have a better performance speed what can I used and alternatives to make my codes faster... any advice can help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Heres my &amp;lt;b&amp;gt; code &amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Declaration&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION-POOL YXBW_0PRODORDER_ATTR.         "MESSAGE-ID ..&lt;/P&gt;&lt;P&gt;TYPE-POOLS: RSAP, RSSG, SRSC, SRSD, RSAOT, RSFH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ippord_bw LIKE ppord_bw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : itabix LIKE sy-tabix.&lt;/P&gt;&lt;P&gt;DATA : V_OBJNR LIKE JEST-OBJNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF i_data_temp OCCURS 0.&lt;/P&gt;&lt;P&gt;        INCLUDE STRUCTURE ppord_bw.&lt;/P&gt;&lt;P&gt;DATA : END OF i_data_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  begin of i_jest_obj occurs 0,&lt;/P&gt;&lt;P&gt; objnr like jest-objnr,&lt;/P&gt;&lt;P&gt; end of i_jest_obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;*TYPES Declaration             *&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_afpo,&lt;/P&gt;&lt;P&gt;         aufnr LIKE afpo-aufnr, "Order Number&lt;/P&gt;&lt;P&gt;         plnum LIKE afpo-plnum, "Planned order number&lt;/P&gt;&lt;P&gt;         psamg LIKE afpo-psamg, "Scrap quantity in item&lt;/P&gt;&lt;P&gt;         psmng LIKE afpo-psmng, "Order item quantity&lt;/P&gt;&lt;P&gt;         wemng LIKE afpo-wemng, "Quantity of goods for the order item&lt;/P&gt;&lt;P&gt;         amein LIKE afpo-amein, "Unit of measure for in-house production&lt;/P&gt;&lt;P&gt;         meins LIKE afpo-meins, "Base unit of measure&lt;/P&gt;&lt;P&gt;         pamng LIKE afpo-pamng, "Fixed quantity of scrap from production&lt;/P&gt;&lt;P&gt;         pgmng LIKE afpo-pgmng, "Total planned order quantity&lt;/P&gt;&lt;P&gt;         ablad LIKE afpo-ablad, "Unloading point&lt;/P&gt;&lt;P&gt;        END OF t_afpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:  BEGIN OF t_afko,&lt;/P&gt;&lt;P&gt;         aufnr LIKE afko-aufnr, "Order Number&lt;/P&gt;&lt;P&gt;         gltrp LIKE afko-gltrp, "Basic finish date&lt;/P&gt;&lt;P&gt;         gstrp LIKE afko-gstrp, "Basic start date&lt;/P&gt;&lt;P&gt;         ftrms LIKE afko-ftrms, "Scheduled release date&lt;/P&gt;&lt;P&gt;         gltrs LIKE afko-gltrs, "Scheduled finish&lt;/P&gt;&lt;P&gt;         gstrs LIKE afko-gstrs, "Scheduled start&lt;/P&gt;&lt;P&gt;         gstri LIKE afko-gstri, "Actual start date&lt;/P&gt;&lt;P&gt;         gltri LIKE afko-gltri, "Actual finish date&lt;/P&gt;&lt;P&gt;         ftrmi LIKE afko-ftrmi, "Actual release date&lt;/P&gt;&lt;P&gt;         gmein LIKE afko-gmein, "Base unit of measure&lt;/P&gt;&lt;P&gt;         plnty LIKE afko-plnty, "Task list type&lt;/P&gt;&lt;P&gt;         plnnr LIKE afko-plnnr, "Key for task groupKey&lt;/P&gt;&lt;P&gt;         plnal LIKE afko-plnal, "Group counter&lt;/P&gt;&lt;P&gt;         aufld LIKE afko-aufld, "Date of BOM routing transfer&lt;/P&gt;&lt;P&gt;         aufpl  LIKE afko-aufpl,"Routing number for operations&lt;/P&gt;&lt;P&gt;         igmng LIKE afko-igmng, "Yield confirmed order confirmation&lt;/P&gt;&lt;P&gt;         iasmg LIKE afko-iasmg, "Scrap confirmed for order&lt;/P&gt;&lt;P&gt;        END OF t_afko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:  BEGIN OF t_afvc,&lt;/P&gt;&lt;P&gt;         aufpl LIKE afvc-aufpl, "Routing number for operations order&lt;/P&gt;&lt;P&gt;         arbid LIKE afvc-arbid, "Object ID of the resource&lt;/P&gt;&lt;P&gt;        END OF t_afvc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:  BEGIN OF t_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;         aufpl LIKE zbw_afvv_c-aufpl, "Routing number&lt;/P&gt;&lt;P&gt;         ism03 LIKE zbw_afvv_c-ism03, "Previously confirmed activity&lt;/P&gt;&lt;P&gt;         ile03 LIKE zbw_afvv_c-ile03, "Unit of measure&lt;/P&gt;&lt;P&gt;         vgw02 LIKE zbw_afvv_c-vgw02, "Standard value&lt;/P&gt;&lt;P&gt;         vge02 LIKE zbw_afvv_c-vge02, "Unit of measure standard value&lt;/P&gt;&lt;P&gt;         isdd  LIKE zbw_afvv_c-isdd,  "Actual start: Execution (date)&lt;/P&gt;&lt;P&gt;         isdz  LIKE zbw_afvv_c-isdz,  "Actual start: Execution (time)&lt;/P&gt;&lt;P&gt;        END OF t_zbw_afvv_c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_CRHD,&lt;/P&gt;&lt;P&gt;         objid LIKE crhd-objid, "Object ID of the resource&lt;/P&gt;&lt;P&gt;         arbpl LIKE crhd-arbpl, "Work Center&lt;/P&gt;&lt;P&gt;       END OF t_CRHD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_jest,&lt;/P&gt;&lt;P&gt;         objnr LIKE jest-objnr, "Object Number&lt;/P&gt;&lt;P&gt;         stat  LIKE jest-stat,  "Status&lt;/P&gt;&lt;P&gt;       END OF t_jest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;*Internal Table Declaration    *&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: i_afpo    TYPE STANDARD TABLE OF t_afpo,&lt;/P&gt;&lt;P&gt;      wa_afpo   TYPE t_afpo,&lt;/P&gt;&lt;P&gt;      i_afko    TYPE STANDARD TABLE OF t_afko,&lt;/P&gt;&lt;P&gt;      wa_afko   TYPE t_afko,&lt;/P&gt;&lt;P&gt;      i_afvc    TYPE STANDARD TABLE OF t_afvc,&lt;/P&gt;&lt;P&gt;      wa_afvc   TYPE t_afvc,&lt;/P&gt;&lt;P&gt;      i_afvc_d  TYPE STANDARD TABLE OF t_afvc,&lt;/P&gt;&lt;P&gt;      wa_afvc_d TYPE t_afvc,&lt;/P&gt;&lt;P&gt;      i_jest    TYPE STANDARD TABLE OF t_jest,&lt;/P&gt;&lt;P&gt;      wa_jest   TYPE t_jest,&lt;/P&gt;&lt;P&gt;      i_zbw_afvv_c    TYPE STANDARD TABLE OF t_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;      wa_zbw_afvv_c   TYPE t_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;      i_CRHD    TYPE STANDARD TABLE OF t_CRHD,&lt;/P&gt;&lt;P&gt;      wa_CRHD   TYPE t_CRHD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Actual Code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_data_temp[] = i_t_data[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF i_data_temp[] IS INITIAL.&lt;/P&gt;&lt;P&gt;    RAISE rsap_customer_exit_error.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves values of appended fields from afpo table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT aufnr     "Order Number&lt;/P&gt;&lt;P&gt;           plnum     "Planned order number&lt;/P&gt;&lt;P&gt;           psamg     "Scrap quantity in item&lt;/P&gt;&lt;P&gt;           psmng     "Order item quantity&lt;/P&gt;&lt;P&gt;           wemng     "Quantity of goods for the order item&lt;/P&gt;&lt;P&gt;           amein     "Unit of measure for in-house production&lt;/P&gt;&lt;P&gt;           meins     "Base unit of measure&lt;/P&gt;&lt;P&gt;           pamng     "Fixed quantity of scrap from production&lt;/P&gt;&lt;P&gt;           pgmng     "Total planned order quantity&lt;/P&gt;&lt;P&gt;           ablad     "Unloading point&lt;/P&gt;&lt;P&gt;      FROM afpo&lt;/P&gt;&lt;P&gt;      INTO TABLE i_afpo&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_data_temp&lt;/P&gt;&lt;P&gt;     WHERE aufnr = i_data_temp-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves values of appended fields and aufpl from afko table that&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be used as a look up in table afvv&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT aufnr     "Order Number&lt;/P&gt;&lt;P&gt;           gltrp     "Basic finish date&lt;/P&gt;&lt;P&gt;           gstrp     "Basic start date&lt;/P&gt;&lt;P&gt;           ftrms     "Scheduled release date&lt;/P&gt;&lt;P&gt;           gltrs     "Scheduled finish&lt;/P&gt;&lt;P&gt;           gstrs     "Scheduled start&lt;/P&gt;&lt;P&gt;           gstri     "Actual start date&lt;/P&gt;&lt;P&gt;           gltri     "Actual finish date&lt;/P&gt;&lt;P&gt;           ftrmi     "Actual release date&lt;/P&gt;&lt;P&gt;           gmein     "Base unit of measure&lt;/P&gt;&lt;P&gt;           plnty     "Task list type&lt;/P&gt;&lt;P&gt;           plnnr     "Key for task groupKey&lt;/P&gt;&lt;P&gt;           plnal     "Group counter&lt;/P&gt;&lt;P&gt;           aufld     "Date of BOM routing transfer&lt;/P&gt;&lt;P&gt;           aufpl     "Routing number for operations&lt;/P&gt;&lt;P&gt;           igmng     "Yield confirmed order confirmation&lt;/P&gt;&lt;P&gt;           iasmg     "Scrap confirmed for order&lt;/P&gt;&lt;P&gt;      FROM afko&lt;/P&gt;&lt;P&gt;      INTO TABLE i_afko&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afpo&lt;/P&gt;&lt;P&gt;     WHERE aufnr = i_afpo-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&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;loop at i_data_temp.&lt;/P&gt;&lt;P&gt;  CONCATENATE 'OR' i_data_temp-aufnr into i_jest_obj-objnr.&lt;/P&gt;&lt;P&gt;  append i_jest_obj.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves appended fields from afvv table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT aufpl      "Routing number&lt;/P&gt;&lt;P&gt;           ism03      "Previously confirmed activity&lt;/P&gt;&lt;P&gt;           ile03      "Unit of measure&lt;/P&gt;&lt;P&gt;           vgw02      "Standard value&lt;/P&gt;&lt;P&gt;           vge02      "Unit of measure standard value&lt;/P&gt;&lt;P&gt;           isdd       "Actual start: Execution (date)&lt;/P&gt;&lt;P&gt;           isdz       "Actual start: Execution (time)&lt;/P&gt;&lt;P&gt;      FROM zbw_afvv_c&lt;/P&gt;&lt;P&gt;      INTO TABLE i_zbw_afvv_c&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afko&lt;/P&gt;&lt;P&gt;     WHERE aufpl = i_afko-aufpl.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves ARBID from afvc table that will be used as a lookup in CHRD&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table to get the workcenter&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT aufpl       "Routing number for operations order&lt;/P&gt;&lt;P&gt;           arbid       "Object ID of the resource&lt;/P&gt;&lt;P&gt;      FROM afvc&lt;/P&gt;&lt;P&gt;      INTO TABLE i_afvc&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afko&lt;/P&gt;&lt;P&gt;     WHERE aufpl = i_afko-aufpl.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves Work Center based on the arbid selected from afvc table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT objid      "Object ID of the resource&lt;/P&gt;&lt;P&gt;           arbpl      " Work Center&lt;/P&gt;&lt;P&gt;      FROM crhd&lt;/P&gt;&lt;P&gt;      INTO TABLE i_crhd&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afvc&lt;/P&gt;&lt;P&gt;     WHERE objid = i_afvc-arbid.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT objnr     "Object Number&lt;/P&gt;&lt;P&gt;           stat      "Status&lt;/P&gt;&lt;P&gt;      FROM jest&lt;/P&gt;&lt;P&gt;      INTO TABLE i_jest&lt;/P&gt;&lt;P&gt;      for all entries in i_jest_obj&lt;/P&gt;&lt;P&gt;   where objnr = i_jest_obj-objnr&lt;/P&gt;&lt;P&gt;    AND   ( stat EQ 'I0045' OR stat EQ 'I0076' OR stat EQ 'I0012' ).&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="6" type="ul"&gt;&lt;P&gt; MAIN PROCESSING  *****&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_afvc_d[] = i_afvc[].&lt;/P&gt;&lt;P&gt;  SORT i_afvc   BY aufpl ASCENDING.&lt;/P&gt;&lt;P&gt;  SORT i_afvc_d BY aufpl DESCENDING.&lt;/P&gt;&lt;P&gt;  SORT : i_afko BY aufnr,&lt;/P&gt;&lt;P&gt;         i_afpo BY aufnr,&lt;/P&gt;&lt;P&gt;         i_zbw_afvv_c BY aufpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_t_data INTO ippord_bw.&lt;/P&gt;&lt;P&gt;    itabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;clears work area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLEAR: wa_afpo,&lt;/P&gt;&lt;P&gt;           wa_afko,&lt;/P&gt;&lt;P&gt;           wa_afvc,&lt;/P&gt;&lt;P&gt;           wa_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;           wa_crhd.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read internal table i_afpo&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_afpo INTO wa_afpo&lt;/P&gt;&lt;P&gt;                      WITH KEY aufnr = ippord_bw-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzwemng = wa_afpo-wemng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzamein = wa_afpo-amein.&lt;/P&gt;&lt;P&gt;      ippord_bw-amein   = wa_afpo-amein.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpsamg = wa_afpo-psamg.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpgmng = wa_afpo-pgmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpamng = wa_afpo-pamng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpsmng = wa_afpo-psmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-psmng   = wa_afpo-psmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzmeins = wa_afpo-meins.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnum = wa_afpo-plnum.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzablad = wa_afpo-ablad.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read internal table i_afko&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_afko INTO wa_afko&lt;/P&gt;&lt;P&gt;                      WITH KEY aufnr = ippord_bw-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzftrms = wa_afko-ftrms.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgstri = wa_afko-gstri.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzftrmi = wa_afko-ftrmi.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgstrp = wa_afko-gstrp.&lt;/P&gt;&lt;P&gt;      ippord_bw-zziasmg = wa_afko-iasmg.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzigmng = wa_afko-igmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgmein = wa_afko-gmein.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnnr = wa_afko-plnnr.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnty = wa_afko-plnty.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnal = wa_afko-plnal.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzaufld = wa_afko-aufld.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgltrs = wa_afko-gltrs.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgstrs = wa_afko-gstrs.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgltri = wa_afko-gltri.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgltrp = wa_afko-gltrp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read internal table i_afvv&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      READ TABLE i_zbw_afvv_c INTO wa_zbw_afvv_c&lt;/P&gt;&lt;P&gt;                        WITH KEY aufpl = wa_afko-aufpl.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          ippord_bw-ism03 = wa_zbw_afvv_c-ism03.&lt;/P&gt;&lt;P&gt;          ippord_bw-ile03 = wa_zbw_afvv_c-ile03.&lt;/P&gt;&lt;P&gt;          ippord_bw-vgw02 = wa_zbw_afvv_c-vgw02.&lt;/P&gt;&lt;P&gt;          ippord_bw-vge02 = wa_zbw_afvv_c-vge02.&lt;/P&gt;&lt;P&gt;          ippord_bw-isdd  = wa_zbw_afvv_c-isdd.&lt;/P&gt;&lt;P&gt;          ippord_bw-isdz  = wa_zbw_afvv_c-isdz.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Pull first resource&lt;/P&gt;&lt;P&gt;      READ TABLE i_afvc INTO wa_afvc&lt;/P&gt;&lt;P&gt;                        WITH KEY wa_zbw_afvv_c-aufpl.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        READ TABLE i_crhd INTO wa_crhd&lt;/P&gt;&lt;P&gt;                          WITH KEY objid = wa_afvc-arbid.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          ippord_bw-zzarbpl1 = wa_crhd-arbpl.&lt;/P&gt;&lt;P&gt;        ENDIF. "read i_crhd&lt;/P&gt;&lt;P&gt;      ENDIF. "read i_afvc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Pull last resource&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CLEAR: wa_afvc_d,&lt;/P&gt;&lt;P&gt;             wa_crhd.&lt;/P&gt;&lt;P&gt;      READ TABLE i_afvc_d INTO wa_afvc_d&lt;/P&gt;&lt;P&gt;                        WITH KEY wa_zbw_afvv_c-aufpl.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        READ TABLE i_crhd INTO wa_crhd&lt;/P&gt;&lt;P&gt;                          WITH KEY objid = wa_afvc_d-arbid.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          ippord_bw-zzarbpl2 = wa_crhd-arbpl.&lt;/P&gt;&lt;P&gt;        ENDIF. "read i_crhd&lt;/P&gt;&lt;P&gt;      ENDIF.  "read i_afvc&lt;/P&gt;&lt;P&gt;    ENDIF. "read i_afko&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR v_objnr.&lt;/P&gt;&lt;P&gt;    READ TABLE i_data_temp INDEX itabix.&lt;/P&gt;&lt;P&gt;    SHIFT i_data_temp-aufnr LEFT BY 5 PLACES.&lt;/P&gt;&lt;P&gt;    CONCATENATE 'OR00000' i_data_temp-aufnr INTO v_objnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TECO Status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_jest INTO  wa_jest&lt;/P&gt;&lt;P&gt;                      WITH KEY objnr = v_objnr&lt;/P&gt;&lt;P&gt;                           stat  = 'I0045'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        ippord_bw-zzteco = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Deletion Flag Status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_jest INTO  wa_jest&lt;/P&gt;&lt;P&gt;                      WITH KEY objnr = v_objnr&lt;/P&gt;&lt;P&gt;                               stat  = 'I0076'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        ippord_bw-zzdlfl = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delivered Status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_jest INTO  wa_jest&lt;/P&gt;&lt;P&gt;                      WITH KEY objnr = v_objnr&lt;/P&gt;&lt;P&gt;                               stat  = 'I0012'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        ippord_bw-zzdlv = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MODIFY i_t_data FROM ippord_bw INDEX itabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;refreshes content of internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  REFRESH: i_data_temp,&lt;/P&gt;&lt;P&gt;           i_afko,&lt;/P&gt;&lt;P&gt;           i_afpo,&lt;/P&gt;&lt;P&gt;           i_afvc,&lt;/P&gt;&lt;P&gt;           i_afvc_d,&lt;/P&gt;&lt;P&gt;           i_jest,&lt;/P&gt;&lt;P&gt;           i_zbw_afvv_c.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; frees up the memory space containing the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  FREE:    i_data_temp,&lt;/P&gt;&lt;P&gt;           i_afko,&lt;/P&gt;&lt;P&gt;           i_afpo,&lt;/P&gt;&lt;P&gt;           i_afvc,&lt;/P&gt;&lt;P&gt;           i_afvc_d,&lt;/P&gt;&lt;P&gt;           i_jest,&lt;/P&gt;&lt;P&gt;           i_crhd.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Mar 2006 03:24:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-03-30T03:24:51Z</dc:date>
    <item>
      <title>Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217769#M135355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts, I have a function module that runs so slow, I just want to seek some advice to help me have a better performance speed what can I used and alternatives to make my codes faster... any advice can help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Heres my &amp;lt;b&amp;gt; code &amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Declaration&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION-POOL YXBW_0PRODORDER_ATTR.         "MESSAGE-ID ..&lt;/P&gt;&lt;P&gt;TYPE-POOLS: RSAP, RSSG, SRSC, SRSD, RSAOT, RSFH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ippord_bw LIKE ppord_bw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : itabix LIKE sy-tabix.&lt;/P&gt;&lt;P&gt;DATA : V_OBJNR LIKE JEST-OBJNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF i_data_temp OCCURS 0.&lt;/P&gt;&lt;P&gt;        INCLUDE STRUCTURE ppord_bw.&lt;/P&gt;&lt;P&gt;DATA : END OF i_data_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  begin of i_jest_obj occurs 0,&lt;/P&gt;&lt;P&gt; objnr like jest-objnr,&lt;/P&gt;&lt;P&gt; end of i_jest_obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;*TYPES Declaration             *&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_afpo,&lt;/P&gt;&lt;P&gt;         aufnr LIKE afpo-aufnr, "Order Number&lt;/P&gt;&lt;P&gt;         plnum LIKE afpo-plnum, "Planned order number&lt;/P&gt;&lt;P&gt;         psamg LIKE afpo-psamg, "Scrap quantity in item&lt;/P&gt;&lt;P&gt;         psmng LIKE afpo-psmng, "Order item quantity&lt;/P&gt;&lt;P&gt;         wemng LIKE afpo-wemng, "Quantity of goods for the order item&lt;/P&gt;&lt;P&gt;         amein LIKE afpo-amein, "Unit of measure for in-house production&lt;/P&gt;&lt;P&gt;         meins LIKE afpo-meins, "Base unit of measure&lt;/P&gt;&lt;P&gt;         pamng LIKE afpo-pamng, "Fixed quantity of scrap from production&lt;/P&gt;&lt;P&gt;         pgmng LIKE afpo-pgmng, "Total planned order quantity&lt;/P&gt;&lt;P&gt;         ablad LIKE afpo-ablad, "Unloading point&lt;/P&gt;&lt;P&gt;        END OF t_afpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:  BEGIN OF t_afko,&lt;/P&gt;&lt;P&gt;         aufnr LIKE afko-aufnr, "Order Number&lt;/P&gt;&lt;P&gt;         gltrp LIKE afko-gltrp, "Basic finish date&lt;/P&gt;&lt;P&gt;         gstrp LIKE afko-gstrp, "Basic start date&lt;/P&gt;&lt;P&gt;         ftrms LIKE afko-ftrms, "Scheduled release date&lt;/P&gt;&lt;P&gt;         gltrs LIKE afko-gltrs, "Scheduled finish&lt;/P&gt;&lt;P&gt;         gstrs LIKE afko-gstrs, "Scheduled start&lt;/P&gt;&lt;P&gt;         gstri LIKE afko-gstri, "Actual start date&lt;/P&gt;&lt;P&gt;         gltri LIKE afko-gltri, "Actual finish date&lt;/P&gt;&lt;P&gt;         ftrmi LIKE afko-ftrmi, "Actual release date&lt;/P&gt;&lt;P&gt;         gmein LIKE afko-gmein, "Base unit of measure&lt;/P&gt;&lt;P&gt;         plnty LIKE afko-plnty, "Task list type&lt;/P&gt;&lt;P&gt;         plnnr LIKE afko-plnnr, "Key for task groupKey&lt;/P&gt;&lt;P&gt;         plnal LIKE afko-plnal, "Group counter&lt;/P&gt;&lt;P&gt;         aufld LIKE afko-aufld, "Date of BOM routing transfer&lt;/P&gt;&lt;P&gt;         aufpl  LIKE afko-aufpl,"Routing number for operations&lt;/P&gt;&lt;P&gt;         igmng LIKE afko-igmng, "Yield confirmed order confirmation&lt;/P&gt;&lt;P&gt;         iasmg LIKE afko-iasmg, "Scrap confirmed for order&lt;/P&gt;&lt;P&gt;        END OF t_afko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:  BEGIN OF t_afvc,&lt;/P&gt;&lt;P&gt;         aufpl LIKE afvc-aufpl, "Routing number for operations order&lt;/P&gt;&lt;P&gt;         arbid LIKE afvc-arbid, "Object ID of the resource&lt;/P&gt;&lt;P&gt;        END OF t_afvc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:  BEGIN OF t_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;         aufpl LIKE zbw_afvv_c-aufpl, "Routing number&lt;/P&gt;&lt;P&gt;         ism03 LIKE zbw_afvv_c-ism03, "Previously confirmed activity&lt;/P&gt;&lt;P&gt;         ile03 LIKE zbw_afvv_c-ile03, "Unit of measure&lt;/P&gt;&lt;P&gt;         vgw02 LIKE zbw_afvv_c-vgw02, "Standard value&lt;/P&gt;&lt;P&gt;         vge02 LIKE zbw_afvv_c-vge02, "Unit of measure standard value&lt;/P&gt;&lt;P&gt;         isdd  LIKE zbw_afvv_c-isdd,  "Actual start: Execution (date)&lt;/P&gt;&lt;P&gt;         isdz  LIKE zbw_afvv_c-isdz,  "Actual start: Execution (time)&lt;/P&gt;&lt;P&gt;        END OF t_zbw_afvv_c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_CRHD,&lt;/P&gt;&lt;P&gt;         objid LIKE crhd-objid, "Object ID of the resource&lt;/P&gt;&lt;P&gt;         arbpl LIKE crhd-arbpl, "Work Center&lt;/P&gt;&lt;P&gt;       END OF t_CRHD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_jest,&lt;/P&gt;&lt;P&gt;         objnr LIKE jest-objnr, "Object Number&lt;/P&gt;&lt;P&gt;         stat  LIKE jest-stat,  "Status&lt;/P&gt;&lt;P&gt;       END OF t_jest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;*Internal Table Declaration    *&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: i_afpo    TYPE STANDARD TABLE OF t_afpo,&lt;/P&gt;&lt;P&gt;      wa_afpo   TYPE t_afpo,&lt;/P&gt;&lt;P&gt;      i_afko    TYPE STANDARD TABLE OF t_afko,&lt;/P&gt;&lt;P&gt;      wa_afko   TYPE t_afko,&lt;/P&gt;&lt;P&gt;      i_afvc    TYPE STANDARD TABLE OF t_afvc,&lt;/P&gt;&lt;P&gt;      wa_afvc   TYPE t_afvc,&lt;/P&gt;&lt;P&gt;      i_afvc_d  TYPE STANDARD TABLE OF t_afvc,&lt;/P&gt;&lt;P&gt;      wa_afvc_d TYPE t_afvc,&lt;/P&gt;&lt;P&gt;      i_jest    TYPE STANDARD TABLE OF t_jest,&lt;/P&gt;&lt;P&gt;      wa_jest   TYPE t_jest,&lt;/P&gt;&lt;P&gt;      i_zbw_afvv_c    TYPE STANDARD TABLE OF t_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;      wa_zbw_afvv_c   TYPE t_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;      i_CRHD    TYPE STANDARD TABLE OF t_CRHD,&lt;/P&gt;&lt;P&gt;      wa_CRHD   TYPE t_CRHD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Actual Code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_data_temp[] = i_t_data[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF i_data_temp[] IS INITIAL.&lt;/P&gt;&lt;P&gt;    RAISE rsap_customer_exit_error.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves values of appended fields from afpo table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT aufnr     "Order Number&lt;/P&gt;&lt;P&gt;           plnum     "Planned order number&lt;/P&gt;&lt;P&gt;           psamg     "Scrap quantity in item&lt;/P&gt;&lt;P&gt;           psmng     "Order item quantity&lt;/P&gt;&lt;P&gt;           wemng     "Quantity of goods for the order item&lt;/P&gt;&lt;P&gt;           amein     "Unit of measure for in-house production&lt;/P&gt;&lt;P&gt;           meins     "Base unit of measure&lt;/P&gt;&lt;P&gt;           pamng     "Fixed quantity of scrap from production&lt;/P&gt;&lt;P&gt;           pgmng     "Total planned order quantity&lt;/P&gt;&lt;P&gt;           ablad     "Unloading point&lt;/P&gt;&lt;P&gt;      FROM afpo&lt;/P&gt;&lt;P&gt;      INTO TABLE i_afpo&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_data_temp&lt;/P&gt;&lt;P&gt;     WHERE aufnr = i_data_temp-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves values of appended fields and aufpl from afko table that&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be used as a look up in table afvv&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT aufnr     "Order Number&lt;/P&gt;&lt;P&gt;           gltrp     "Basic finish date&lt;/P&gt;&lt;P&gt;           gstrp     "Basic start date&lt;/P&gt;&lt;P&gt;           ftrms     "Scheduled release date&lt;/P&gt;&lt;P&gt;           gltrs     "Scheduled finish&lt;/P&gt;&lt;P&gt;           gstrs     "Scheduled start&lt;/P&gt;&lt;P&gt;           gstri     "Actual start date&lt;/P&gt;&lt;P&gt;           gltri     "Actual finish date&lt;/P&gt;&lt;P&gt;           ftrmi     "Actual release date&lt;/P&gt;&lt;P&gt;           gmein     "Base unit of measure&lt;/P&gt;&lt;P&gt;           plnty     "Task list type&lt;/P&gt;&lt;P&gt;           plnnr     "Key for task groupKey&lt;/P&gt;&lt;P&gt;           plnal     "Group counter&lt;/P&gt;&lt;P&gt;           aufld     "Date of BOM routing transfer&lt;/P&gt;&lt;P&gt;           aufpl     "Routing number for operations&lt;/P&gt;&lt;P&gt;           igmng     "Yield confirmed order confirmation&lt;/P&gt;&lt;P&gt;           iasmg     "Scrap confirmed for order&lt;/P&gt;&lt;P&gt;      FROM afko&lt;/P&gt;&lt;P&gt;      INTO TABLE i_afko&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afpo&lt;/P&gt;&lt;P&gt;     WHERE aufnr = i_afpo-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&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;loop at i_data_temp.&lt;/P&gt;&lt;P&gt;  CONCATENATE 'OR' i_data_temp-aufnr into i_jest_obj-objnr.&lt;/P&gt;&lt;P&gt;  append i_jest_obj.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves appended fields from afvv table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT aufpl      "Routing number&lt;/P&gt;&lt;P&gt;           ism03      "Previously confirmed activity&lt;/P&gt;&lt;P&gt;           ile03      "Unit of measure&lt;/P&gt;&lt;P&gt;           vgw02      "Standard value&lt;/P&gt;&lt;P&gt;           vge02      "Unit of measure standard value&lt;/P&gt;&lt;P&gt;           isdd       "Actual start: Execution (date)&lt;/P&gt;&lt;P&gt;           isdz       "Actual start: Execution (time)&lt;/P&gt;&lt;P&gt;      FROM zbw_afvv_c&lt;/P&gt;&lt;P&gt;      INTO TABLE i_zbw_afvv_c&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afko&lt;/P&gt;&lt;P&gt;     WHERE aufpl = i_afko-aufpl.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves ARBID from afvc table that will be used as a lookup in CHRD&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table to get the workcenter&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT aufpl       "Routing number for operations order&lt;/P&gt;&lt;P&gt;           arbid       "Object ID of the resource&lt;/P&gt;&lt;P&gt;      FROM afvc&lt;/P&gt;&lt;P&gt;      INTO TABLE i_afvc&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afko&lt;/P&gt;&lt;P&gt;     WHERE aufpl = i_afko-aufpl.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieves Work Center based on the arbid selected from afvc table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT objid      "Object ID of the resource&lt;/P&gt;&lt;P&gt;           arbpl      " Work Center&lt;/P&gt;&lt;P&gt;      FROM crhd&lt;/P&gt;&lt;P&gt;      INTO TABLE i_crhd&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN i_afvc&lt;/P&gt;&lt;P&gt;     WHERE objid = i_afvc-arbid.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT objnr     "Object Number&lt;/P&gt;&lt;P&gt;           stat      "Status&lt;/P&gt;&lt;P&gt;      FROM jest&lt;/P&gt;&lt;P&gt;      INTO TABLE i_jest&lt;/P&gt;&lt;P&gt;      for all entries in i_jest_obj&lt;/P&gt;&lt;P&gt;   where objnr = i_jest_obj-objnr&lt;/P&gt;&lt;P&gt;    AND   ( stat EQ 'I0045' OR stat EQ 'I0076' OR stat EQ 'I0012' ).&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="6" type="ul"&gt;&lt;P&gt; MAIN PROCESSING  *****&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_afvc_d[] = i_afvc[].&lt;/P&gt;&lt;P&gt;  SORT i_afvc   BY aufpl ASCENDING.&lt;/P&gt;&lt;P&gt;  SORT i_afvc_d BY aufpl DESCENDING.&lt;/P&gt;&lt;P&gt;  SORT : i_afko BY aufnr,&lt;/P&gt;&lt;P&gt;         i_afpo BY aufnr,&lt;/P&gt;&lt;P&gt;         i_zbw_afvv_c BY aufpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_t_data INTO ippord_bw.&lt;/P&gt;&lt;P&gt;    itabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;clears work area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLEAR: wa_afpo,&lt;/P&gt;&lt;P&gt;           wa_afko,&lt;/P&gt;&lt;P&gt;           wa_afvc,&lt;/P&gt;&lt;P&gt;           wa_zbw_afvv_c,&lt;/P&gt;&lt;P&gt;           wa_crhd.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read internal table i_afpo&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_afpo INTO wa_afpo&lt;/P&gt;&lt;P&gt;                      WITH KEY aufnr = ippord_bw-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzwemng = wa_afpo-wemng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzamein = wa_afpo-amein.&lt;/P&gt;&lt;P&gt;      ippord_bw-amein   = wa_afpo-amein.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpsamg = wa_afpo-psamg.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpgmng = wa_afpo-pgmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpamng = wa_afpo-pamng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzpsmng = wa_afpo-psmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-psmng   = wa_afpo-psmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzmeins = wa_afpo-meins.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnum = wa_afpo-plnum.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzablad = wa_afpo-ablad.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read internal table i_afko&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_afko INTO wa_afko&lt;/P&gt;&lt;P&gt;                      WITH KEY aufnr = ippord_bw-aufnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzftrms = wa_afko-ftrms.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgstri = wa_afko-gstri.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzftrmi = wa_afko-ftrmi.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgstrp = wa_afko-gstrp.&lt;/P&gt;&lt;P&gt;      ippord_bw-zziasmg = wa_afko-iasmg.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzigmng = wa_afko-igmng.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgmein = wa_afko-gmein.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnnr = wa_afko-plnnr.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnty = wa_afko-plnty.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzplnal = wa_afko-plnal.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzaufld = wa_afko-aufld.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgltrs = wa_afko-gltrs.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgstrs = wa_afko-gstrs.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgltri = wa_afko-gltri.&lt;/P&gt;&lt;P&gt;      ippord_bw-zzgltrp = wa_afko-gltrp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read internal table i_afvv&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      READ TABLE i_zbw_afvv_c INTO wa_zbw_afvv_c&lt;/P&gt;&lt;P&gt;                        WITH KEY aufpl = wa_afko-aufpl.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          ippord_bw-ism03 = wa_zbw_afvv_c-ism03.&lt;/P&gt;&lt;P&gt;          ippord_bw-ile03 = wa_zbw_afvv_c-ile03.&lt;/P&gt;&lt;P&gt;          ippord_bw-vgw02 = wa_zbw_afvv_c-vgw02.&lt;/P&gt;&lt;P&gt;          ippord_bw-vge02 = wa_zbw_afvv_c-vge02.&lt;/P&gt;&lt;P&gt;          ippord_bw-isdd  = wa_zbw_afvv_c-isdd.&lt;/P&gt;&lt;P&gt;          ippord_bw-isdz  = wa_zbw_afvv_c-isdz.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Pull first resource&lt;/P&gt;&lt;P&gt;      READ TABLE i_afvc INTO wa_afvc&lt;/P&gt;&lt;P&gt;                        WITH KEY wa_zbw_afvv_c-aufpl.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        READ TABLE i_crhd INTO wa_crhd&lt;/P&gt;&lt;P&gt;                          WITH KEY objid = wa_afvc-arbid.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          ippord_bw-zzarbpl1 = wa_crhd-arbpl.&lt;/P&gt;&lt;P&gt;        ENDIF. "read i_crhd&lt;/P&gt;&lt;P&gt;      ENDIF. "read i_afvc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Pull last resource&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CLEAR: wa_afvc_d,&lt;/P&gt;&lt;P&gt;             wa_crhd.&lt;/P&gt;&lt;P&gt;      READ TABLE i_afvc_d INTO wa_afvc_d&lt;/P&gt;&lt;P&gt;                        WITH KEY wa_zbw_afvv_c-aufpl.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        READ TABLE i_crhd INTO wa_crhd&lt;/P&gt;&lt;P&gt;                          WITH KEY objid = wa_afvc_d-arbid.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          ippord_bw-zzarbpl2 = wa_crhd-arbpl.&lt;/P&gt;&lt;P&gt;        ENDIF. "read i_crhd&lt;/P&gt;&lt;P&gt;      ENDIF.  "read i_afvc&lt;/P&gt;&lt;P&gt;    ENDIF. "read i_afko&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR v_objnr.&lt;/P&gt;&lt;P&gt;    READ TABLE i_data_temp INDEX itabix.&lt;/P&gt;&lt;P&gt;    SHIFT i_data_temp-aufnr LEFT BY 5 PLACES.&lt;/P&gt;&lt;P&gt;    CONCATENATE 'OR00000' i_data_temp-aufnr INTO v_objnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TECO Status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_jest INTO  wa_jest&lt;/P&gt;&lt;P&gt;                      WITH KEY objnr = v_objnr&lt;/P&gt;&lt;P&gt;                           stat  = 'I0045'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        ippord_bw-zzteco = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Deletion Flag Status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_jest INTO  wa_jest&lt;/P&gt;&lt;P&gt;                      WITH KEY objnr = v_objnr&lt;/P&gt;&lt;P&gt;                               stat  = 'I0076'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        ippord_bw-zzdlfl = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delivered Status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    READ TABLE i_jest INTO  wa_jest&lt;/P&gt;&lt;P&gt;                      WITH KEY objnr = v_objnr&lt;/P&gt;&lt;P&gt;                               stat  = 'I0012'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        ippord_bw-zzdlv = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MODIFY i_t_data FROM ippord_bw INDEX itabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;refreshes content of internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  REFRESH: i_data_temp,&lt;/P&gt;&lt;P&gt;           i_afko,&lt;/P&gt;&lt;P&gt;           i_afpo,&lt;/P&gt;&lt;P&gt;           i_afvc,&lt;/P&gt;&lt;P&gt;           i_afvc_d,&lt;/P&gt;&lt;P&gt;           i_jest,&lt;/P&gt;&lt;P&gt;           i_zbw_afvv_c.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; frees up the memory space containing the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  FREE:    i_data_temp,&lt;/P&gt;&lt;P&gt;           i_afko,&lt;/P&gt;&lt;P&gt;           i_afpo,&lt;/P&gt;&lt;P&gt;           i_afvc,&lt;/P&gt;&lt;P&gt;           i_afvc_d,&lt;/P&gt;&lt;P&gt;           i_jest,&lt;/P&gt;&lt;P&gt;           i_crhd.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 03:24:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217769#M135355</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T03:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217770#M135356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might help if you can use SORTED tables, so that you can use a BINARY SEARCH in the READ statement. It might make a difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like most of the impact is from the SELECT statements though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 03:36:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217770#M135356</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T03:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217771#M135357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before each select statement make sure that you check that there is data in the previous table(the table used in the FOR ALL ENTRIES in &amp;lt;table&amp;gt;) and that it is sorted by the field that is used in the where clause.  It will probably speed it up some.&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>Thu, 30 Mar 2006 03:41:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217771#M135357</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-03-30T03:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217772#M135358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't look at your selects; maybe they could be improved. What I noticed is that after the selects, you basically do:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at i_t_data.
  read table1 with key field1 = ...
  read table2 with key field2 = ...
  read tableetc with key fieldetc = ...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This will be inefficient. Try doing this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort table1 by field1.
sort table2 by field2.
sort tableetc by fieldetc.

loop at i_t_data.
  read table1 with key field1 = ... binary search.
  read table2 with key field2 = ... binary search.
  read tableetc with key fieldetc = ...binary search.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 03:44:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217772#M135358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T03:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217773#M135359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sir I already have a sort in the above code, so I must used the binary search in the read table? btw can I implement index in this code? If yes how?, Is the used of Field-Symbol better than work area?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks and regards&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 03:52:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217773#M135359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T03:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217774#M135360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I missed the sorts, but you have to specify the addition 'binary search', or it will just do a sequential read and exit after the first hit. I would do that first because it'll be the easiest thing to do. If it doesn't help, we can look at the selects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if the tables are large, it should help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 03:59:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217774#M135360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T03:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217775#M135361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest trying to use the BINARY SEARCH on your READ statements as others have suggested, this will help.  You select statements look pretty good, I believe that you are using the keys for all, so indexes wouldn't help.  Field symbols will help a little, but probably not enough to notice, so it may not be worth it.&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>Thu, 30 Mar 2006 03:59:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217775#M135361</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-03-30T03:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217776#M135362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Guyz,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes the there are lots opf records because this is a Function Module is being used in BW and currently in the Assurance box, I'll add the binary search in the read table and post my questions again. Thanks to everyone that replied, Ive already assign points, I really appreciate all your help&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;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 04:05:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217776#M135362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T04:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217777#M135363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also this select could be improved:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* retrieves Work Center based on the arbid selected from afvc table
SELECT objid "Object ID of the resource
arbpl " Work Center
FROM crhd
INTO TABLE i_crhd
FOR ALL ENTRIES IN i_afvc
WHERE objid = i_afvc-arbid.
IF sy-subrc = 0.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* retrieves Work Center based on the arbid selected from afvc table
SELECT objid "Object ID of the resource
arbpl " Work Center
FROM crhd
INTO TABLE i_crhd
FOR ALL ENTRIES IN i_afvc
&amp;lt;b&amp;gt;WHERE OBJTY in ('A', 'AA', 'FH', 'H')&amp;lt;/b&amp;gt;
WHERE objid = i_afvc-arbid.
IF sy-subrc = 0.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 04:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217777#M135363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T04:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217778#M135364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sir why did you include this OBJTY in ('A', 'AA', 'FH', 'H')? thanks...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 04:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217778#M135364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T04:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217779#M135365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OBJTY is the first key field in the primary key and OBJID is the second. If you specify only the second field, it won't be able to use the index as effectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I went to the domain for OBJTY and found all of the allowed values for the field and included them in the select. Oddly enough, this allows the select to use the primary index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if CRHD is small, it probably won't make much of a difference. But it can improve performance on larger tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on a BLOG on this subject. I hope to have it ready next week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2006 14:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217779#M135365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-30T14:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Optimizing code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217780#M135366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks... hope to get the link of your blog&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Mar 2006 02:00:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-optimizing-code/m-p/1217780#M135366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-31T02:00:45Z</dc:date>
    </item>
  </channel>
</rss>

