<?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 Dynamic IF condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623959#M278958</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Forum!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to know if it's possible to build a dynamic logical expression for IF or CASE instructions and get it evaluated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: LogExp type string.&lt;/P&gt;&lt;P&gt;LogExp = 'Sy-subrc eq 0'.&lt;/P&gt;&lt;P&gt;IF (LogExp).&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: Var type string,&lt;/P&gt;&lt;P&gt;      LogExp type i.&lt;/P&gt;&lt;P&gt;LogExp1 = 0.&lt;/P&gt;&lt;P&gt;LogExp2 = 4.&lt;/P&gt;&lt;P&gt;Var = 'Sy-subrc'.&lt;/P&gt;&lt;P&gt;Case (Var).&lt;/P&gt;&lt;P&gt;  When (LogExp1).&lt;/P&gt;&lt;P&gt;  When (LogExp2).&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;  When others.&lt;/P&gt;&lt;P&gt;Endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Oct 2006 12:46:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-06T12:46:23Z</dc:date>
    <item>
      <title>Dynamic IF condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623959#M278958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Forum!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to know if it's possible to build a dynamic logical expression for IF or CASE instructions and get it evaluated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: LogExp type string.&lt;/P&gt;&lt;P&gt;LogExp = 'Sy-subrc eq 0'.&lt;/P&gt;&lt;P&gt;IF (LogExp).&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: Var type string,&lt;/P&gt;&lt;P&gt;      LogExp type i.&lt;/P&gt;&lt;P&gt;LogExp1 = 0.&lt;/P&gt;&lt;P&gt;LogExp2 = 4.&lt;/P&gt;&lt;P&gt;Var = 'Sy-subrc'.&lt;/P&gt;&lt;P&gt;Case (Var).&lt;/P&gt;&lt;P&gt;  When (LogExp1).&lt;/P&gt;&lt;P&gt;  When (LogExp2).&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;  When others.&lt;/P&gt;&lt;P&gt;Endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Oct 2006 12:46:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623959#M278958</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-06T12:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic IF condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623960#M278959</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; Dynamic If conditions are not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Try with subroutine pools instead..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Oct 2006 12:50:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623960#M278959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-06T12:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic IF condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623961#M278960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in general your idea of dynamic logical expression is not possible in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can use the operator IN in combination with range tables. You have define all variables in your statement. Empty range tables will be treated as true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data lt_r_subrc type range of sy-subrc.
data ls_r_subrc like line of lt_r_subrc.

ls_r_subrc-sign = 'I'.
ls_r_subrc-option = 'EQ'.
ls_r_subrc-low  = 0.
insert ls_r_subrc into table lt_r_subrc.

if sy-subrc in lt_r_subrc.
" do something
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just modify the range tables for different conditons.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Axel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Oct 2006 12:55:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-if-condition/m-p/1623961#M278960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-06T12:55:31Z</dc:date>
    </item>
  </channel>
</rss>

