<?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: Compare Select-Options against a Range in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061555#M1969392</link>
    <description>&lt;P&gt;Usually this requirement is achieved at the moment you want to use S_PARTNR (either in SELECT or in a conditional statement), and you add the other range:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT(*) FROM ... &lt;BR /&gt;           WHERE partner IN s_partnr&lt;BR /&gt;             AND partner IN lr_range ...&lt;BR /&gt;IF sy-subrc = 0.
  MESSAGE 'error your selection is wrong' TYPE 'E'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note that your example doesn't need a range, and can be written with the operator BETWEEN:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT(*) FROM ... 
           WHERE partner IN s_partnr
             AND partner BETWEEN '0010000000' AND '0069999999' ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 17 Aug 2019 08:54:07 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2019-08-17T08:54:07Z</dc:date>
    <item>
      <title>Compare Select-Options against a Range</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061552#M1969389</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
  &lt;P&gt;I have a Requirement that wants to exclude all Partner Numbers that aren't between 0010000000 and 0069999999. One simple way is to fill a range and compare all the values inside the Select-Options:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  APPEND INITIAL LINE TO lr_range ASSIGNING &amp;lt;fs_range&amp;gt;.
  &amp;lt;fs_range&amp;gt;-sign   = 'I'.
  &amp;lt;fs_range&amp;gt;-option = 'NB'.
  &amp;lt;fs_range&amp;gt;-low    = '0010000000'.
  &amp;lt;fs_range&amp;gt;-high   = '0069999999'.

  IF s_partnr IS NOT INITIAL.
    LOOP AT s_partnr[] ASSIGNING &amp;lt;fs_range&amp;gt;.


      IF &amp;lt;fs_range&amp;gt;-low  IS NOT INITIAL AND
         &amp;lt;fs_range&amp;gt;-low  IN lr_range[].
        pi_error = abap_true.
        EXIT.
      ENDIF.


      IF &amp;lt;fs_range&amp;gt;-high IS NOT INITIAL AND
         &amp;lt;fs_range&amp;gt;-high IN lr_range[].
        pi_error = abap_true.
        EXIT.
      ENDIF.


    ENDLOOP.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;(The "&amp;lt;fs_range&amp;gt;-low IS NOT INITIAL" is for avoiding the comparison between empty and the range).&lt;/P&gt;
  &lt;P&gt;But this way I'm not taking advantage of all the logic the ranges have behind, meaning that if the user inputs "sign=I option=GT low=0010000008 high=empty" in the Select-Options, the requirement wouldn't get fulfulied since it would include values higher than 0069999999.&lt;/P&gt;
  &lt;P&gt;I tried the following:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;    LOOP AT s_partnr[] ASSIGNING &amp;lt;fs_range&amp;gt;.

      IF &amp;lt;fs_range&amp;gt; IN lr_range[]. " With and without the brackets
        pi_error = abap_true.
        EXIT.
      ENDIF.

    ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; Didn't work. I thought this way the Select-Option values would be respected as a range, but the value that is being compared is the entire workarea (for example: IBT0000000009999999999).&lt;/P&gt;
  &lt;P&gt;Can you help me?&lt;/P&gt;
  &lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 18:35:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061552#M1969389</guid>
      <dc:creator>ezequieldiazpierri</dc:creator>
      <dc:date>2019-08-16T18:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Select-Options against a Range</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061553#M1969390</link>
      <description>&lt;P&gt;check this if it suits your requirement&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data gv_partner TYPE bu_partner.
SELECT-OPTIONS : lr_range for gv_partner.
data lt_range LIKE TABLE OF lr_range.
START-OF-SELECTION.
APPEND INITIAL LINE TO lt_range ASSIGNING FIELD-SYMBOL(&amp;lt;fs_range&amp;gt;).
  &amp;lt;fs_range&amp;gt;-sign   = 'I'.
  &amp;lt;fs_range&amp;gt;-option = 'NB'.
  &amp;lt;fs_range&amp;gt;-low    = '0010000000'.
  &amp;lt;fs_range&amp;gt;-high   = '0069999999'.

  SELECT partner FROM but000 INto TABLE @data(lt_partner)
    where partner in @lr_range and partner in  @lt_range.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Aug 2019 04:39:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061553#M1969390</guid>
      <dc:creator>former_member230215</dc:creator>
      <dc:date>2019-08-17T04:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Select-Options against a Range</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061554#M1969391</link>
      <description>&lt;P&gt;or this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data gv_partner TYPE bu_partner.
data lt_range LIKE TABLE OF lr_range.
data lt_partner2 TYPE TABLE OF bu_partner.
SELECT-OPTIONS : lr_range for gv_partner.
START-OF-SELECTION.
APPEND INITIAL LINE TO lt_range ASSIGNING FIELD-SYMBOL(&amp;lt;fs_range&amp;gt;).
  &amp;lt;fs_range&amp;gt;-sign   = 'I'.
  &amp;lt;fs_range&amp;gt;-option = 'NB'.
  &amp;lt;fs_range&amp;gt;-low    = '0010000000'.
  &amp;lt;fs_range&amp;gt;-high   = '0069999999'.

  SELECT partner FROM but000 INto TABLE @data(lt_partner)
    where partner in @lr_range .

LOOP AT lt_partner INTO DATA(ls_partner) where partner in lt_range.
APPEND ls_partner-partner to lt_partner2.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Aug 2019 04:41:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061554#M1969391</guid>
      <dc:creator>former_member230215</dc:creator>
      <dc:date>2019-08-17T04:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Select-Options against a Range</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061555#M1969392</link>
      <description>&lt;P&gt;Usually this requirement is achieved at the moment you want to use S_PARTNR (either in SELECT or in a conditional statement), and you add the other range:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT(*) FROM ... &lt;BR /&gt;           WHERE partner IN s_partnr&lt;BR /&gt;             AND partner IN lr_range ...&lt;BR /&gt;IF sy-subrc = 0.
  MESSAGE 'error your selection is wrong' TYPE 'E'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note that your example doesn't need a range, and can be written with the operator BETWEEN:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT(*) FROM ... 
           WHERE partner IN s_partnr
             AND partner BETWEEN '0010000000' AND '0069999999' ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Aug 2019 08:54:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061555#M1969392</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-08-17T08:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Select-Options against a Range</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061556#M1969393</link>
      <description>&lt;P&gt;Why my proposal couldn't "display an error message at the moment they hit Execute"?&lt;/P&gt;&lt;P&gt;No, it's not the only solution, but it's the simplest one,&lt;STRONG&gt; from far&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Aug 2019 17:20:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-select-options-against-a-range/m-p/12061556#M1969393</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-08-17T17:20:08Z</dc:date>
    </item>
  </channel>
</rss>

