<?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: Inner Join. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241744#M483396</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Check this code . I tried it now and it's working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Tables: plaf,mara,makt.

Data: it_plaf type standard table of plaf.
data: it_mara type standard table of mara,
      it_makt type standard table of makt.

select-options: s_plnum for plaf-plnum,
                s_matnr for mara-matnr.

Select * from plaf into table it_plaf
         where plnum in s_plnum
         and matnr in s_matnr.

if it_plaf[] is not initial.

   select * from mara into table it_mara
          for all entries in it_plaf
          where matnr = it_plaf-matnr.

  Select * from makt into table it_makt
          for all entries in it_plaf
          where matnr = it_plaf-matnr.

endif.

Loop at it_mara into wa_mara.
read table it_plaf into wa_plaf with key matnr = wa_mara-matnr.
if sy-subrc = 0.
move-corresponding to wa_final.
endif.
read table it_makt into wa_makt witk key matnr = wa_mara-matnr.
if sy-subrc = 0.
Move-corresponding to wa_final.
endif.
append wa_final to it_final.
clear: wa_mara,wa_plaf,wa_final.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2007 16:06:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-23T16:06:46Z</dc:date>
    <item>
      <title>Inner Join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241742#M483394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a Inner join statement. I dont see any problem in DEV but i see some problems in PMT. IT duplicating the records in the output. I see the same order twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement is,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;    SELECT plaf~plnum&lt;/P&gt;&lt;P&gt;           mara&lt;SUB&gt;normt  plaf&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;           makt~maktx                                       &lt;/P&gt;&lt;P&gt;           plaf&lt;SUB&gt;pwwrk  plaf&lt;/SUB&gt;paart  plaf~verid&lt;/P&gt;&lt;P&gt;           plaf&lt;SUB&gt;auffx  plaf&lt;/SUB&gt;psttr  plaf&lt;SUB&gt;gsmng plaf&lt;/SUB&gt;plscn&lt;/P&gt;&lt;P&gt;      INTO TABLE t_plaf&lt;/P&gt;&lt;P&gt;      FROM plaf&lt;/P&gt;&lt;P&gt;     INNER JOIN mara&lt;/P&gt;&lt;P&gt;        ON plaf&lt;SUB&gt;matnr EQ mara&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;     INNER JOIN makt                                        &lt;/P&gt;&lt;P&gt;        ON mara&lt;SUB&gt;matnr EQ makt&lt;/SUB&gt;matnr                         &lt;/P&gt;&lt;P&gt;       FOR ALL entries IN t_mara&lt;/P&gt;&lt;P&gt;     WHERE plaf~matnr = t_mara-matnr.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However i looked into the MAKT table. I see 2 descriptions for the same material no.&lt;/P&gt;&lt;P&gt;I am assuming thats the problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ANy suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 15:53:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241742#M483394</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T15:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241743#M483395</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;Steps before using FOR ALL ENTRIES..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Make sure the driving internal table doesn't have any duplicate records..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   In your case..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SORT t_mara by matnr.&lt;/P&gt;&lt;P&gt;   DELETE ADJACENT DUPLICATES FROM T_MARA COMPARING MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Check if the internal table is not empty..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF NOT t_mara[] IS INITIAL.

SELECT plaf~plnum
mara~normt plaf~matnr
makt~maktx 
plaf~pwwrk plaf~paart plaf~verid
plaf~auffx plaf~psttr plaf~gsmng plaf~plscn
INTO TABLE t_plaf
FROM plaf
INNER JOIN mara
ON plaf~matnr EQ mara~matnr
INNER JOIN makt 
ON mara~matnr EQ makt~matnr 
FOR ALL entries IN t_mara
WHERE plaf~matnr = t_mara-matnr
AND      makt~spras = sy-langu.              " Inserted this code..


ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 16:02:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241743#M483395</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T16:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241744#M483396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Check this code . I tried it now and it's working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Tables: plaf,mara,makt.

Data: it_plaf type standard table of plaf.
data: it_mara type standard table of mara,
      it_makt type standard table of makt.

select-options: s_plnum for plaf-plnum,
                s_matnr for mara-matnr.

Select * from plaf into table it_plaf
         where plnum in s_plnum
         and matnr in s_matnr.

if it_plaf[] is not initial.

   select * from mara into table it_mara
          for all entries in it_plaf
          where matnr = it_plaf-matnr.

  Select * from makt into table it_makt
          for all entries in it_plaf
          where matnr = it_plaf-matnr.

endif.

Loop at it_mara into wa_mara.
read table it_plaf into wa_plaf with key matnr = wa_mara-matnr.
if sy-subrc = 0.
move-corresponding to wa_final.
endif.
read table it_makt into wa_makt witk key matnr = wa_mara-matnr.
if sy-subrc = 0.
Move-corresponding to wa_final.
endif.
append wa_final to it_final.
clear: wa_mara,wa_plaf,wa_final.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 16:06:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241744#M483396</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T16:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241745#M483397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Hello,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  Check this code . I tried it now and it's working&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;gt; Tables: plaf,mara,makt.
&amp;gt; 
&amp;gt; Data: it_plaf type standard table of plaf.
&amp;gt; data: it_mara type standard table of mara,
&amp;gt;       it_makt type standard table of makt.
&amp;gt; ct-options: s_plnum for plaf-plnum,
&amp;gt;                 s_matnr for mara-matnr.
&amp;gt; plaf into table it_plaf
&amp;gt;          where plnum in s_plnum
&amp;gt; and matnr in s_matnr.
&amp;gt; 
&amp;gt; if it_plaf[] is not initial.
&amp;gt; 
&amp;gt;    select * from mara into table it_mara
&amp;gt;        for all entries in it_plaf
&amp;gt;    where matnr = it_plaf-matnr.
&amp;gt;  Select * from makt into table it_makt
&amp;gt;          for all entries in it_plaf
&amp;gt;  where matnr = it_plaf-matnr.
&amp;gt; 
&amp;gt; endif.
&amp;gt; 
&amp;gt; Loop at it_mara into wa_mara.
&amp;gt; read table it_plaf into wa_plaf with key matnr =
&amp;gt; wa_mara-matnr.
&amp;gt; if sy-subrc = 0.
&amp;gt; move-corresponding to wa_final.
&amp;gt; endif.
&amp;gt; read table it_makt into wa_makt witk key matnr =
&amp;gt; wa_mara-matnr.
&amp;gt; if sy-subrc = 0.
&amp;gt; Move-corresponding to wa_final.
&amp;gt; endif.
&amp;gt; append wa_final to it_final.
&amp;gt; clear: wa_mara,wa_plaf,wa_final.
&amp;gt; endloop.
&amp;gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; Deepu.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be better for performance to use Field-Symbols -;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FIELD-SYMBOLS: &amp;lt;MARA&amp;gt; LIKE LINE OF IT_MARA.

Loop at it_mara into &amp;lt;MARA&amp;gt;.
*Process data....
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 16:10:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241745#M483397</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T16:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241746#M483398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 16:26:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join/m-p/2241746#M483398</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T16:26:30Z</dc:date>
    </item>
  </channel>
</rss>

