<?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 subquery error in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528956#M1263252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Experts....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writting a subquery where i want to select S1 and s5&lt;/P&gt;&lt;P&gt;  and in my main query i want to select s5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my criteria is such that i  want to take the resigned and joined date &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;am taking the s5 - Begda  where i can get the&lt;/P&gt;&lt;P&gt; resigned employee date of type(S5) and joined date (BEGDA) in S1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PERNR      ENDDA      BEGDA      MASSN
                                      
00000009   31.01.2007 22.03.1993 S1   
00000009   31.12.9999 01.02.2007 S5&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have written the query as below but getting an error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select pernr begda endda massn from pa0000 into corresponding fields  of table it_pa0000
     where begda &amp;lt;= sy-datum and 
          endda  &amp;gt;= sy-datum  and 
          massn = 'S1' ( select pernr massn from pa0000 into corresponding fields of table it_pa0000
                                           where massn = 'S5' )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanx in advance &lt;/P&gt;&lt;P&gt;RachelArun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Apr 2009 10:32:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-16T10:32:37Z</dc:date>
    <item>
      <title>subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528956#M1263252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Experts....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writting a subquery where i want to select S1 and s5&lt;/P&gt;&lt;P&gt;  and in my main query i want to select s5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my criteria is such that i  want to take the resigned and joined date &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;am taking the s5 - Begda  where i can get the&lt;/P&gt;&lt;P&gt; resigned employee date of type(S5) and joined date (BEGDA) in S1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PERNR      ENDDA      BEGDA      MASSN
                                      
00000009   31.01.2007 22.03.1993 S1   
00000009   31.12.9999 01.02.2007 S5&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have written the query as below but getting an error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select pernr begda endda massn from pa0000 into corresponding fields  of table it_pa0000
     where begda &amp;lt;= sy-datum and 
          endda  &amp;gt;= sy-datum  and 
          massn = 'S1' ( select pernr massn from pa0000 into corresponding fields of table it_pa0000
                                           where massn = 'S5' )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanx in advance &lt;/P&gt;&lt;P&gt;RachelArun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 10:32:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528956#M1263252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T10:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528957#M1263253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
select pernr begda endda massn 
from pa0000 
into corresponding fields  of table it_pa0000
where begda &amp;lt;= sy-datum and 
endda  &amp;gt;= sy-datum  and 
massn = 'S1'

select pernr massn 
from pa0000 
into corresponding fields of table it_pa0000
where massn = 'S5' 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 10:37:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528957#M1263253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528958#M1263254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi kemmer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnx for the response....but i think its almost the same expect than the brackets&lt;/P&gt;&lt;P&gt;but then i still get the error &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Incorrect expression "SELECT" in logical condition.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 10:43:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528958#M1263254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T10:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528959#M1263255</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;Check this code... there is no need to subquery&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select pernr begda endda massn from pa0000 into corresponding fields  of table it_pa0000
     where begda &amp;lt;= sy-datum and 
          endda  &amp;gt;= sy-datum  and 
         ( massn = 'S1'  OR massn = 'S5' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 10:58:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528959#M1263255</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T10:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528960#M1263256</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;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;select pernr begda endda massn from pa0000 into corresponding fields  of table it_pa0000&lt;/P&gt;&lt;P&gt;     where begda &amp;lt;= sy-datum and &lt;/P&gt;&lt;P&gt;          endda  &amp;gt;= sy-datum  and &lt;/P&gt;&lt;P&gt;          massn = 'S1'  and&lt;/P&gt;&lt;P&gt;         massn = 'S5' .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:07:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528960#M1263256</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528961#M1263257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if i give so ....my condition itself will get changed .......i want to take S1 for  corresponding S5 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;not S1 or S5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:08:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528961#M1263257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528962#M1263258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanx for the reply but i am pretty sure that subquery will satisfy my requirememnt&lt;/P&gt;&lt;P&gt;but iam  not sure abt the subquery i write&lt;/P&gt;&lt;P&gt; so i need help in subquery &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select pernr begda endda massn
           from pa0000 
       into corresponding fields  of table it_pa0000
      where begda &amp;lt;= sy-datum and
      endda  &amp;gt;= sy-datum  having
      massn = 'S5' ALL ( select massn
                                           from pa0000
                                                  wher massn = 'S5' and massn = 'S1' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528962#M1263258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528963#M1263259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh well sry ic forgot the dots behind the select statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:16:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528963#M1263259</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528964#M1263260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;need not feel sorry ....thanx for the help actually....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i kept the period and tried .....i was able to do that ...but then thats not the problem....&lt;/P&gt;&lt;P&gt;first i have writen like 2 select queries and have named it as subquery and u have also modified the same &lt;/P&gt;&lt;P&gt;but jus now i found from f1 that thats not the way to do so,......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firs in my subquery i have selected both s1 and s1 and passed that to my main query  as input but again iam facing the problem &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select pernr begda endda massn
           from pa0000 
       into corresponding fields  of table it_pa0000
      where begda &amp;lt;= sy-datum and
      endda  &amp;gt;= sy-datum  having
      massn = 'S5' ALL ( select massn
                                           from pa0000
                                                  wher massn = 'S5' and massn = 'S1' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:21:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528964#M1263260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528965#M1263261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rachel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your condition you can try these selct statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr massn from pa000 into corresponding fields  of table it_pa0000_1&lt;/P&gt;&lt;P&gt;where begda &amp;lt;= sy-datum and&lt;/P&gt;&lt;P&gt;      endda  &amp;gt;= sy-datum and&lt;/P&gt;&lt;P&gt;      massn = 'S5'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr begda endda massn from pa0000 into corresponding fields of table it_pa0000&lt;/P&gt;&lt;P&gt;for all entries in it_pa0000_1&lt;/P&gt;&lt;P&gt;where massn = 'S1' and&lt;/P&gt;&lt;P&gt;      pernr = it_pa0000_1-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Surinder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:39:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528965#M1263261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: subquery error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528966#M1263262</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;Check this query..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA it_pa0000 LIKE STANDARD TABLE OF pa0000.
DATA it1_pa0000 LIKE STANDARD TABLE OF pa0000.

* Get the resigned employees here
SELECT pernr begda endda massn FROM pa0000
   INTO CORRESPONDING FIELDS  OF TABLE it_pa0000
     WHERE begda &amp;lt;= sy-datum AND
          endda  &amp;gt;= sy-datum  AND
          massn = 'S5'.

* get the joinig dates of employees who has got retired
SELECT * FROM pa0000
   INTO CORRESPONDING FIELDS  OF TABLE it1_pa0000
    FOR ALL ENTRIES IN it_pa0000
         WHERE pernr EQ it_pa0000-pernr
           AND massn = 'S5'.

" club the entries
LOOP AT it_pa0000.
  LOOP AT it1_pa0000 WHERE pernr EQ it_pa0000-pernr.
    APPEND it_p0000 TO it1_pa0000.
  ENDLOOP.
ENDLOOP .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2009 11:43:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-error/m-p/5528966#M1263262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-16T11:43:37Z</dc:date>
    </item>
  </channel>
</rss>

