<?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: Conditional statement - evaluate a condition stored in a string in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749345#M1459883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be able to do this with a CASE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On second thought, probably not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Apr 16, 2010 12:18 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Apr 2010 16:16:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-16T16:16:12Z</dc:date>
    <item>
      <title>Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749339#M1459877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus,&lt;/P&gt;&lt;P&gt;I have a dynamically build structure which is a table that has just a field (type WHERETXT).&lt;/P&gt;&lt;P&gt;As example of run leads to the following result (numbers on the left represents the row of the table)&lt;/P&gt;&lt;P&gt;1   (&lt;/P&gt;&lt;P&gt;2   PARAMETER = '10'&lt;/P&gt;&lt;P&gt;3   OR&lt;/P&gt;&lt;P&gt;4   PARAMETER = '30'&lt;/P&gt;&lt;P&gt;5   )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Such a table, call it wherecond[], could be used successfully in a SELECT statement in this way:&lt;/P&gt;&lt;P&gt;SELECT foo INTO bar&lt;/P&gt;&lt;P&gt;  FROM DBtab&lt;/P&gt;&lt;P&gt;  WHERE (wherecond).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now; i'd like to use the SAME wherecond[] to buid a dynamic IF statement.&lt;/P&gt;&lt;P&gt;But:&lt;/P&gt;&lt;P&gt;IF (wherecond)&lt;/P&gt;&lt;P&gt;leads to a syntactical error: "Incorrect logical expression: "(wherecond)" : After "(" a white space was expected.&lt;/P&gt;&lt;P&gt;Then spacing as suggested::&lt;/P&gt;&lt;P&gt;IF ( wherecond )&lt;/P&gt;&lt;P&gt;I get the following error: "Relational operator ")" is not supported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried then to "unroll" the itab into a flat string variable, but I get the same syntax error. Sound really strange; could this be related to the fact this is an old system (SAP_APPL 470 ) ? How can I workaround this? &lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 13:38:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749339#M1459877</guid>
      <dc:creator>matteo_montalto</dc:creator>
      <dc:date>2010-04-16T13:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749340#M1459878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matteo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm pretty sure dynamic programming is not allowed for IF-ELSE-ENDIF statements, which is why you are getting the syntax error. But I could be wrong here... :-S&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Shailesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 15:00:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749340#M1459878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-16T15:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749341#M1459879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Shailesh,&lt;/P&gt;&lt;P&gt;that's a bad news, I'll need then to workaround on this topic... What do you think could be an efficient solution? Note that the condition will always in disjunctive form, and always referring to the same parameter (e.g. "PARAM EQ '1' OR PARAM EQ '5' OR... ..OR PARAM EQ 'n'). I was thinking in writing a conversion routine for the condition in a selopt structure, so that the IF statement could be stated as follows:&lt;/P&gt;&lt;P&gt;IF myparam IN &amp;lt;seloptname&amp;gt;&lt;/P&gt;&lt;P&gt;Is this an effective way? Or you think there's something easier/faster?&lt;/P&gt;&lt;P&gt;Thanks again &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 15:39:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749341#M1459879</guid>
      <dc:creator>matteo_montalto</dc:creator>
      <dc:date>2010-04-16T15:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749342#M1459880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be the best solution based on the circumstances.&lt;/P&gt;&lt;P&gt;If you just want confirmation, then go for it.&lt;/P&gt;&lt;P&gt;Unless some "guru" comes up with yet something more elegant.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 15:48:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749342#M1459880</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2010-04-16T15:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749343#M1459881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be the best solution based on the circumstances (chained OR conditions for the same field).&lt;/P&gt;&lt;P&gt;If you just want confirmation, then go for it.&lt;/P&gt;&lt;P&gt;Unless some "guru" comes up with something more elegant.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 15:55:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749343#M1459881</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2010-04-16T15:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749344#M1459882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like the OP needs to migrate to SAPNW7.0 EhP2 &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read on: [http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/18115] &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways i think the best &amp;amp; only feasible solution would be create a range table with individual values &amp;amp; check ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 16:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749344#M1459882</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-04-16T16:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749345#M1459883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be able to do this with a CASE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On second thought, probably not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Apr 16, 2010 12:18 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 16:16:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749345#M1459883</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-16T16:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749346#M1459884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Anyways i think the best &amp;amp; only feasible solution would be create a range table with individual values &amp;amp; check ... &lt;/P&gt;&lt;P&gt;&amp;gt; Suhas&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello Suhas,&lt;/P&gt;&lt;P&gt;could you please provide me an example about the suggested solution? Thanks a lot &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;I'm evaluating the idea of a range table and I'm getting curious about Regular Expression processing in ABAP...&lt;/P&gt;&lt;P&gt;Considering that:&lt;/P&gt;&lt;P&gt;- I will loop on a table done as described in the first post;&lt;/P&gt;&lt;P&gt;- every assignment is a simple '=' sign&lt;/P&gt;&lt;P&gt;is there a way to write in abap a code that simply takes the value between ' (single quote mark) after an "equal" (=) sign?&lt;/P&gt;&lt;P&gt;Sounds like a pattern matching issue, something like "when string contains a pattern which is " = 'XY' ", no matter what XY are, take XY and fill the range table.&lt;/P&gt;&lt;P&gt;This sounds to me as the clearer way to accomplish the task; can anyone help me providing an example or documentation about that? I'm not so sure that's feasible in ABAP/4...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matteo Montalto on Apr 19, 2010 11:24 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Apr 2010 08:03:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749346#M1459884</guid>
      <dc:creator>matteo_montalto</dc:creator>
      <dc:date>2010-04-19T08:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749347#M1459885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be you should check the OPTIONS field of the range table. To match patterns to have to use OPTIONS = 'CP' (Contains Pattern) &amp;amp; pass the pattern '* pattern *' (SAP interprets * as a wild character while searching against the pattern)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Range table is similar to SELECT-OPTIONS, read this documentation on the possible values of OPTION &amp;amp; its impact: [http://help.sap.com/abapdocu_70/en/ABAPSELECT-OPTIONS.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Apr 19, 2010 3:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Apr 2010 10:03:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749347#M1459885</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-04-19T10:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statement - evaluate a condition stored in a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749348#M1459886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Suhas, probably I was not that clear before, anyway... I'll try to explain the idea:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) define a range table for the value I'd like to check for (AUSP1):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: range_ausp1 TYPE RANGE OF clobjdat-ausp1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) define a workarea of the above table;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF wa_ausp1 ,
          sign(1),
          option(2),
          low  TYPE  clobjdat-ausp1,
          END   OF wa_ausp1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) now process the iTab and look for conditions (tipically, for any ' = 'XY' ' pattern, take XY &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP at wheretab.
IF "conditional statement based on the above assertions
      wa_ausp1-sign = 'I'.
      wa_ausp1-option = 'EQ'. "no need of CP here, since I'm checking on exact values
      wa_ausp1-low = XY.
      APPEND wa_ausp1 TO range_ausp1.
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) I can finally check if the value AUSP1 on my table respects the condition:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF my_doc_itab_specs-AUSP1 IN range_ausp1.
  "ok
ELSE
 "ko.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, my problem is how to formulate the conditional statement at point 3). I will always be something as:&lt;/P&gt;&lt;P&gt;param = 'XY' &lt;/P&gt;&lt;P&gt;where XY are two numbers and apostrophes are part of the string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matteo Montalto on Apr 19, 2010 12:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Apr 2010 10:19:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-statement-evaluate-a-condition-stored-in-a-string/m-p/6749348#M1459886</guid>
      <dc:creator>matteo_montalto</dc:creator>
      <dc:date>2010-04-19T10:19:04Z</dc:date>
    </item>
  </channel>
</rss>

