<?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: Update &amp; Insert into Internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456336#M830435</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;APPEND :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS USED TO GET THE RECORD FROM THE INTERNAL TABLE HEADER TO THE BODY AREA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT ALLOWS DUPLICATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLLECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS USED TO A GET A RECORD FROM HEADER TO THE BODY AREA BUT IT WILL NOT ALLOW ANY DUPLICATION EXCEPT IF THERE IS ANY NUMERIC FIELS IT ADDS THAT FIELDS DATA BUT NOT AS A NEW RECORD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS USED TO ADD A NEW RECORD &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY DBTAB FROM  WORKAREA(WA)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;vasavi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Feb 2008 10:09:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-25T10:09:47Z</dc:date>
    <item>
      <title>Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456326#M830425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Abapers, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to update a entry in the internal table if exists, otherwise inserts a new one. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think MODIFY &amp;lt;Internal Table&amp;gt; will not insert new one if the matching entry is not there. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY &amp;lt;database_table&amp;gt; have this facility. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance, &lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:38:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456326#M830425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456327#M830426</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;use collect statment it will do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:40:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456327#M830426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456328#M830427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  'COLLECT' statement can solve your problem.....just check it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:42:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456328#M830427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456329#M830428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Satish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  First check in database table whether entri existed or Not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   MODIFY  &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;   Append.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:47:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456329#M830428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456330#M830429</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 MODIFY statement works like INSERT/UPDATE, If key found then it will work like UPDATE, else work like INSERT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:48:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456330#M830429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456331#M830430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;COLLECT: adds the values of its numeric components to the corresponding values of existing rows with the same key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i dont want to add, just changs the contents of the exisitng row in an internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:48:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456331#M830430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456332#M830431</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;collect will append if entry is not there if entry is all already there it wll modify the contents of the exisitng row in an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:51:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456332#M830431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456333#M830432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bujji, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are wrong. Its throwing sy-subrc = 4. &lt;/P&gt;&lt;P&gt;plz give me an example, if you are sure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:55:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456333#M830432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456334#M830433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;KPN,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can only use the COLLECT command in a table if all of its non-key fields are numeric (type I, P, or F). P or F).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But there are no numeric fields in my table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 09:58:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456334#M830433</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T09:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456335#M830434</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 dont know what type of fields u r having but about collect statement i am correct&lt;/P&gt;&lt;P&gt;The following special statement allows you to summate entries in an internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLLECT wa INTO itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab must have a flat line type, and all of the fields that are not part of the table key must have a numeric type (f, i, p). You specify the line wathat you want to add as a work area that is compatible with the line type of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_int_tables_COLLECT .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF line,&lt;/P&gt;&lt;P&gt;col1(3) TYPE c,&lt;/P&gt;&lt;P&gt;col2(2) TYPE n,&lt;/P&gt;&lt;P&gt;col3 TYPE i,&lt;/P&gt;&lt;P&gt;END OF line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab LIKE SORTED TABLE OF line&lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE KEY col1 col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 'abc'. line-col2 = '12'. line-col3 = 3.&lt;/P&gt;&lt;P&gt;COLLECT line INTO itab.&lt;/P&gt;&lt;P&gt;WRITE / sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 'def'. line-col2 = '34'. line-col3 = 5.&lt;/P&gt;&lt;P&gt;COLLECT line INTO itab.&lt;/P&gt;&lt;P&gt;WRITE / sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 'abc'. line-col2 = '12'. line-col3 = 7.&lt;/P&gt;&lt;P&gt;COLLECT line INTO itab.&lt;/P&gt;&lt;P&gt;WRITE / sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO line.&lt;/P&gt;&lt;P&gt;WRITE: / line-col1, line-col2, line-col3.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The list output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abc 12 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def 34 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example fills a sorted table. The first two COLLECT statements work like normal insertion statements. In the third COLLECTstatement, the first line of itab is modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 10:05:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456335#M830434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T10:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456336#M830435</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;APPEND :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS USED TO GET THE RECORD FROM THE INTERNAL TABLE HEADER TO THE BODY AREA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT ALLOWS DUPLICATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLLECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS USED TO A GET A RECORD FROM HEADER TO THE BODY AREA BUT IT WILL NOT ALLOW ANY DUPLICATION EXCEPT IF THERE IS ANY NUMERIC FIELS IT ADDS THAT FIELDS DATA BUT NOT AS A NEW RECORD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS USED TO ADD A NEW RECORD &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY DBTAB FROM  WORKAREA(WA)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;vasavi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 10:09:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456336#M830435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T10:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456337#M830436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Update-- if the record already exists then that record is updated and if the record doesn't exists then it inserts the record.&lt;/P&gt;&lt;P&gt;Modify-- if the record exists then only the record is modified and it doesn't insert the record as UPDATE does.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 10:17:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456337#M830436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T10:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456338#M830437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;KVN Boss, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are right. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For modify, collect statement will not change the contents of the row. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  z_test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters p_carrid type scarr-carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data scarr_tab type sorted table of scarr&lt;/P&gt;&lt;P&gt;               with unique key carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data scarr_wa type scarr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;       from scarr&lt;/P&gt;&lt;P&gt;       into table scarr_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table scarr_tab into scarr_wa&lt;/P&gt;&lt;P&gt;     with table key carrid = p_carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;scarr_wa-currcode = 'abc'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;collect scarr_wa into scarr_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- &amp;gt; collect cannot change/modify int he above case. may be it can insert a new line.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 10:28:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456338#M830437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T10:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456339#M830438</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;in that case u can use modify&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 10:33:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456339#M830438</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T10:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456340#M830439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Satish,&lt;/P&gt;&lt;P&gt;MODIFY-Inserts new lines or updates existing lines in a database table (s. relational database). If a record with the specified primary key already exists, UPDATE is executed(existing record is changed). Otherwise, INSERT is performed(new record is added).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your sy-subrc is giving values according to: &lt;/P&gt;&lt;P&gt;SY-SUBRC = 0: &lt;/P&gt;&lt;P&gt;All lines were successfully inserted or updated. &lt;/P&gt;&lt;P&gt;SY-SUBRC = 4: &lt;/P&gt;&lt;P&gt;One or more lines could not be inserted or updated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it might be that your one or more lines were not inserted or updated.&lt;/P&gt;&lt;P&gt;Plz tell me if you have any more doubts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 25, 2008 6:15 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 11:11:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456340#M830439</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T11:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Update &amp; Insert into Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456341#M830440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sathish.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say we have one internal table of customers with name itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type table of kna1 with header line,&lt;/P&gt;&lt;P&gt;        wa type kna1,&lt;/P&gt;&lt;P&gt;        v_lines type sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you have filled this internal table with some values. and now you have a new record and want to add this new record to internal table if no match found or modify the record if match is found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;say you have new record in work area &lt;STRONG&gt;wa&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Get the no. of lines.&lt;/P&gt;&lt;P&gt;Describe table itab lines v_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Check if record already exist&lt;/P&gt;&lt;P&gt;read table itab with key kunnr = wa-kunnr.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.    "Record exist&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    modify itab from wa index sy-tabix.    "Modify record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.                 " Record doesn't exist then insert record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; *-- increase the line count&lt;/P&gt;&lt;P&gt;v_lines = v_lines + 1.&lt;/P&gt;&lt;P&gt;insert wa into itab index v_lines.           "insert record at the next line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regard,&lt;/P&gt;&lt;P&gt;Yellappa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 11:35:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-insert-into-internal-table/m-p/3456341#M830440</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T11:35:22Z</dc:date>
    </item>
  </channel>
</rss>

