<?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 IF Statement Peformance Question in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200100#M469970</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an abap program that performs 20% better with a simple change in the structure of the if statement.  Anyone got any explaination why this would be so?  I would really appreciate any insight into this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-tcode IN r_order_tcodes.&lt;/P&gt;&lt;P&gt; ...some logic #1....&lt;/P&gt;&lt;P&gt;ELSEIF sy-batch EQ 'X' OR&lt;/P&gt;&lt;P&gt;       ( sy-cprog = 'ZSR_ECAT_GENERATE_V3' ).&lt;/P&gt;&lt;P&gt; ...some logic #1....&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;executes 20% faster than this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-tcode IN r_order_tcodes OR&lt;/P&gt;&lt;P&gt;   sy-tcode IN r_ecat_tcodes OR&lt;/P&gt;&lt;P&gt;   ( sy-batch EQ 'X' AND&lt;/P&gt;&lt;P&gt;   ( sy-cprog EQ 'ZSR_GENERATE_ECAT_V3' OR&lt;/P&gt;&lt;P&gt;     sy-cprog EQ 'ZSR_ECAT_SINGLE_CONFIG'&lt;/P&gt;&lt;P&gt;    )&lt;/P&gt;&lt;P&gt;    ).&lt;/P&gt;&lt;P&gt;  ...some logic #1...&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;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 May 2007 22:28:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-02T22:28:15Z</dc:date>
    <item>
      <title>IF Statement Peformance Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200100#M469970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an abap program that performs 20% better with a simple change in the structure of the if statement.  Anyone got any explaination why this would be so?  I would really appreciate any insight into this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-tcode IN r_order_tcodes.&lt;/P&gt;&lt;P&gt; ...some logic #1....&lt;/P&gt;&lt;P&gt;ELSEIF sy-batch EQ 'X' OR&lt;/P&gt;&lt;P&gt;       ( sy-cprog = 'ZSR_ECAT_GENERATE_V3' ).&lt;/P&gt;&lt;P&gt; ...some logic #1....&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;executes 20% faster than this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-tcode IN r_order_tcodes OR&lt;/P&gt;&lt;P&gt;   sy-tcode IN r_ecat_tcodes OR&lt;/P&gt;&lt;P&gt;   ( sy-batch EQ 'X' AND&lt;/P&gt;&lt;P&gt;   ( sy-cprog EQ 'ZSR_GENERATE_ECAT_V3' OR&lt;/P&gt;&lt;P&gt;     sy-cprog EQ 'ZSR_ECAT_SINGLE_CONFIG'&lt;/P&gt;&lt;P&gt;    )&lt;/P&gt;&lt;P&gt;    ).&lt;/P&gt;&lt;P&gt;  ...some logic #1...&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;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 22:28:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200100#M469970</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T22:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Peformance Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200101#M469971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the tcodes in r_order_tcodes and r_ecat_tcodes will have the same programs given in the else condition...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like This following simple IF statement will work for all the scenarios..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-CPROG = 'ZSR_GENERATE_ECAT_V3' OR&lt;/P&gt;&lt;P&gt;    SY-CPROG =  'ZSR_ECAT_SINGLE_CONFIG'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...some logic #1....&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 22:58:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200101#M469971</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T22:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Peformance Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200102#M469972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;it's giving 20% more performance  because in this case it's checking only one condition at a time. i.e. IF sy-tcode IN r_order_tcodes,if this is satisfied then it won't check else condition.&lt;/P&gt;&lt;P&gt;In the second case it has to check all the conditions.&lt;/P&gt;&lt;P&gt;IF sy-tcode IN r_order_tcodes OR&lt;/P&gt;&lt;P&gt;sy-tcode IN r_ecat_tcodes OR&lt;/P&gt;&lt;P&gt;( sy-batch EQ 'X' AND&lt;/P&gt;&lt;P&gt;( sy-cprog EQ 'ZSR_GENERATE_ECAT_V3' OR&lt;/P&gt;&lt;P&gt;sy-cprog EQ 'ZSR_ECAT_SINGLE_CONFIG'&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;).her it has to check all the conditions specified in the if.&lt;/P&gt;&lt;P&gt;so performance will be decreased&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helpful reward points&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 06:27:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-statement-peformance-question/m-p/2200102#M469972</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-03T06:27:38Z</dc:date>
    </item>
  </channel>
</rss>

