<?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: need help for sql query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726577#M316675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If that is the case you can fire two different SQL statements to maintain the readability.&lt;/P&gt;&lt;P&gt;However, in the second select make sure you use the appending key word so that you don't over write the existing data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SELECT ... into tab where ...&lt;/P&gt;&lt;P&gt;2. SELECT ... appending tab where ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still want to combine both the selects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have two ranges for the movement types and try the below statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM TAB&lt;/P&gt;&lt;P&gt; WHERE ( (BWART IN R_MVMT1 AND LGORT = 'L002') OR &lt;/P&gt;&lt;P&gt;                 (BWART IN R_MVMT2 AND ( LGORT = 'L001' AND UWLOG = 'XXX' ) ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Nov 2006 03:50:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-13T03:50:27Z</dc:date>
    <item>
      <title>need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726572#M316670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i have an input from selection-screen where user can choose a period of data,then the date is trigger by the below criteria&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. bwart ( movement type ) = 901,902,101,102,106,105 and  lgort ( recieve location ) = L002&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. bwart ( movement type )= 311,312 and lgort = L001 or umlgo = L001&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how should i code the above ? thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 03:25:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726572#M316670</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-13T03:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726573#M316671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a RANGES variable and append the data to that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R_MVMT-SIGN = 'I'.&lt;/P&gt;&lt;P&gt;R_MVMT-OPTION = 'EQ'.&lt;/P&gt;&lt;P&gt;R_MVMT-LOW = '901'.&lt;/P&gt;&lt;P&gt;APPEND R_MVMT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do the same thing for the rest of the data as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM TABLE&lt;/P&gt;&lt;P&gt; WHERE BWART IN R_MVMT AND LGORT = &lt;/P&gt;&lt;P&gt;L002'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This select can be the other one, so append the other movement type values here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM TABLE&lt;/P&gt;&lt;P&gt; WHERE BWART IN R_MVMT AND ( LGORT = L002' or UMLGO = 'L001' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I am not sure how are you planning to differentiate between those two statements and how exactly you want the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;Note - Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 03:33:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726573#M316671</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-13T03:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726574#M316672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select EBELN EBELP MATNR WESBS BWART&lt;/P&gt;&lt;P&gt;           from EKBE&lt;/P&gt;&lt;P&gt;           into table IT_EKBE&lt;/P&gt;&lt;P&gt;           where BWART in ('901,902,101,102,106,105')&lt;/P&gt;&lt;P&gt;              and LGORT = 'L002'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select EBELN EBELP MATNR WESBS BWART&lt;/P&gt;&lt;P&gt;           from EKBE&lt;/P&gt;&lt;P&gt;           into table IT_EKBE&lt;/P&gt;&lt;P&gt;           where BWART in ('311,312')&lt;/P&gt;&lt;P&gt;              and (LGORT = 'L002' or UMLGO = 'L001').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U can either do this way or create ranges for the BWART&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      R_BWART-SIGN = 'I'.&lt;/P&gt;&lt;P&gt;      R_BWART-OPTION = 'EQ'.&lt;/P&gt;&lt;P&gt;      R_BWART-LOW = 901.&lt;/P&gt;&lt;P&gt;      append R_BWART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      R_BWART-SIGN = 'I'.&lt;/P&gt;&lt;P&gt;      R_BWART-OPTION = 'EQ'.&lt;/P&gt;&lt;P&gt;      R_BWART-LOW = 902.&lt;/P&gt;&lt;P&gt;      append R_BWART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      R_BWART-SIGN = 'I'.&lt;/P&gt;&lt;P&gt;      R_BWART-OPTION = 'EQ'.&lt;/P&gt;&lt;P&gt;      R_BWART-LOW = 101.&lt;/P&gt;&lt;P&gt;      append R_BWART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      R_BWART-SIGN = 'I'.&lt;/P&gt;&lt;P&gt;      R_BWART-OPTION = 'EQ'.&lt;/P&gt;&lt;P&gt;      R_BWART-LOW = 102.&lt;/P&gt;&lt;P&gt;      append R_BWART.&lt;/P&gt;&lt;P&gt;and so on.......&lt;/P&gt;&lt;P&gt;    select EBELN EBELP MATNR WESBS BWART&lt;/P&gt;&lt;P&gt;           from EKBE&lt;/P&gt;&lt;P&gt;           into table IT_EKBE&lt;/P&gt;&lt;P&gt;           where BWART in R_BWART&lt;/P&gt;&lt;P&gt;              and LGORT = 'L002'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;- Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 03:40:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726574#M316672</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2006-11-13T03:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726575#M316673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not really sure of your requirement, whether the requirement is extract data w.r.t criteria 1 &amp;amp; 2 or only one basing on certaing condition???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming you need only one w.r.t a certain date:&lt;/P&gt;&lt;P&gt;if p_date &amp;lt; l_date.&lt;/P&gt;&lt;P&gt;  select .... from &amp;lt;table&amp;gt; into &amp;lt;itab&amp;gt; where bwart in ('901', '902', '101', '102', '106', '105') and lgort = 'L002'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  select .... from &amp;lt;table&amp;gt; into &amp;lt;itab&amp;gt; where bwart in ('311', '312') and ( lgort = 'L001' or umlgo = 'L001').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 03:41:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726575#M316673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-13T03:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726576#M316674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thx ravi n gopi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eswar, i need to extract data according to the 1 &amp;amp; 2 criteria..who shd i combine the two sql syntax together? thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 03:46:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726576#M316674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-13T03:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726577#M316675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If that is the case you can fire two different SQL statements to maintain the readability.&lt;/P&gt;&lt;P&gt;However, in the second select make sure you use the appending key word so that you don't over write the existing data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SELECT ... into tab where ...&lt;/P&gt;&lt;P&gt;2. SELECT ... appending tab where ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still want to combine both the selects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have two ranges for the movement types and try the below statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM TAB&lt;/P&gt;&lt;P&gt; WHERE ( (BWART IN R_MVMT1 AND LGORT = 'L002') OR &lt;/P&gt;&lt;P&gt;                 (BWART IN R_MVMT2 AND ( LGORT = 'L001' AND UWLOG = 'XXX' ) ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 03:50:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726577#M316675</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-13T03:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726578#M316676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Ravi ^^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 04:10:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726578#M316676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-13T04:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: need help for sql query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726579#M316677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;where ( bwart in ( '901', '902', '101', '102' , '106' ,'105') and lgort = 'L002' )&lt;/P&gt;&lt;P&gt;or       ( bwart in ('311', '312') and ( lgort = 'L001 or umlgo = 'L001' ) )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2006 04:20:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-for-sql-query/m-p/1726579#M316677</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2006-11-13T04:20:51Z</dc:date>
    </item>
  </channel>
</rss>

