<?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 using FREE_SELECTIONS_RANGE_2_WHERE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654905#M1445451</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 am trying to use ranges in the where clause of my select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The inputs I have is an internal table say t_selflds of type RSTI_T_PAR. So if I have 2 selection options filled with values such as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sopt1 = 10 or&lt;/P&gt;&lt;P&gt;sopt1 = 20 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sopt2 is between 20 and 50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then the values in t_selflds will be like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selname   kind   sign  option  low  high&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sopt1            I     EQ      10&lt;/P&gt;&lt;P&gt;sopt1            I     EQ      20&lt;/P&gt;&lt;P&gt;sopt2            I     BT      20   50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to form a dynamic where clause using these values such that  my where clause shud be like 'sopt1 IN range1 and sopt2 IN range2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So range1 and range2 are to be formed dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read that we can use FREE_SELECTIONS_RANGE_2_WHERE. not sure how to form the field_ranges for this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone guide me how to move the values from my t_selflds to field_ranges ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or if there is any other simple way to form the dynamic where clause with ranges for multiple fields, pl share.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Mar 2010 19:31:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-10T19:31:55Z</dc:date>
    <item>
      <title>using FREE_SELECTIONS_RANGE_2_WHERE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654905#M1445451</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 am trying to use ranges in the where clause of my select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The inputs I have is an internal table say t_selflds of type RSTI_T_PAR. So if I have 2 selection options filled with values such as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sopt1 = 10 or&lt;/P&gt;&lt;P&gt;sopt1 = 20 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sopt2 is between 20 and 50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then the values in t_selflds will be like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selname   kind   sign  option  low  high&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sopt1            I     EQ      10&lt;/P&gt;&lt;P&gt;sopt1            I     EQ      20&lt;/P&gt;&lt;P&gt;sopt2            I     BT      20   50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to form a dynamic where clause using these values such that  my where clause shud be like 'sopt1 IN range1 and sopt2 IN range2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So range1 and range2 are to be formed dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read that we can use FREE_SELECTIONS_RANGE_2_WHERE. not sure how to form the field_ranges for this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone guide me how to move the values from my t_selflds to field_ranges ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or if there is any other simple way to form the dynamic where clause with ranges for multiple fields, pl share.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 19:31:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654905#M1445451</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-10T19:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: using FREE_SELECTIONS_RANGE_2_WHERE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654906#M1445452</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;execute this function module in SE37 - in test environment,&lt;/P&gt;&lt;P&gt;system will generate structures to needed to fill table which is parameter.&lt;/P&gt;&lt;P&gt;You will see there, where you should put table, field name and values from ranges.&lt;/P&gt;&lt;P&gt;Everything is clear in this generated screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Przemysław&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 20:42:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654906#M1445452</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-10T20:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: using FREE_SELECTIONS_RANGE_2_WHERE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654907#M1445453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi,
&amp;lt;li&amp;gt;Define ranges tables like below. 
&lt;PRE&gt;&lt;CODE&gt;
DATA:t_range1 TYPE RANGE OF xyz-sopt1.
DATA:w_range1 LIKE LINE OF t_range1.
DATA:t_range2 TYPE RANGE OF xyz-sopt2.
DATA:w_range2 LIKE LINE OF t_range2.
"Please replace xyz with your database table name here.t
&lt;/CODE&gt;&lt;/PRE&gt;

&amp;lt;li&amp;gt;Build ranges tables like below. 
&lt;PRE&gt;&lt;CODE&gt;w_range1-low    = '10'.
w_range1-sign   = 'I'.
w_range1-option = 'EQ'.
APPEND w_range1to t_range1.
clear  w_range1.

w_range1-low    = '20'.
w_range1-sign   = 'I'.
w_range1-option = 'EQ'.
APPEND w_range1to t_range1.
clear  w_range1.

w_range2-low    = '10'.
w_range2-high    = '20'.
w_range2-sign   = 'I'.
w_range2-option = 'BT'.
APPEND w_range2to t_range2.
clear  w_range2.&lt;/CODE&gt;&lt;/PRE&gt;
&amp;lt;li&amp;gt;Create dynamic WHERE clause like below. 
&lt;PRE&gt;&lt;CODE&gt;
DATA:str TYPE string.
str = 'sopt1 IN range1 and sopt2 IN range2'.
"Use this STR variable in dynamic where clause.
SELECT * 
  FROM xyz
  INTO table it_xyz
WHERE (str).
"(str) contains 'sopt1 IN t_range1 and sopt2 IN t_range2' at runtime.
&lt;/CODE&gt;&lt;/PRE&gt;

Let me know if you get any problem. 

Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 22:59:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654907#M1445453</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-03-10T22:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: using FREE_SELECTIONS_RANGE_2_WHERE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654908#M1445454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;solved using FREE_SELECTIONS_RANGE_2_WHERE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Apr 2010 16:40:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-free-selections-range-2-where/m-p/6654908#M1445454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-15T16:40:38Z</dc:date>
    </item>
  </channel>
</rss>

