<?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 ABAP SQL problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713914#M894034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to write a query in ABAP language .&lt;/P&gt;&lt;P&gt;There are two tables T1 and T2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1 has following data: 3 roles&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Groupname&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------" /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ROLE1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ROLE2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt; &lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ROLE3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T2 has following data &lt;/P&gt;&lt;P&gt;Groupname  desc        language&lt;/P&gt;&lt;P&gt;ROLE1         e1desc    ,EN&lt;/P&gt;&lt;P&gt;ROLE1         d1desc    ,DE&lt;/P&gt;&lt;P&gt;ROLE1         s1desc    ,SP&lt;/P&gt;&lt;P&gt;ROLE2         e2desc    ,EN&lt;/P&gt;&lt;P&gt;ROLE2         d2desc    ,DE&lt;/P&gt;&lt;P&gt;ROLE2         s2desc    ,SP&lt;/P&gt;&lt;P&gt;ROLE3         e3desc    ,EN&lt;/P&gt;&lt;P&gt;ROLE3         s3desc    ,SP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i want the o/p as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ROLE1     	d1desc    &lt;/P&gt;&lt;P&gt;ROLE2     	d2desc    &lt;/P&gt;&lt;P&gt;ROLE3     	NULL    &lt;/P&gt;&lt;P&gt;ROLE3     	NULL    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could write the following sql query:&lt;/P&gt;&lt;P&gt;select distinct T1.groupname ,T2.groupdesc from T1 ,T2 where &lt;/P&gt;&lt;P&gt;T1.groupname = T2.groupname  AND T1.groupname NOT IN (&lt;/P&gt;&lt;P&gt;select T2.groupname from T2 where langauge='DE')&lt;/P&gt;&lt;P&gt;UNION&lt;/P&gt;&lt;P&gt;select T1.groupname,T2.groupdesc from T1,T2 where T1.groupname = T2.groupname and  langauge='DE'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the same to be written in ABAP editor.&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Apr 2008 11:02:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-28T11:02:07Z</dc:date>
    <item>
      <title>ABAP SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713914#M894034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to write a query in ABAP language .&lt;/P&gt;&lt;P&gt;There are two tables T1 and T2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1 has following data: 3 roles&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Groupname&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------" /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ROLE1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ROLE2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt; &lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ROLE3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T2 has following data &lt;/P&gt;&lt;P&gt;Groupname  desc        language&lt;/P&gt;&lt;P&gt;ROLE1         e1desc    ,EN&lt;/P&gt;&lt;P&gt;ROLE1         d1desc    ,DE&lt;/P&gt;&lt;P&gt;ROLE1         s1desc    ,SP&lt;/P&gt;&lt;P&gt;ROLE2         e2desc    ,EN&lt;/P&gt;&lt;P&gt;ROLE2         d2desc    ,DE&lt;/P&gt;&lt;P&gt;ROLE2         s2desc    ,SP&lt;/P&gt;&lt;P&gt;ROLE3         e3desc    ,EN&lt;/P&gt;&lt;P&gt;ROLE3         s3desc    ,SP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i want the o/p as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ROLE1     	d1desc    &lt;/P&gt;&lt;P&gt;ROLE2     	d2desc    &lt;/P&gt;&lt;P&gt;ROLE3     	NULL    &lt;/P&gt;&lt;P&gt;ROLE3     	NULL    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could write the following sql query:&lt;/P&gt;&lt;P&gt;select distinct T1.groupname ,T2.groupdesc from T1 ,T2 where &lt;/P&gt;&lt;P&gt;T1.groupname = T2.groupname  AND T1.groupname NOT IN (&lt;/P&gt;&lt;P&gt;select T2.groupname from T2 where langauge='DE')&lt;/P&gt;&lt;P&gt;UNION&lt;/P&gt;&lt;P&gt;select T1.groupname,T2.groupdesc from T1,T2 where T1.groupname = T2.groupname and  langauge='DE'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the same to be written in ABAP editor.&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:02:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713914#M894034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713915#M894035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select distint a&lt;SUB&gt;field1 b&lt;/SUB&gt;field2 b~field3&lt;/P&gt;&lt;P&gt;from tab1 as a left outer join tab2 as b&lt;/P&gt;&lt;P&gt;on a&lt;SUB&gt;field1 = b&lt;/SUB&gt;field1&lt;/P&gt;&lt;P&gt; into corresponding fields of table lt_itab&lt;/P&gt;&lt;P&gt;where language = sy-language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this was helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:06:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713915#M894035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713916#M894036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manoj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  itab1 TYPE TABLE OF T1,
  itab2 TYPE TABLE OF T2.

SELECT *
  FROM T1
  INTO TABLE itab1.  

SELECT *
  FROM T2
  INTO TABLE itab2
   FOR ALL ENTRIES IN itab1
 WHERE role EQ itab1-role
   AND lang EQ 'DE'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;or using Join:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT T1~Groupname T2~desc
  FROM T1 LEFT OUTER JOIN T2
    ON T1~groupname = T2~groupname
   AND T2~language EQ 'DE'.&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;Sunil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:07:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713916#M894036</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713917#M894037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can write two diff Queries depending upon ur selection or else write Join &lt;/P&gt;&lt;P&gt;select distint T1&lt;SUB&gt;field1 T2&lt;/SUB&gt;field2 T2~field3&lt;/P&gt;&lt;P&gt;from table1 as T1 left outer join table2 as T2&lt;/P&gt;&lt;P&gt;on T1&lt;SUB&gt;field1 = T2&lt;/SUB&gt;field1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(here list all the possible common fields)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into corresponding fields of table lt_itab&lt;/P&gt;&lt;P&gt;where language = sy-language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:09:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713917#M894037</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713918#M894038</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;Thanks for the reply.&lt;/P&gt;&lt;P&gt;But if you see the table contents the  'ROLE3' is not there in T2 table.&lt;/P&gt;&lt;P&gt;As a result i would loose ROLE3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My aim is as follows:&lt;/P&gt;&lt;P&gt;a)In a single query ,i shoudl be able to get all the role names in T1 table &lt;/P&gt;&lt;P&gt;b)If i give language as  query parameter i shoudl be able to get the dec in that particulra lang from T2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;though 'ROLE3' does  not have any description in 'DE' ,i should not loose 'ROLE3'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:59:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713918#M894038</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713919#M894039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry if i have not told the problem clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing a BAPI which ABAP code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table in which is should collect data is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AGR_NAME CHAR(30)&lt;/P&gt;&lt;P&gt;SPACE        CHAR(1)&lt;/P&gt;&lt;P&gt;TEXT            CHAR(80)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the code to behave as follows:&lt;/P&gt;&lt;P&gt;=============================&lt;/P&gt;&lt;P&gt;select groupname from t1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While(Entires in T1 not finished)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       select desc from T2 where groupname = t&amp;lt;i&amp;gt;.groupname and &lt;/P&gt;&lt;P&gt;      language = 'lang'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if(record found)&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;P&gt;              AGR_NAME = t&amp;lt;i&amp;gt;.groupname ;&lt;/P&gt;&lt;P&gt;              TEXT = desc&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     else&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;             AGR_NAME = t&amp;lt;i&amp;gt;.groupname ;&lt;/P&gt;&lt;P&gt;             TEXT = desc ="";&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the entire table has to be returned&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 12:51:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-sql-problem/m-p/3713919#M894039</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T12:51:05Z</dc:date>
    </item>
  </channel>
</rss>

