<?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 logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398883#M816065</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;anyone pls tell me the following code(BOLD) is correct or not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points will be reward&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : lv_tabix TYPE sy-tabix.&lt;/P&gt;&lt;P&gt;    FIELD-SYMBOLS : &amp;lt;fs_op&amp;gt; TYPE zfifn_op .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOOP AT ITAB_CUSTOM.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    *SELECT * FROM zfifn_op INTO TABLE zfifn_op_upd*&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;FOR ALL ENTRIES IN itab_custom&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                    &lt;STRONG&gt;WHERE opbel = itab_custom-opbel&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                    &lt;STRONG&gt;AND   bukrs = itab_custom-bukrs.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT zfifn_op_upd ASSIGNING &amp;lt;fs_op&amp;gt;.&lt;/P&gt;&lt;P&gt;      lv_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;      READ TABLE itab_custom WITH KEY opbel = &amp;lt;fs_op&amp;gt;-opbel binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-bis = itab_custom-bis.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-tariftyp = itab_custom-tariftyp.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-tarifart = itab_custom-tarifart.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-aklasse = itab_custom-aklasse.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-ab = itab_custom-ab.&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;MODIFY zfifn_op_upd FROM &amp;lt;fs_op&amp;gt; INDEX lv_tabix.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        countb = countb + 1.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        countc = countc + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CONCATENATE 'Document Number: ' space itab_zfifn_op-opbel cdelimit&lt;/P&gt;&lt;P&gt;                    'Company Code:' space itab_zfifn_op-bukrs cdelimit&lt;/P&gt;&lt;P&gt;                    ' does not exist in ZFIFN_OP table. UPDATE FAIL.'&lt;/P&gt;&lt;P&gt;                    INTO text_record3.&lt;/P&gt;&lt;P&gt;   WRITE: /10 text_record3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;    UPDATE zfifn_op&lt;/P&gt;&lt;P&gt;            FROM TABLE zfifn_op_upd.&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;COMMIT WORK AND WAIT.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Feb 2008 01:10:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-20T01:10:57Z</dc:date>
    <item>
      <title>logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398883#M816065</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;anyone pls tell me the following code(BOLD) is correct or not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points will be reward&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : lv_tabix TYPE sy-tabix.&lt;/P&gt;&lt;P&gt;    FIELD-SYMBOLS : &amp;lt;fs_op&amp;gt; TYPE zfifn_op .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOOP AT ITAB_CUSTOM.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    *SELECT * FROM zfifn_op INTO TABLE zfifn_op_upd*&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;FOR ALL ENTRIES IN itab_custom&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                    &lt;STRONG&gt;WHERE opbel = itab_custom-opbel&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                    &lt;STRONG&gt;AND   bukrs = itab_custom-bukrs.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT zfifn_op_upd ASSIGNING &amp;lt;fs_op&amp;gt;.&lt;/P&gt;&lt;P&gt;      lv_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;      READ TABLE itab_custom WITH KEY opbel = &amp;lt;fs_op&amp;gt;-opbel binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-bis = itab_custom-bis.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-tariftyp = itab_custom-tariftyp.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-tarifart = itab_custom-tarifart.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-aklasse = itab_custom-aklasse.&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_op&amp;gt;-ab = itab_custom-ab.&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;MODIFY zfifn_op_upd FROM &amp;lt;fs_op&amp;gt; INDEX lv_tabix.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;        countb = countb + 1.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        countc = countc + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CONCATENATE 'Document Number: ' space itab_zfifn_op-opbel cdelimit&lt;/P&gt;&lt;P&gt;                    'Company Code:' space itab_zfifn_op-bukrs cdelimit&lt;/P&gt;&lt;P&gt;                    ' does not exist in ZFIFN_OP table. UPDATE FAIL.'&lt;/P&gt;&lt;P&gt;                    INTO text_record3.&lt;/P&gt;&lt;P&gt;   WRITE: /10 text_record3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;    UPDATE zfifn_op&lt;/P&gt;&lt;P&gt;            FROM TABLE zfifn_op_upd.&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;COMMIT WORK AND WAIT.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 01:10:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398883#M816065</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T01:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398884#M816066</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;P&gt;SELECT * FROM zfifn_op INTO TABLE zfifn_op_upd*&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN itab_custom&lt;/P&gt;&lt;P&gt;WHERE opbel = itab_custom-opbel&lt;/P&gt;&lt;P&gt;AND bukrs = itab_custom-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before Reading , SORT itab_custom by opbel, for binary search..&lt;/P&gt;&lt;P&gt;READ TABLE itab_custom WITH KEY opbel = &amp;lt;fs_op&amp;gt;-opbel binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets us know, after this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 01:17:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398884#M816066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T01:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398885#M816067</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;Syntax is correct but our target is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB_CUSTOM.&lt;/P&gt;&lt;P&gt;*SELECT * FROM zfifn_op INTO TABLE zfifn_op_upd*&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN itab_custom&lt;/P&gt;&lt;P&gt;WHERE opbel = itab_custom-opbel&lt;/P&gt;&lt;P&gt;AND bukrs = itab_custom-bukrs.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should not write select statement in LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Beacuse loop will run till the total no. of records present in internal table ITAB_CUSTOM.Each time select statement will run.So performance will get effect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT : ITAB_CUSTOM by opbel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM zfifn_op&lt;/P&gt;&lt;P&gt;  INTO TABLE zfifn_op_upd&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN itab_custom&lt;/P&gt;&lt;P&gt;WHERE opbel = itab_custom-opbel&lt;/P&gt;&lt;P&gt;AND bukrs = itab_custom-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward if useful...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 02:38:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398885#M816067</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T02:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398886#M816068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are using FOR ALL ENTRIES , this statement automatically takes care of all the entries in the table you are referring to , in this case it is itan_custom. Hence no need to put the select inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also when you use FOR ALL ENTRIES  , make sure that there are entries in table itab_custom. So the first part of your code should have been:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : lv_tabix TYPE sy-tabix.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;fs_op&amp;gt; STRUCTURE zfifn_op .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ( NOT itab_custom[] IS INITIAL ).&lt;/P&gt;&lt;P&gt;  SELECT * FROM zfifn_op INTO TABLE zfifn_op_upd&lt;/P&gt;&lt;P&gt;   FOR ALL ENTRIES in itab_custom&lt;/P&gt;&lt;P&gt;   WHERE opbel = itab_custom-opbel&lt;/P&gt;&lt;P&gt;   AND       bukrs = itab_custom-bukrs.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; Try to select specific fields instead of all the fields to improve performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT zfifn_op_upd ASSIGNING &amp;lt;fs_op&amp;gt;.&lt;/P&gt;&lt;P&gt;lv_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;SORT itab_custom  BY OPBEL.&lt;/P&gt;&lt;P&gt;READ TABLE itab_custom WITH KEY opbel = &amp;lt;fs_op&amp;gt;-opbel &lt;/P&gt;&lt;P&gt;                                                        binary search.&lt;/P&gt;&lt;P&gt;*&lt;STRONG&gt;Note:&lt;/STRONG&gt; Before every READ with Binary search , you should SORT the table otherwise binary search has not meaning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt; &amp;lt;fs_op&amp;gt;-bis = itab_custom-bis.&lt;/P&gt;&lt;P&gt;&amp;lt;fs_op&amp;gt;-tariftyp = itab_custom-tariftyp.&lt;/P&gt;&lt;P&gt;&amp;lt;fs_op&amp;gt;-tarifart = itab_custom-tarifart.&lt;/P&gt;&lt;P&gt;&amp;lt;fs_op&amp;gt;-aklasse = itab_custom-aklasse.&lt;/P&gt;&lt;P&gt;&amp;lt;fs_op&amp;gt;-ab = itab_custom-ab.&lt;/P&gt;&lt;P&gt;MODIFY zfifn_op_upd FROM &amp;lt;fs_op&amp;gt; INDEX lv_tabix.&lt;/P&gt;&lt;P&gt;countb = countb + 1.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;countc = countc + 1.&lt;/P&gt;&lt;P&gt;CONCATENATE 'Document Number: ' space itab_zfifn_op-opbel cdelimit&lt;/P&gt;&lt;P&gt;'Company Code:' space itab_zfifn_op-bukrs cdelimit&lt;/P&gt;&lt;P&gt;' does not exist in ZFIFN_OP table. UPDATE FAIL.'&lt;/P&gt;&lt;P&gt;INTO text_record3.&lt;/P&gt;&lt;P&gt;WRITE: /10 text_record3.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE zfifn_op&lt;/P&gt;&lt;P&gt;FROM TABLE zfifn_op_upd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Commit work is not required here.&lt;/P&gt;&lt;P&gt;Also you should be sure that you just want to update the records in table &lt;/P&gt;&lt;P&gt;zfifn_op and not add any. If you want to add records , then you will have to use the MODIFY statement instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Shivika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 03:52:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/3398886#M816068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T03:52:48Z</dc:date>
    </item>
  </channel>
</rss>

