<?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: SELECT statement with different where conditions.. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071195#M1355607</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;Create a ranges table for Hkont and use it in the where condition using IN operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search forum for sample codes on ranges / see F1 help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Sep 2009 12:32:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-16T12:32:23Z</dc:date>
    <item>
      <title>SELECT statement with different where conditions..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071193#M1355605</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;&lt;/P&gt;&lt;P&gt;I am using following select statement to get the data from table BSIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, i have to fetch the data abse don GL Account range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to get the data for all GL ranges that i have mentioned in the below select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select bukrs hkont gjahr belnr dmbtr shkzg projk kostl from BSIS&lt;/P&gt;&lt;P&gt;into corresponding fields of table it_othcost&lt;/P&gt;&lt;P&gt;for all entries in it_wbs&lt;/P&gt;&lt;P&gt;where bukrs = c_bukrs&lt;/P&gt;&lt;P&gt;and hkont between '0002102001' and '0002999999'&lt;/P&gt;&lt;P&gt;or hkont between '0002101001' and '0002101003'&lt;/P&gt;&lt;P&gt;or hkont between '0002101007' and '0002101009'&lt;/P&gt;&lt;P&gt;or hkont between '0002101013' and '0002101015'&lt;/P&gt;&lt;P&gt;or hkont between '0002101019' and '0002101024'&lt;/P&gt;&lt;P&gt;and gjahr eq v_year2&lt;/P&gt;&lt;P&gt;and monat between v_fmonth and v_tmonth&lt;/P&gt;&lt;P&gt;and kostl = it_wbs-kostl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me how correctly and effieciently i can write the select statement for this requirement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically the above select statement is giving incorrecct data from the database table BSIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 12:23:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071193#M1355605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T12:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement with different where conditions..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071194#M1355606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see, or is a very critical statement in select statements so it would be better if you use a range table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : s_hkont type RANGE OF hkont,
       sw_hkont LIKE LINE OF s_hkont .

sw_hkont-sign = 'I'.
sw_hkont-OPTION = 'BT'.
sw_hkont-low = '0002102001'.
sw_hkont-high = '0002999999'.
append sw_hkont to s_hkont.
clear : sw_hkont.
sw_hkont-sign = 'I'.
sw_hkont-OPTION = 'BT'.
sw_hkont-low = '0002101001'.
sw_hkont-high = '0002101003'.
append sw_hkont to s_hkont.
"similarly for other ones.

"now in you select statement use this range table
select bukrs hkont gjahr belnr dmbtr shkzg projk kostl from BSIS
into corresponding fields of table it_othco "try not to use into corresponding 
for all entries in it_wbs
where bukrs = c_bukrs
  and hkont in s_hkont. " and other options&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 12:31:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071194#M1355606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T12:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement with different where conditions..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071195#M1355607</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;Create a ranges table for Hkont and use it in the where condition using IN operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search forum for sample codes on ranges / see F1 help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 12:32:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071195#M1355607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T12:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement with different where conditions..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071196#M1355608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Populate a range for HKONT and pass all the below values .. and use it in where condition ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select bukrs hkont gjahr belnr dmbtr shkzg projk kostl from BSIS&lt;/P&gt;&lt;P&gt;into corresponding fields of table it_othcost&lt;/P&gt;&lt;P&gt;for all entries in it_wbs&lt;/P&gt;&lt;P&gt;where bukrs = c_bukrs&lt;/P&gt;&lt;P&gt;and hkont &lt;STRONG&gt;in r_hkont&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and gjahr eq v_year2&lt;/P&gt;&lt;P&gt;and monat between v_fmonth and v_tmonth&lt;/P&gt;&lt;P&gt;and kostl = it_wbs-kostl.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 12:34:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-different-where-conditions/m-p/6071196#M1355608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T12:34:12Z</dc:date>
    </item>
  </channel>
</rss>

