<?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: processing two internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288086#M1389423</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Within one loop read other table, if sy-subrc = 0 perform the calculation part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it1.&lt;/P&gt;&lt;P&gt;read it2 with key abc = it1-abc.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*---perform calculation.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Nov 2009 03:54:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-11-04T03:54:54Z</dc:date>
    <item>
      <title>processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288083#M1389420</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;i have two internal tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1  with feilds  partner, vbeln. cmgst ( SO status)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2  - vbeln, posnr(item no ), kwmeng(qunatity) , cmpre ( credit price )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i need to get the sum of  (cmpre * kwmeng) for each partner and SO status combination into another internal table itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so itab3 will have partner, cmgst (so status ) , total amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it possible to achieve this with out using loop inside a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 15:57:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288083#M1389420</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T15:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288084#M1389421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is it not possible to add the partner and so fields in itab2 itself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;nilesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 16:49:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288084#M1389421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T16:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288085#M1389422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sudhakar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check below code sample. Change it according to ur need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab1 OCCURS 0,&lt;/P&gt;&lt;P&gt;      partner TYPE string,&lt;/P&gt;&lt;P&gt;      vbeln TYPE vbeln,&lt;/P&gt;&lt;P&gt;      cmgst TYPE cmgst,&lt;/P&gt;&lt;P&gt;      END OF itab1,&lt;/P&gt;&lt;P&gt;      wa1 LIKE itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab2 OCCURS 0,&lt;/P&gt;&lt;P&gt;      vbeln TYPE vbeln,&lt;/P&gt;&lt;P&gt;      posnr TYPE posnr,&lt;/P&gt;&lt;P&gt;      kwmeng TYPE kwmeng,&lt;/P&gt;&lt;P&gt;      cmpre TYPE cmpre,&lt;/P&gt;&lt;P&gt;      END OF itab2,&lt;/P&gt;&lt;P&gt;      wa2 LIKE itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab3 OCCURS 0,&lt;/P&gt;&lt;P&gt;      partner TYPE string,&lt;/P&gt;&lt;P&gt;      cmgst TYPE cmgst,&lt;/P&gt;&lt;P&gt;      amt TYPE p DECIMALS 2,&lt;/P&gt;&lt;P&gt;      END OF itab3,&lt;/P&gt;&lt;P&gt;      wa3 LIKE itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa1-partner = 'Test1'. wa1-vbeln   = '0000000001'. wa1-cmgst   = 'X'.&lt;/P&gt;&lt;P&gt;APPEND wa1 TO itab1. CLEAR wa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa1-partner = 'Test2'. wa1-vbeln   = '0000000002'. wa1-cmgst   = 'X'.&lt;/P&gt;&lt;P&gt;APPEND wa1 TO itab1. CLEAR wa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa2-vbeln  = '0000000001'. wa2-posnr  = '000001'. wa2-kwmeng = 10. wa2-cmpre  = 100.&lt;/P&gt;&lt;P&gt;APPEND wa2 TO itab2. CLEAR wa2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa2-vbeln  = '0000000002'. wa2-posnr  = '000002'. wa2-kwmeng = 20. wa2-cmpre  = 200.&lt;/P&gt;&lt;P&gt;APPEND wa2 TO itab2. CLEAR wa2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab1 INTO wa1.&lt;/P&gt;&lt;P&gt;  READ TABLE itab2 INTO wa2 WITH KEY vbeln = wa1-vbeln.&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    wa3-partner = wa1-partner.&lt;/P&gt;&lt;P&gt;    wa3-cmgst   = wa1-cmgst.&lt;/P&gt;&lt;P&gt;    wa3-amt     = wa2-kwmeng * wa2-cmpre.&lt;/P&gt;&lt;P&gt;    APPEND wa3 TO itab3.&lt;/P&gt;&lt;P&gt;    CLEAR wa3.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 03:38:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288085#M1389422</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2009-11-04T03:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288086#M1389423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Within one loop read other table, if sy-subrc = 0 perform the calculation part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it1.&lt;/P&gt;&lt;P&gt;read it2 with key abc = it1-abc.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*---perform calculation.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 03:54:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288086#M1389423</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-04T03:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288087#M1389424</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;the problem here is in it2 there are mutiple values for a given vbeln.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 04:22:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288087#M1389424</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-04T04:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288088#M1389425</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;itab2 will have multiple lines for a given vbeln, so i think read table won't solve the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 04:24:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288088#M1389425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-04T04:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288089#M1389426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Off course you can do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;read itab2&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;   total = cmpre * kwmeng.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;copy all fields into itab3.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 04:25:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288089#M1389426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-04T04:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288090#M1389427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you mena i can use read statements to read multiple lines from a internal table. can u give the code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 04:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288090#M1389427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-04T04:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: processing two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288091#M1389428</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;itab1 with feilds partner, vbeln. cmgst ( SO status)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2 - vbeln, posnr(item no ), kwmeng(qunatity) , cmpre ( credit price )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so itab3 will have partner, cmgst (so status ) , total amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;take third Internal table with fields partner cmgst cmpre kwmeng(if required)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop itab2.
read table itab1 with key vbeln = itab2-vbeln.
if sy-subrc is initial.
move itab1-partner to itab3-partner.
move itab1-cmgst  to itab3-cmgst.
move itab2-cmpre to itab3-cmpre.
move itab2-kwmeng to itab3-kwmeng.
* If you want to multiply quantity with price you can do that operation here and move it to the third itab
append itab3.  "--&amp;gt; at the end all required data is available in this internal table
endif.
endloop.
data : temp_price type wears.
sort itab3 by partner cmgst.
loop at itab3.

on change of parnter.
clear temp_price.
endon.
at new partnrer.
sum
temp_price = iteb3-cmpre.
endat.
itab3-cmpre = temp_price.

modify itab3 index sy-tabix.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;now hopefully your itab3 will contain sum of price at the first record against each partner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if required you can do delete adjacent duplicates comparing partner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2009 04:36:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/processing-two-internal-tables/m-p/6288091#M1389428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-04T04:36:34Z</dc:date>
    </item>
  </channel>
</rss>

