<?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: UNION statement in ABAP SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196278#M468781</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't meet my requirement (my original text states "I want to achieve the results in single SQL statement")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Apr 2007 15:07:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-25T15:07:24Z</dc:date>
    <item>
      <title>UNION statement in ABAP SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196274#M468777</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;How to achieve the UNION SQL operation results in ABAP? To be specific, I want to retrieve STCD1 field value from vendor master table (LFA1) for all vendors (LIFNR) that exist in table BSIK or BSAK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I want to achieve the results in single SQL statement. So in essence, the resultant SQL would be something like:&lt;/P&gt;&lt;P&gt;SELECT STCD1&lt;/P&gt;&lt;P&gt;INTO TABLE my_internal_table&lt;/P&gt;&lt;P&gt;FROM LFA1&lt;/P&gt;&lt;P&gt;WHERE LIFNR IN (SELECT DISTINCT LIFNR &lt;/P&gt;&lt;P&gt;                                            FROM BSIK&lt;/P&gt;&lt;P&gt;                            UNION&lt;/P&gt;&lt;P&gt;                            SELECT DISTINCT LIFNR&lt;/P&gt;&lt;P&gt;                                           FROM BSAK)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the UNION is not a valid keyword in ABAP. Any idea how to achieve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chetan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 14:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196274#M468777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-25T14:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: UNION statement in ABAP SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196275#M468778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use inner join&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 14:56:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196275#M468778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-25T14:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: UNION statement in ABAP SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196276#M468779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think using JOIN solves the problem. As I stated earlier, I want to get STCD1 for vendors that are in BSIK "or" BSAK (not BSIK "AND" BSAK) so JOIN cannot be used.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 14:59:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196276#M468779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-25T14:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: UNION statement in ABAP SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196277#M468780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then try this.&lt;/P&gt;&lt;P&gt;       First get all the vendors from the BSIK into internal table gt_vendor and then get  all the vendors from the BSAK table by appending gt_vendor.&lt;/P&gt;&lt;P&gt;Fetch STCD1  from table LFA1&lt;/P&gt;&lt;P&gt;               for all entries in gt_vendor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 15:03:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196277#M468780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-25T15:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: UNION statement in ABAP SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196278#M468781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't meet my requirement (my original text states "I want to achieve the results in single SQL statement")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 15:07:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196278#M468781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-25T15:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: UNION statement in ABAP SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196279#M468782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi chetan,&lt;/P&gt;&lt;P&gt; do you have any where condition to filter the records from bsak and bsik?&lt;/P&gt;&lt;P&gt;your requirement cannot be realized in a single statement.&lt;/P&gt;&lt;P&gt;you have to use two separate selects from bsak and bsik, then, collect all the vendors in one internal table and at last you have to use this table to get the vendor info from lfa1.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 15:29:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/union-statement-in-abap-sql/m-p/2196279#M468782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-25T15:29:40Z</dc:date>
    </item>
  </channel>
</rss>

