<?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 QUESTION. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800674#M343788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to have both in one internal table because the user don't need to have the contract and sales order separated. So, I like to create one SELECT only to do that because after this select I need to use other selects for other tables and if I separate this select I need to duplicate the other selects, one for the contract and other for the sales order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Dec 2006 20:28:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-13T20:28:02Z</dc:date>
    <item>
      <title>SELECT QUESTION.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800670#M343784</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;OK, I need help here. In the specification I need to take out data for contracts and sales orders from the table VBAK but for contracts I need to use the VALID FROM and VALID TO parameters but for the sales orders I need for the date only the field of the document date to make the search. I don't want to use two SELECTS for the same table. Exist a way to make this with one SELECT only?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The validation that I need to use for the search are:&lt;/P&gt;&lt;P&gt;AUART - Document Type&lt;/P&gt;&lt;P&gt;GUEBG - Valid From&lt;/P&gt;&lt;P&gt;GUEEN - Valid To &lt;/P&gt;&lt;P&gt;AUDAT - Document Date&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;For contracts:&lt;/P&gt;&lt;P&gt;Document Type: 'ZCBH and ZCBTR'&lt;/P&gt;&lt;P&gt;The Valid From : = 11/30/2006&lt;/P&gt;&lt;P&gt;The Valid To:    &amp;gt;= 11/30/2006&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For sales orders: &lt;/P&gt;&lt;P&gt;Document Type: 'ZHCD and ZBRC'.&lt;/P&gt;&lt;P&gt;Document Date: only the month of december.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;For the moment I have this: but I want one select not two.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*FOR CONTRACT
SELECT VBLEN KUNNR 
  FROM VBAK INTO TABLE T_VBAK1
  WHERE AUART = ZCBH
    AND AUART = ZCBR
    AND GUEBG = 20061130
    OR  GUEEN &amp;gt; 20061130.

*FOR SALES ORDERS.    
SELECT VBLEN KUNNR
  FROM VBAK INTO TABLE T_VBAK2
  WHERE AUART = ZHCS
    AND AUART = ZBRC
    AND AUDAT+4(2) = '12'.  
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2006 20:10:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800670#M343784</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-13T20:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT QUESTION.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800671#M343785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need them into two separate internal tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2006 20:14:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800671#M343785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-13T20:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT QUESTION.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800672#M343786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use AND for multiple AUART fields as it will fail. You must OR for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides you can try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT VBLEN KUNNR &lt;/P&gt;&lt;P&gt;  FROM VBAK INTO TABLE T_VBAK1&lt;/P&gt;&lt;P&gt;  WHERE ( AUART = ZCBH&lt;/P&gt;&lt;P&gt;    OR AUART = ZCBR&lt;/P&gt;&lt;P&gt;    OR AUART = ZHCS&lt;/P&gt;&lt;P&gt;    OR AUART = ZBRC ) &lt;/P&gt;&lt;P&gt;    AND GUEBG = 20061130&lt;/P&gt;&lt;P&gt;    AND GUEEN &amp;gt; 20061130.&lt;/P&gt;&lt;P&gt;    AND AUDAT+4(2) = '12'.&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;Kathirvel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2006 20:19:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800672#M343786</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-13T20:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT QUESTION.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800673#M343787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try with this code.&lt;/P&gt;&lt;P&gt;You need to mix both WHERE conditions as a single condition under one SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT VBLEN KUNNR &lt;/P&gt;&lt;P&gt;  FROM VBAK INTO TABLE T_VBAK1&lt;/P&gt;&lt;P&gt;  WHERE ( AUART = ZCBH&lt;/P&gt;&lt;P&gt;    OR AUART = ZCBR )&lt;/P&gt;&lt;P&gt;    AND ( GUEBG = '20061130'&lt;/P&gt;&lt;P&gt;    OR  GUEEN &amp;gt; '20061130' )&lt;/P&gt;&lt;P&gt;    AND ( AUDAT &amp;gt;= '20061201'&lt;/P&gt;&lt;P&gt;      OR  AUDAT &amp;lt;= '20061231' ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Note: Plz reward all helpful answers and close the thread if the problem is solved.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2006 20:20:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800673#M343787</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-13T20:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT QUESTION.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800674#M343788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to have both in one internal table because the user don't need to have the contract and sales order separated. So, I like to create one SELECT only to do that because after this select I need to use other selects for other tables and if I separate this select I need to duplicate the other selects, one for the contract and other for the sales order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2006 20:28:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800674#M343788</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-13T20:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT QUESTION.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800675#M343789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT vbeln kunnr auart
  FROM vbak INTO TABLE itab
  WHERE ( (   auart = 'ZCBH'                 "Contracts
       OR     auart = 'ZCBR' )
      AND     guebg &amp;gt;= '20061130' )
       OR ( ( auart = 'ZHCS'                 "Orders
       OR     auart = 'ZBRC' )
       OR     audat LIKE '____12%' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changed the expression in LIKE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rob Burbank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2006 20:31:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-question/m-p/1800675#M343789</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-13T20:31:34Z</dc:date>
    </item>
  </channel>
</rss>

