<?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 this select statement okay? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939269#M62801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insert INTO or INTO CORRESPONDING FIELDS in the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have multiplea entries for ANLKL, then it is always better to build a range will all the possible values and use that in the WHERE condition of the SELECT statement using IN operator like&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;anlkl IN r_anlkl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Sep 2005 23:03:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-09-29T23:03:34Z</dc:date>
    <item>
      <title>Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939263#M62795</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;COuld you just check this:&lt;/P&gt;&lt;P&gt;This is the current code:&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM  v_anlhz&lt;/P&gt;&lt;P&gt;         WHERE  bukrs   = '3166'&lt;/P&gt;&lt;P&gt;         AND    anlkl   = 'GB060'&lt;/P&gt;&lt;P&gt;         AND    aktiv   = sy-datum&lt;/P&gt;&lt;P&gt;         AND    erdat   = sy-datum&lt;/P&gt;&lt;P&gt;         AND    txt50   = bdc_inrec-txt50&lt;/P&gt;&lt;P&gt;         AND    kostl   = v_kostl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes the value for anlkl can be XXX, so is the following code okay?&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM  v_anlhz&lt;/P&gt;&lt;P&gt;         WHERE  bukrs   = '3166'&lt;/P&gt;&lt;P&gt;         AND    anlkl   = 'GB060'&lt;/P&gt;&lt;P&gt;         OR     anlkl   = 'GB060'&lt;/P&gt;&lt;P&gt;         AND    aktiv   = sy-datum&lt;/P&gt;&lt;P&gt;         AND    erdat   = sy-datum&lt;/P&gt;&lt;P&gt;         AND    txt50   = bdc_inrec-txt50&lt;/P&gt;&lt;P&gt;         AND    kostl   = v_kostl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 13:01:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939263#M62795</guid>
      <dc:creator>former_member195355</dc:creator>
      <dc:date>2005-09-29T13:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939264#M62796</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;both the select statments into statement are missing&lt;/P&gt;&lt;P&gt;you change like that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp like v_anlhz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM v_anlhz into temp&lt;/P&gt;&lt;P&gt;WHERE bukrs = '3166'&lt;/P&gt;&lt;P&gt;AND anlkl = 'GB060'&lt;/P&gt;&lt;P&gt;AND aktiv = sy-datum&lt;/P&gt;&lt;P&gt;AND erdat = sy-datum&lt;/P&gt;&lt;P&gt;AND txt50 = bdc_inrec-txt50&lt;/P&gt;&lt;P&gt;AND kostl = v_kostl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes the value for anlkl can be XXX, so is the following code okay?&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM v_anlhz into temp&lt;/P&gt;&lt;P&gt;WHERE bukrs = '3166'&lt;/P&gt;&lt;P&gt;AND anlkl = 'GB060'&lt;/P&gt;&lt;P&gt;OR anlkl = 'GB060'&lt;/P&gt;&lt;P&gt;AND aktiv = sy-datum&lt;/P&gt;&lt;P&gt;AND erdat = sy-datum&lt;/P&gt;&lt;P&gt;AND txt50 = bdc_inrec-txt50&lt;/P&gt;&lt;P&gt;AND kostl = v_kostl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so the result will be available in temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 13:04:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939264#M62796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T13:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939265#M62797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is just the addition of '(' ')' in sasi's solution - &lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM v_anlhz into temp&lt;/P&gt;&lt;P&gt;WHERE bukrs = '3166'&lt;/P&gt;&lt;P&gt;AND anlkl = 'GB060'&lt;/P&gt;&lt;P&gt;AND aktiv = sy-datum&lt;/P&gt;&lt;P&gt;AND erdat = sy-datum&lt;/P&gt;&lt;P&gt;AND txt50 = bdc_inrec-txt50&lt;/P&gt;&lt;P&gt;AND kostl = v_kostl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes the value for anlkl can be XXX, so is the following code okay?&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM v_anlhz into temp&lt;/P&gt;&lt;P&gt;WHERE bukrs = '3166'&lt;/P&gt;&lt;P&gt;AND ( anlkl = 'GB060'&lt;/P&gt;&lt;P&gt;OR anlkl = 'GB060' )   "&amp;lt;&amp;lt;&amp;lt; change&lt;/P&gt;&lt;P&gt;AND aktiv = sy-datum&lt;/P&gt;&lt;P&gt;AND erdat = sy-datum&lt;/P&gt;&lt;P&gt;AND txt50 = bdc_inrec-txt50&lt;/P&gt;&lt;P&gt;AND kostl = v_kostl.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 13:08:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939265#M62797</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T13:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939266#M62798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try to mention what are the fields name u want, thats give good performances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 13:14:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939266#M62798</guid>
      <dc:creator>alex_m</dc:creator>
      <dc:date>2005-09-29T13:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939267#M62799</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 think into clause is not mandatory in case you are selecting all the fields. If you are selection particular no of fields then you need to specify the into clause. also when you have two/more possible values for one field in the data base table then put the brackets before and last of the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best way is you can assign that value to any variable and use that variable to that select condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 13:21:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939267#M62799</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T13:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939268#M62800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a list of Asset Classes, you can also use a RANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
RANGES: ra_anlkl for anla-anlkl.

perform add_anlkl using 'GB060'.
perform add_anlkl using 'GB070'.

form add_anlkl using pa_anlkl.
  clear ra_anlkl.
  ra_anlkl-sign   = 'EQ'.
  ra_anlkl-option = 'I'.
  ra_anlkl-low    = pa_anlkl.
  append ra_anlkl.
endform.

SELECT SINGLE * FROM v_anlhz
       WHERE bukrs = '3166'          AND
             anlkl IN ra_anlkl       AND
             aktiv = sy-datum        AND
             erdat = sy-datum        AND
             txt50 = bdc_inrec-txt50 AND
             kostl = v_kostl.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This makes your SELECT statement neater and easier to read if you want to select for multiple Asset Classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 22:50:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939268#M62800</guid>
      <dc:creator>former_member221770</dc:creator>
      <dc:date>2005-09-29T22:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Is this select statement okay?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939269#M62801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insert INTO or INTO CORRESPONDING FIELDS in the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have multiplea entries for ANLKL, then it is always better to build a range will all the possible values and use that in the WHERE condition of the SELECT statement using IN operator like&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;anlkl IN r_anlkl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 23:03:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-this-select-statement-okay/m-p/939269#M62801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T23:03:34Z</dc:date>
    </item>
  </channel>
</rss>

