<?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: Logic  in internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415914#M1408532</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&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

sort it_tab2 by field1 field2.   "Assuming field1 and field2 are key fields in it_tab2
sort it_tab1 by field1 field2.   "So sort this table with field1 and field2
loop at it_tab2 into wa_tab2.
  lv_tabix = sy-tabix.
  read table it_tab1 into wa_tab1 with key field1 = it_tab1-field1
                                                                   field2 = it_tab2-field2 binary search.  "Also assuming you have multiple records in it_tab1
  loop at it_tab1 into wa_tab1 from sy-tabix.
    wa_tab2-field1 = wa_itab2-field1 + wa_itab1-field1.
    wa_tab2-field2 = wa_itab2-field2 + wa_itab1-field2.
    modify it_tab2 from wa_tab2 index lv_tabix transporting field1 field2.
    delete it_tab1 from wa_tab1index sy-tabix. "Re-check this line. I m not sure of the syntax
  endloop.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Dec 2009 11:59:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-01T11:59:46Z</dc:date>
    <item>
      <title>Logic  in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415912#M1408530</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 got a requirement where i am reading some date into 2 internal table say i_1 and i_2.Then i need to loop in i_2 and check if there is a record with the same key fields in table i_1 if so add the value of the key figures from i_2 to i_1.Finally delete all entries from i_2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone tell me a logic for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2009 11:46:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415912#M1408530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-01T11:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Logic  in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415913#M1408531</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;Just convert what ever you asked in to code and it should work. If you still face issues, post the code with what you have tried.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2009 11:53:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415913#M1408531</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-01T11:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Logic  in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415914#M1408532</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&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

sort it_tab2 by field1 field2.   "Assuming field1 and field2 are key fields in it_tab2
sort it_tab1 by field1 field2.   "So sort this table with field1 and field2
loop at it_tab2 into wa_tab2.
  lv_tabix = sy-tabix.
  read table it_tab1 into wa_tab1 with key field1 = it_tab1-field1
                                                                   field2 = it_tab2-field2 binary search.  "Also assuming you have multiple records in it_tab1
  loop at it_tab1 into wa_tab1 from sy-tabix.
    wa_tab2-field1 = wa_itab2-field1 + wa_itab1-field1.
    wa_tab2-field2 = wa_itab2-field2 + wa_itab1-field2.
    modify it_tab2 from wa_tab2 index lv_tabix transporting field1 field2.
    delete it_tab1 from wa_tab1index sy-tabix. "Re-check this line. I m not sure of the syntax
  endloop.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2009 11:59:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415914#M1408532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-01T11:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Logic  in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415915#M1408533</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;loop in i_2 &lt;/P&gt;&lt;P&gt;use read stmt to read i_1 table and check with ur condition&lt;/P&gt;&lt;P&gt;if true...&lt;/P&gt;&lt;P&gt;move this entry &lt;/P&gt;&lt;P&gt;else delete the entry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2009 12:00:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415915#M1408533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-01T12:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Logic  in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415916#M1408534</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;Declare one more internal table i_3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

Loop at i_2.

read table i_1 with key field1 = i_2-field1.

if sy-subrc eq 0.

move the data of i_2  to other intarnal table say it is i_3.

append i_3.

delete i_2.
endif.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i_3 will have your required data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2009 12:05:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-in-internal-table/m-p/6415916#M1408534</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2009-12-01T12:05:21Z</dc:date>
    </item>
  </channel>
</rss>

