<?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 Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215007#M134517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That last SELECT looks ok to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT SINGLE subid INTO t_outtab-subid
FROM estrh
WHERE recnroot = w_recnroot
      AND ( subcat = 'REAL_SUB' 
         or subcat = 'ZPURCH_SUB' )
            AND delflg = space.

if sy-subrc &amp;lt;&amp;gt; 0.
* Then don't add to the file
Endif.



&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>Wed, 29 Mar 2006 21:52:16 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-03-29T21:52:16Z</dc:date>
    <item>
      <title>Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215006#M134516</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;Program reads ESTMJ table to find the specification linked to the       material. However, multiple specifications might be linked with the material. The specification number should be output to the file based upon the specification type. In order to output specification number, we check whether the specification type is REAL_SUB or ZPURCH_SUB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The select statements have been developed in this manner :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT matnr bismt&lt;/P&gt;&lt;P&gt;      INTO t_outtab FROM mara&lt;/P&gt;&lt;P&gt;      WHERE lvorm IN s_lvorm&lt;/P&gt;&lt;P&gt;        AND kzumw IN s_kzumw&lt;/P&gt;&lt;P&gt;        AND mtart IN s_mtart .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Retrieve 'RECNROOT' given the material number&lt;/P&gt;&lt;P&gt;    CLEAR : w_recnroot.&lt;/P&gt;&lt;P&gt;    SELECT SINGLE recnroot INTO w_recnroot&lt;/P&gt;&lt;P&gt;                                FROM estmj&lt;/P&gt;&lt;P&gt;                                WHERE matnr = t_outtab-matnr&lt;/P&gt;&lt;P&gt;                                 AND delflg   = space.&lt;/P&gt;&lt;P&gt;    IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;*--- Retrieve the specification number&lt;/P&gt;&lt;P&gt; SELECT SINGLE subid INTO t_outtab-subid&lt;/P&gt;&lt;P&gt;                               FROM estrh&lt;/P&gt;&lt;P&gt;                               WHERE recnroot =&lt;/P&gt;&lt;P&gt;w_recnroot&lt;/P&gt;&lt;P&gt;                               AND delflg   = space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the code for third query as in following manner :&lt;/P&gt;&lt;P&gt;SELECT SINGLE subid INTO t_outtab-subid&lt;/P&gt;&lt;P&gt;                               FROM estrh&lt;/P&gt;&lt;P&gt;                               WHERE recnroot = w_recnroot&lt;/P&gt;&lt;P&gt;                               AND ( subcat = 'REAL_SUB' or subcat =&lt;/P&gt;&lt;P&gt;                                     'ZPURCH_SUB' )&lt;/P&gt;&lt;P&gt;                               AND delflg   = space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone suggest me whether what I have done is correct or wrong ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: varun sonu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 21:47:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215006#M134516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T21:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215007#M134517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That last SELECT looks ok to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT SINGLE subid INTO t_outtab-subid
FROM estrh
WHERE recnroot = w_recnroot
      AND ( subcat = 'REAL_SUB' 
         or subcat = 'ZPURCH_SUB' )
            AND delflg = space.

if sy-subrc &amp;lt;&amp;gt; 0.
* Then don't add to the file
Endif.



&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>Wed, 29 Mar 2006 21:52:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215007#M134517</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-03-29T21:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215008#M134518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Varun,&lt;/P&gt;&lt;P&gt;  You can change the 3rd select like this &amp;amp; check.But your select looks good..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE subid INTO t_outtab-subid&lt;/P&gt;&lt;P&gt;FROM estrh&lt;/P&gt;&lt;P&gt;WHERE recnroot = w_recnroot&lt;/P&gt;&lt;P&gt;AND subcat in ('REAL_SUB' , 'ZPURCH_SUB')&lt;/P&gt;&lt;P&gt;AND delflg = space.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 22:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215008#M134518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T22:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215009#M134519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Varun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems good. but one suggestion,  try to select the query based on RECN instead RECNROOT.  Always it is better to retrieve query on Key values to increase performance and integrity purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shylesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 22:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/1215009#M134519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T22:09:29Z</dc:date>
    </item>
  </channel>
</rss>

