<?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: Control Structures &amp;quot;IF&amp;quot; containing arithmetic operator in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107742#M105288</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andreas Mann / Jayanthi Jayaraman : sorry, but that is not what i m looking for. the simple example was just to emphasise that i want to do arthmatic operation in IF statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Nov 2005 06:46:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-07T06:46:05Z</dc:date>
    <item>
      <title>Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107736#M105282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;DATA ii TYPE i.
IF ( ii + 1 ) &amp;gt; 2.
  WRITE: / 'more than 2'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;putting forward this error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;relational operator "+" is not supported&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any workaround or I have only left with inline functions and define macros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:23:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107736#M105282</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-07T06:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107737#M105283</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;try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ii TYPE i.&lt;/P&gt;&lt;P&gt;add 1 to ii.&lt;/P&gt;&lt;P&gt;IF ( ii ) &amp;gt; 2.&lt;/P&gt;&lt;P&gt;  WRITE: / 'more than 2'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107737#M105283</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-11-07T06:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107738#M105284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Flora,&lt;/P&gt;&lt;P&gt;         In abap you can't arithmatic ops in IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rather you do the ops and store the result in a variable, and use it in IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sum type i.&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;sum = ii + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sum &amp;gt; 2&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;plz reward points if it helps you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:32:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107738#M105284</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-07T06:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107739#M105285</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;In IF u can use only Logical Expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do a F1 and check for the synax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF logexp. &lt;/P&gt;&lt;P&gt;Used for case distinction. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on whether the logical expression logexp is true or not, this statement triggers the execution of various sections of code enclosed by IF and ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are three different types: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF logexp. &lt;/P&gt;&lt;P&gt;  processing1 &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the logical expression is true, processing1 is executed. Otherwise, the program resumes immediately after 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;IF logexp. &lt;/P&gt;&lt;P&gt;processing1 &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;processing2 &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the logical expression is true, processing1 is executed. Otherwise, processing2 is executed (see ELSE). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF logexp1. &lt;/P&gt;&lt;P&gt;processing1 &lt;/P&gt;&lt;P&gt;ELSEIF logexp2. &lt;/P&gt;&lt;P&gt;processing2 &lt;/P&gt;&lt;P&gt;ELSEIF ... &lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;processingN &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the logexp1 is false, logexp2 is evaluated and so on. You can use any number of ELSEIF statements. If an ELSE statement exists, it always appears after all the ELSEIF statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:32:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107739#M105285</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-07T06:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107740#M105286</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;The problem is because you used + in if st.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try it in following way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i1 &amp;gt; 1.&lt;/P&gt;&lt;P&gt; write : / 'more than 2'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both are same logic.&lt;/P&gt;&lt;P&gt;Kindly reward points by clicking the star on the left of reply,if it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:33:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107740#M105286</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-11-07T06:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107741#M105287</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;You can not use any arithmatic operators in a logical expression. If at it is required..a separate temporary variable should be assigned the value of arithmatic operation and then the temporary variable should be used in logical expression. Eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ii TYPE i.&lt;/P&gt;&lt;P&gt;DATA var1 TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var1 = ii + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF var1 &amp;gt; 2.&lt;/P&gt;&lt;P&gt;  WRITE: / 'more than 2'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also note that it is not recomended to use Macro's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gajendra Bhatt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:37:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107741#M105287</guid>
      <dc:creator>former_member723628</dc:creator>
      <dc:date>2005-11-07T06:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107742#M105288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andreas Mann / Jayanthi Jayaraman : sorry, but that is not what i m looking for. the simple example was just to emphasise that i want to do arthmatic operation in IF statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:46:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107742#M105288</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-07T06:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107743#M105289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Re-sending...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HI Flora,&lt;/P&gt;&lt;P&gt;In abap you can't do arithmatic ops in IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rather you do the ops and store the result in a variable, and use it in IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sum type i.&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;sum = ii + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sum &amp;gt; 2&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;plz reward points if it helps you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:48:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107743#M105289</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-07T06:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107744#M105290</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;It is not possible to use arithmetic operation in if statement in ABAP as we do the same in other programming languages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even the following is not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( 1 + 1 ) ge 2.&lt;/P&gt;&lt;P&gt;write 'dsfd'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So kindly reward points by clicking the star on the left of reply,if it helps.Kindly close the thread if your question is answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 06:52:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107744#M105290</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-11-07T06:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Control Structures "IF" containing arithmetic operator</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107745#M105291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you read it is not allowed to have aritmetic expressions in an IF statement, but perhaps it is helpful that you can compare returning parameters from methods in an IF statement like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: xyz type ref to z_own_class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object xyz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF xyz-&amp;gt;method(parameters) = 5.&lt;/P&gt;&lt;P&gt;  write:/ 'DO something'.&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;Message was edited by: Rainer Hübenthal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2005 08:10:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-structures-quot-if-quot-containing-arithmetic-operator/m-p/1107745#M105291</guid>
      <dc:creator>rainer_hbenthal</dc:creator>
      <dc:date>2005-11-07T08:10:22Z</dc:date>
    </item>
  </channel>
</rss>

