<?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: Join two tables problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936638#M1151450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try the following :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select matnr
from A512 into corresponding fields of table g_T_A512
where date =  sy-datum.

select * from EBAN
into table g_t_eban
for all entries in the table g_t_A512
where matnr NE g_t_A512-matnr.

if sy-subrc eq 0.
* Display the EBAN record
else.
* check whether the A512 record is valid for todays date (DATAB and DATBI fields. )
endif.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mansi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Dec 2008 08:25:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-10T08:25:22Z</dc:date>
    <item>
      <title>Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936636#M1151448</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 want to select all rows from table &lt;STRONG&gt;EBAN&lt;/STRONG&gt; where the values for &lt;STRONG&gt;MATNR&lt;/STRONG&gt; is not in table &lt;STRONG&gt;A512&lt;/STRONG&gt;  as on date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example: Material 1000012 exists in my row in eban.&lt;/P&gt;&lt;P&gt;I have to check if it exists or not in table A512. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is missing - I have to display the eban record. &lt;/P&gt;&lt;P&gt;If it is found then I have to check whether the A512 record is valid for todays date (DATAB and DATBI fields. )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me how do I do it using a query rather than selecting twice and then looping and deleting records. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abdullah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 08:18:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936636#M1151448</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T08:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936637#M1151449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Select * from EBAN into table t_eban where...........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from A512 into table t_a512 where........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at t_eban.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table t_a521 with key matnr = t_eban-matnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check whether the A512 record is valid for todays date &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;display the eban record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 08:24:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936637#M1151449</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T08:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936638#M1151450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try the following :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select matnr
from A512 into corresponding fields of table g_T_A512
where date =  sy-datum.

select * from EBAN
into table g_t_eban
for all entries in the table g_t_A512
where matnr NE g_t_A512-matnr.

if sy-subrc eq 0.
* Display the EBAN record
else.
* check whether the A512 record is valid for todays date (DATAB and DATBI fields. )
endif.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mansi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 08:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936638#M1151450</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T08:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936639#M1151451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will require me to loop and delete individual records. Well that was there in my mind. I just wanted to know if I could join the two tables in a way that the query returns me the result rather than deleting records in a loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 08:43:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936639#M1151451</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T08:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936640#M1151452</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;Try this code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a~matnr&lt;/P&gt;&lt;P&gt;  from EBAN as a&lt;/P&gt;&lt;P&gt;  INTO TABLE ITAB&lt;/P&gt;&lt;P&gt;  INNER jOIN ON A512 AS B&lt;/P&gt;&lt;P&gt;WHERE NOT A&lt;SUB&gt;MATNR = B&lt;/SUB&gt;MATNR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 08:52:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936640#M1151452</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T08:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936641#M1151453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try a LEFT OUTER JOIN between EBAN and A512. In the WHERE-condition you can then check for any A512 field, if it is blank OR there is no date range covering today's date, then you want the EBAN row in your result. Make sure you use all primary key fields of A512 in the ON-conditions of the join.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 08:59:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936641#M1151453</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-12-10T08:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936642#M1151454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could you try to build a range of MATNR at first.&lt;/P&gt;&lt;P&gt;Select records from A512 WHERE matnr IN MATNR and date = todays date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Build a range of matnr from the data selected above ie a512_MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select data from EBAN where matnr IN MATNR and MATNR not IN a512_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Building the ranges table should not be very time consuming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do revert if you need anything further on this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 09:08:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-two-tables-problem/m-p/4936642#M1151454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T09:08:16Z</dc:date>
    </item>
  </channel>
</rss>

