<?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: Is it possible to dynamically replace a comparison operator? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957357#M1337114</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello friends, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your replies, However, there is far more involved than I have written in my example. I tried to give a very simplified pseudo code. My objective is exactly the opposite of the suggested solutions so far. That is to say, I'd like to avoid repeating  the same SELECT statement twice lest a minor difference. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input. Am still listening.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Aug 2009 10:28:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-06T10:28:15Z</dc:date>
    <item>
      <title>Is it possible to dynamically replace a comparison operator?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957354#M1337111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to change a comparison operator dynamically? For example: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF A = B. &lt;/P&gt;&lt;P&gt;then w_operator =   '&amp;gt;'  . &lt;/P&gt;&lt;P&gt;else. &lt;/P&gt;&lt;P&gt;w_operator  = '&amp;lt;'. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * From ZTABLE where DATE    w_operator    SY-DATUM. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;Your help is greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 10:04:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957354#M1337111</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-06T10:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to dynamically replace a comparison operator?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957355#M1337112</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;Well am not sure if that is possible , anyway u can use the normal method as i dont see any harm in using it performance wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

if A = B.
Select * From ZTABLE where DATE  &amp;gt; SY-DATUM. 
else.
Select * From ZTABLE where DATE  &amp;lt; SY-DATUM. 
endif. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 10:17:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957355#M1337112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-06T10:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to dynamically replace a comparison operator?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957356#M1337113</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;Insted you can write your query directly like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF A = B. 
 Select * 
 From ZTABLE 
 where DATE GT SY-DATUM.  
ELSE. 
Select * 
 From ZTABLE 
 where DATE LT SY-DATUM. 
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 10:20:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957356#M1337113</guid>
      <dc:creator>sridhar_meesala</dc:creator>
      <dc:date>2009-08-06T10:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to dynamically replace a comparison operator?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957357#M1337114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello friends, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your replies, However, there is far more involved than I have written in my example. I tried to give a very simplified pseudo code. My objective is exactly the opposite of the suggested solutions so far. That is to say, I'd like to avoid repeating  the same SELECT statement twice lest a minor difference. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input. Am still listening.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 10:28:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957357#M1337114</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-06T10:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to dynamically replace a comparison operator?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957358#M1337115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
TABLES:mara.

DATA:w_operator TYPE c.
DATA:a TYPE i,b TYPE i.
DATA:LT TYPE C VALUE '&amp;lt;',GT TYPE C VALUE '&amp;gt;'.

TYPES:BEGIN OF ty_where,
      where_clause TYPE char255,
    END OF ty_where.

DATA:it_where TYPE TABLE OF ty_where,
     wa_where TYPE ty_where.

a = b = 1.

IF a = b.
  w_operator = GT .
ELSE.
  w_operator = LT.
ENDIF.

CONCATENATE 'DATE' w_operator sy-datum INTO wa_where-where_clause SEPARATED BY space..
APPEND wa_where TO it_where.


SELECT SINGLE * FROM mara   WHERE (it_where).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Keshu Thekkillam on Aug 6, 2009 4:14 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 10:34:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957358#M1337115</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-08-06T10:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to dynamically replace a comparison operator?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957359#M1337116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use a RANGE and an IN operator, like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA r_date TYPE RANGE OF syst-datum WITH HEADER LINE.

REFRESH r_date.
CLEAR r_date.
r_date-sign = 'I'.
IF A = B.
  r_date-option = 'GT'.
ELSE.
  r_date-option = 'LT'.
ENDIF.
r_date-low = sy-datum.
APPEND r_date.

SELECT * FROM ztable WHERE date IN r_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; Regards, &lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 10:47:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-dynamically-replace-a-comparison-operator/m-p/5957359#M1337116</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2009-08-06T10:47:49Z</dc:date>
    </item>
  </channel>
</rss>

