<?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: Help in select in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201979#M1376186</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;If you dont want to do it dynamically with brackets, and want to make  use of a single select, check this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have to use a internal table instead of a single variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: begin of itab occues 0,
         rv_consomer type string,
         hash_de type string,
         end of itab.

data: rv_consomer type string.

SELECT consumer_O hash_de
    FROM Z_dab
    INTO table itab
    WHERE userid = iv_userid.

if hash_de is not initial .
loop at itab where hash_de = mv_hash_deviceid.
rv_consomer = itab-rv_consomer.
exit.
endloop.
else. 
read table itab index 1.
rv_consomer = itab-rv_consomer.
endif.
write: rv_consomer
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 11 Oct 2009 14:07:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-10-11T14:07:21Z</dc:date>
    <item>
      <title>Help in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201978#M1376185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all ,&lt;/P&gt;&lt;P&gt;how to Do this simple select in one time &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i had this select and i want to know if there is a way to do it in one time without if and else since it similar &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if hash_de is not initial .


SELECT SINGLE consumer_O
    FROM Z_dab
    INTO rv_consomer
    WHERE userid = iv_userid
    AND hash_de = mv_hash_deviceid.

else.

SELECT SINGLE consumer_O
    FROM Z_dab
    INTO rv_consomer
    WHERE userid = iv_userid.

endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;i know that this i can do it in dynamic way with brackets &lt;STRONG&gt;but i don't want it&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;there is other way to do it except dynamic ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Oct 2009 13:24:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201978#M1376185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-11T13:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201979#M1376186</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;If you dont want to do it dynamically with brackets, and want to make  use of a single select, check this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have to use a internal table instead of a single variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: begin of itab occues 0,
         rv_consomer type string,
         hash_de type string,
         end of itab.

data: rv_consomer type string.

SELECT consumer_O hash_de
    FROM Z_dab
    INTO table itab
    WHERE userid = iv_userid.

if hash_de is not initial .
loop at itab where hash_de = mv_hash_deviceid.
rv_consomer = itab-rv_consomer.
exit.
endloop.
else. 
read table itab index 1.
rv_consomer = itab-rv_consomer.
endif.
write: rv_consomer
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Oct 2009 14:07:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201979#M1376186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-11T14:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201980#M1376187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can just put the hash_de into a range - BTW, souldn't it be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if mv_hash_deviceid. is not initial .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then my proposal is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data:
  lt_range_hash_de type range of Z_dab-hash_de.
field-symbols:
  &amp;lt;range_hash_de&amp;gt; like line of   lt_range_hash_de.
if mv_hash_deviceid is not initial.
  append initial line to  lt_range_hash_de  assigning  &amp;lt;range_hash_de&amp;gt; .
    &amp;lt;range_hash_de&amp;gt;  = 'IEQ'. "Set SIGN = 'I', OPTION = 'EQ'
    &amp;lt;range_hash_de&amp;gt;-low = mv_hash_deviceid .
endif.
 
 
SELECT SINGLE consumer_O
    FROM Z_dab
    INTO rv_consomer
    WHERE userid = iv_userid
    AND hash_de IN lt_range_hash_de.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no mv_hash_deviceid , the range stays empty. Empty ranghes are ignored in WHERE condition.&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;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Oct 2009 15:11:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-select/m-p/6201980#M1376187</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2009-10-11T15:11:16Z</dc:date>
    </item>
  </channel>
</rss>

