<?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: General SINGLE STATEMENT QUERY in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403410#M194883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No,  because you are not using parenthesis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure to use parenthesis.   In your statement you are saying that I want record where MATNR = the_material and where plant is = 'ABC'    OR   forget about the material and where the plant = 'DEF'.  Adding parenthesis, will help out your AND/OR logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select single ausme into itab-ausme
from marc
where matnr = itab-matnr
and ( werks = 'ABC'
OR WERKS = 'DEF' ).


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jun 2006 18:47:32 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-06-29T18:47:32Z</dc:date>
    <item>
      <title>General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403409#M194882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to read the unit of measure from marc table.&lt;/P&gt;&lt;P&gt;The whole program was hard coded for one plant ,now they added few more materials under different plant.&lt;/P&gt;&lt;P&gt;My orginal statement was like this&lt;/P&gt;&lt;P&gt;select single ausme into itab-ausme&lt;/P&gt;&lt;P&gt;                       from marc&lt;/P&gt;&lt;P&gt;                       where matnr = itab-matnr&lt;/P&gt;&lt;P&gt;                                and werks = 'ABC'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOW IAM CHANGING IT TO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single ausme into itab-ausme&lt;/P&gt;&lt;P&gt;                 from marc&lt;/P&gt;&lt;P&gt;                 where matnr = itab-matnr&lt;/P&gt;&lt;P&gt;                  and werks = 'ABC'&lt;/P&gt;&lt;P&gt;                  OR WERKS = 'DEF'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anybody tell me how does it work&lt;/P&gt;&lt;P&gt;I thought it would first check plant ABC ,IF ITS NOT FOUND IN PLANT ABC THEN IT WOULD CHECK pLANT DEF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lET ME KNOW WHETHER IAM RIGHT OR NOT?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 18:43:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403409#M194882</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-29T18:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403410#M194883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No,  because you are not using parenthesis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure to use parenthesis.   In your statement you are saying that I want record where MATNR = the_material and where plant is = 'ABC'    OR   forget about the material and where the plant = 'DEF'.  Adding parenthesis, will help out your AND/OR logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select single ausme into itab-ausme
from marc
where matnr = itab-matnr
and ( werks = 'ABC'
OR WERKS = 'DEF' ).


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 18:47:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403410#M194883</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-06-29T18:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403411#M194884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change it this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select single ausme into itab-ausme
  from marc
 where matnr = itab-matnr
   and ( werks = 'ABC'OR 
         WERKS = 'DEF' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 18:47:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403411#M194884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-29T18:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403412#M194885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best way would be to put it into a select-option and default it at the initialization event. That way, if (when) they want to add more plants, the user just changes the selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 19:08:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403412#M194885</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-29T19:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403413#M194886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or use,&lt;/P&gt;&lt;P&gt;select single ausme into itab-ausme&lt;/P&gt;&lt;P&gt;  from marc&lt;/P&gt;&lt;P&gt; where matnr = itab-matnr&lt;/P&gt;&lt;P&gt;   and werks in ( 'ABC' OR 'DEF' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but how you will know the retrieved AUSME value is for what plant ??? so its better to use PLANT(WERKS) also in the select condition.&lt;/P&gt;&lt;P&gt;select single werks&lt;/P&gt;&lt;P&gt;              ausme&lt;/P&gt;&lt;P&gt;              into (itab-werks,&lt;/P&gt;&lt;P&gt;                    itab-ausme)&lt;/P&gt;&lt;P&gt;              from marc&lt;/P&gt;&lt;P&gt;              where matnr = itab-matnr&lt;/P&gt;&lt;P&gt;              and werks in ( 'ABC' OR 'DEF' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YOu also hardcoding the PLANT values in the selection screen.instead you can use a Select-option displayed on the selection-screen &amp;amp; use that select options in the where clause like&lt;/P&gt;&lt;P&gt;   where WERKS IN S_WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;srikanth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Srikanth Kidambi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 19:11:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403413#M194886</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-29T19:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403414#M194887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MARC might have entrys for one plant or both plants.&lt;/P&gt;&lt;P&gt;Select statement does not check for entry in plant DEF if not found for ABC, but selection stops after selecting first record. it might be ABC or DEF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If primary key exists in the database (Usually do), it'll be sorted and you get ABC if both plants have records in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sridhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 19:14:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403414#M194887</guid>
      <dc:creator>sridhar_k1</dc:creator>
      <dc:date>2006-06-29T19:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: General SINGLE STATEMENT QUERY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403415#M194888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thxs Guys for your valuable input and time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 19:50:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/general-single-statement-query/m-p/1403415#M194888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-29T19:50:21Z</dc:date>
    </item>
  </channel>
</rss>

