<?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: While joining two tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574016#M860279</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If all you need is the latest date, you could simply do this.  Using a MAX function will minimize your database IO and network traffic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The keys of the two tables contain more than pernr.  You may need to expand on your join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: g_t_PA0008 type TABLE OF PA0008.

select max( p8~aedtm )  as max_aedtm
  into CORRESPONDING FIELDS OF TABLE g_t_PA0008
from PA0008 as p8
  inner join PA0002 as p2
    on p2~pernr = p8~pernr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Mar 2008 13:35:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-19T13:35:47Z</dc:date>
    <item>
      <title>While joining two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574013#M860276</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;&lt;/P&gt;&lt;P&gt;Assume that someone needs to join two tables called PA0002 and PA0008 with keyword PERNR and &lt;/P&gt;&lt;P&gt;that person needs to read the data of PA0008 aedtm's max.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is there are many records based on the aedtm and the user wants to read the last date update and wants to use this in join, not separately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;deniz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2008 13:20:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574013#M860276</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-19T13:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: While joining two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574014#M860277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi in the sort use this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by pernr begda descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2008 13:24:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574014#M860277</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-19T13:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: While joining two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574015#M860278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi use this..&lt;/P&gt;&lt;P&gt;report.&lt;/P&gt;&lt;P&gt;tables:pa0002,pa0008.&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;      vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;      nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;      begda like pa0002-begda,&lt;/P&gt;&lt;P&gt;      endda like pa0002-endda,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab1 occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0008-pernr,&lt;/P&gt;&lt;P&gt;      begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;      stvor like pa0008-stvor,&lt;/P&gt;&lt;P&gt;      ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;      end of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of final occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;      vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;      nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;      begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;      stvor like pa0008-stvor,&lt;/P&gt;&lt;P&gt;      ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;    end of final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options:s_pernr for pa0002-pernr.&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       vorna&lt;/P&gt;&lt;P&gt;       nachn&lt;/P&gt;&lt;P&gt;       begda&lt;/P&gt;&lt;P&gt;       endda&lt;/P&gt;&lt;P&gt;       from pa0002&lt;/P&gt;&lt;P&gt;       into table itab&lt;/P&gt;&lt;P&gt;       where pernr in s_pernr.&lt;/P&gt;&lt;P&gt;sort itab by pernr begda descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       begda&lt;/P&gt;&lt;P&gt;       stvor&lt;/P&gt;&lt;P&gt;       ansal&lt;/P&gt;&lt;P&gt;       from pa0008&lt;/P&gt;&lt;P&gt;       into table itab1&lt;/P&gt;&lt;P&gt;       for all entries in itab&lt;/P&gt;&lt;P&gt;       where pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;sort itab1 by pernr begda descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;final-pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;final-vorna = itab-vorna.&lt;/P&gt;&lt;P&gt;final-nachn = itab-nachn.&lt;/P&gt;&lt;P&gt;read table itab1 with key pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;final-begda = itab1-begda.&lt;/P&gt;&lt;P&gt;final-stvor = itab1-stvor.&lt;/P&gt;&lt;P&gt;final-ansal = itab1-ansal.&lt;/P&gt;&lt;P&gt;append final.&lt;/P&gt;&lt;P&gt;clear final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   loop at final.&lt;/P&gt;&lt;P&gt;   write:final-pernr ,&lt;/P&gt;&lt;P&gt;final-vorna ,&lt;/P&gt;&lt;P&gt;final-nachn ,&lt;/P&gt;&lt;P&gt;final-begda ,&lt;/P&gt;&lt;P&gt;final-stvor ,&lt;/P&gt;&lt;P&gt;final-ansal .&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2008 13:30:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574015#M860278</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-19T13:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: While joining two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574016#M860279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If all you need is the latest date, you could simply do this.  Using a MAX function will minimize your database IO and network traffic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The keys of the two tables contain more than pernr.  You may need to expand on your join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: g_t_PA0008 type TABLE OF PA0008.

select max( p8~aedtm )  as max_aedtm
  into CORRESPONDING FIELDS OF TABLE g_t_PA0008
from PA0008 as p8
  inner join PA0002 as p2
    on p2~pernr = p8~pernr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2008 13:35:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/while-joining-two-tables/m-p/3574016#M860279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-19T13:35:47Z</dc:date>
    </item>
  </channel>
</rss>

