<?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: Subquery in ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676398#M1575570</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd say it's doable in one select.&lt;/P&gt;&lt;P&gt;Read documentation on subqueries [http://help.sap.com/saphelp_NW04/helpdata/en/dc/dc7614099b11d295320000e8353423/content.htm|http://help.sap.com/saphelp_NW04/helpdata/en/dc/dc7614099b11d295320000e8353423/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT  SINGLE city latitude longitude
  INTO  (city, lati, longi)
  FROM  sgeocity
  WHERE city IN ( select  cityfrom
                    FROM  spfli
                    WHERE carrid = carr_id AND
                          connid = conn_id      ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Feb 2011 23:26:53 GMT</pubDate>
    <dc:creator>former_member182670</dc:creator>
    <dc:date>2011-02-07T23:26:53Z</dc:date>
    <item>
      <title>Subquery in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676395#M1575567</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;I have a subquery which has to be written in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single TARIF_TYPE from table  ZTARIFF where (TARIFTYP = xxx and ANLART = mn)&lt;/P&gt;&lt;P&gt;Where xxx = select TARIFTYP from table EANLH where (ANLAGE = select ANLAGE from table EVER where VKONTO = Contract account Number)&lt;/P&gt;&lt;P&gt;Where mn = select ANLART from EANL where where (ANLAGE = select ANLAGE from table EVER where VKONTO = Contract account Number)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone give me the corresponding ABAP code for this?&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;Ayan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;MOVED FROM PI FORUMS&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prateek Raj Srivastava on Feb 8, 2011 2:33 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Feb 2011 10:11:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676395#M1575567</guid>
      <dc:creator>ayan_chaudhuri</dc:creator>
      <dc:date>2011-02-07T10:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Subquery in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676396#M1575568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ayan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you should ask that in an ABAP forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Udo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Feb 2011 10:19:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676396#M1575568</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-07T10:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Subquery in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676397#M1575569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use internal tables &amp;amp; work area for this requirement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ANLAGE from table EVER INTO &amp;lt;Internal table IT1&amp;gt;  where VKONTO = Contract account Number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ANLART from EANL INTO &amp;lt;Internal table IT2&amp;gt; &lt;/P&gt;&lt;P&gt;For all entries in IT1 where ANLAGE = IT1-ANLAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ANLAGE from table EVER INTO &amp;lt;Internal table IT3&amp;gt;  where VKONTO = Contract account Number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select TARIFTYP from table EANLH INTO &amp;lt;Internal table IT4&amp;gt; &lt;/P&gt;&lt;P&gt;For all entries in IT4 where ANLAGE = IT3-ANLAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single TARIF_TYPE from table ZTARIFF INTO &amp;lt;IT5&amp;gt;&lt;/P&gt;&lt;P&gt;for all entries in table IT4&lt;/P&gt;&lt;P&gt;where TARIFTYP = IT4-xxx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it3 into wa_it3.&lt;/P&gt;&lt;P&gt;Read table IT5 into WA_IT5 with key  ANLART = wa_it3-mn.&lt;/P&gt;&lt;P&gt;if sy-subrc is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TARIF_TYPE  = wa_it5-TARIF_TYPE .&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;Endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Feb 2011 11:01:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676397#M1575569</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-07T11:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Subquery in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676398#M1575570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd say it's doable in one select.&lt;/P&gt;&lt;P&gt;Read documentation on subqueries [http://help.sap.com/saphelp_NW04/helpdata/en/dc/dc7614099b11d295320000e8353423/content.htm|http://help.sap.com/saphelp_NW04/helpdata/en/dc/dc7614099b11d295320000e8353423/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT  SINGLE city latitude longitude
  INTO  (city, lati, longi)
  FROM  sgeocity
  WHERE city IN ( select  cityfrom
                    FROM  spfli
                    WHERE carrid = carr_id AND
                          connid = conn_id      ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Feb 2011 23:26:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676398#M1575570</guid>
      <dc:creator>former_member182670</dc:creator>
      <dc:date>2011-02-07T23:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Subquery in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676399#M1575571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry i have no means of testing this, but you could try this one.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select single TARIF_TYPE from ZTARIFF where 
  TARIFTYP = ( select single TARIFTYP from EANLH where ANLAGE = ( select single ANLAGE from EVER where VKONTO = Contract_account_Number ) ) 
  and ANLART = ( select single ANLART from EANL where ANLAGE = ( select single ANLAGE from EVER where VKONTO = Contract_account_Number ) ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 00:47:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676399#M1575571</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-08T00:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Subquery in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676400#M1575572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can joins for this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ztariff~tarif_type &lt;/P&gt;&lt;P&gt;from ever&lt;/P&gt;&lt;P&gt;join eanlh on eanl&lt;SUB&gt;anlage = ever&lt;/SUB&gt;anlage&lt;/P&gt;&lt;P&gt;join eanl on eanl&lt;SUB&gt;anlage = ever&lt;/SUB&gt;anlage&lt;/P&gt;&lt;P&gt;join ztariff on ztariff&lt;SUB&gt;tariftyp = eanlh&lt;/SUB&gt;tariftyp&lt;/P&gt;&lt;P&gt;            and ztariff&lt;SUB&gt;anlart   = eanl&lt;/SUB&gt;anlart  &lt;/P&gt;&lt;P&gt;where ever~vkonto in s_vkonto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 03:07:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subquery-in-abap/m-p/7676400#M1575572</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2011-02-08T03:07:43Z</dc:date>
    </item>
  </channel>
</rss>

