<?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: Problem with inserting a record in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459088#M551607</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Line  , &lt;/P&gt;&lt;P&gt;  So it basically means that record is not getting inserted into the table , please check if there is already a record with the same key feilds in the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally it is better to use modify command , as it will insert a new record if it is not there or modify the existing record , where as insert will try only to insert a record if a record with the same key already exists then it will give sy-subrc as 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try with modify command and see.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2007 06:57:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-25T06:57:10Z</dc:date>
    <item>
      <title>Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459083#M551602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to update my database table with new record for this I wrote a coding like this, but i am unable to update the database table please find my coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT lt_invmov INTO lw_invmov WHERE check = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SELECT  MAX( trans )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                     INTO zinv_mov-trans FROM zinv_mov.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            zinv_mov-trans = zinv_mov-trans + '0000000001'.&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;            MOVE '0000000001' TO zinv_mov-trans.&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;&lt;/P&gt;&lt;P&gt;          itab-lifnr     =   lw_invmov-lifnr.&lt;/P&gt;&lt;P&gt;          itab-xblnr     =   lw_invmov-xblnr.&lt;/P&gt;&lt;P&gt;          itab-bukrs     =   lw_invmov-bukrs.&lt;/P&gt;&lt;P&gt;          itab-usnam     = zinv_mov-usnam.&lt;/P&gt;&lt;P&gt;          itab-appdate   = sy-datum.&lt;/P&gt;&lt;P&gt;          MOVE 'V2' TO itab-status.&lt;/P&gt;&lt;P&gt;          MOVE 'CL' TO itab-clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         APPEND itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          INSERT INTO zinv_mov VALUES itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDLOOP.&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;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:01:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459083#M551602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459084#M551603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Line,&lt;/P&gt;&lt;P&gt;  Please write commit-work after insert statement.&lt;/P&gt;&lt;P&gt;Try it.&lt;/P&gt;&lt;P&gt;Reward if useful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:04:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459084#M551603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459085#M551604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Line , &lt;/P&gt;&lt;P&gt;  Your code seems to be correct , what is the value of sy-subrc you get after the insert command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also suggest you one thing  , currently you are inserting the data into internal table  itab and the inseerting the table with data in the header , what i would suggest is instead of using the insert command for each record , why dont you insert all the records at one go , after ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the syntax &lt;/P&gt;&lt;P&gt;INSERT dbtab FROM TABLE itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:10:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459085#M551604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459086#M551605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do like this it may help you..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT lt_invmov INTO lw_invmov WHERE check = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT MAX( trans )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTO zinv_mov-trans FROM zinv_mov.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zinv_mov-trans = zinv_mov-trans + '0000000001'.&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;MOVE '0000000001' TO zinv_mov-trans.&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;&lt;/P&gt;&lt;P&gt;itab-lifnr = lw_invmov-lifnr.&lt;/P&gt;&lt;P&gt;itab-xblnr = lw_invmov-xblnr.&lt;/P&gt;&lt;P&gt;itab-bukrs = lw_invmov-bukrs.&lt;/P&gt;&lt;P&gt;itab-usnam = zinv_mov-usnam.&lt;/P&gt;&lt;P&gt;itab-appdate = sy-datum.&lt;/P&gt;&lt;P&gt;MOVE 'V2' TO itab-status.&lt;/P&gt;&lt;P&gt;MOVE 'CL' TO itab-clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;INSERT INTO zinv_mov from table itab.&lt;/P&gt;&lt;P&gt;&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;your itab should be like zinv_mov .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:14:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459086#M551605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459087#M551606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I am getting sy-subrc = 4 at the insert statement. please suggest me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:32:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459087#M551606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459088#M551607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Line  , &lt;/P&gt;&lt;P&gt;  So it basically means that record is not getting inserted into the table , please check if there is already a record with the same key feilds in the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally it is better to use modify command , as it will insert a new record if it is not there or modify the existing record , where as insert will try only to insert a record if a record with the same key already exists then it will give sy-subrc as 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try with modify command and see.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:57:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459088#M551607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459089#M551608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;first check whether your itab is like dbtab or not? then confirm that whether key fields of the table are you filling or not ? I think you have to fill the values in key fields also you can not insert initial value in key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 06:59:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459089#M551608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T06:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459090#M551609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shiba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Itab is like dbtab.&lt;/P&gt;&lt;P&gt;All the key fields are filling in the intenal table.&lt;/P&gt;&lt;P&gt;All the records are updated in the internal table but not in the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 07:15:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459090#M551609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T07:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459091#M551610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i dont know why it is happening you can try &lt;/P&gt;&lt;P&gt;insert dbtab from table itab accepting duplicate keys.&lt;/P&gt;&lt;P&gt;if you are trying some duplicate keys to enter then it will not insert in the database table. only the previous value will be there for that key... Just check whether you are repeating the keys or not(may be already exist in the dbtab)? and use commit work after insert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 07:53:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459091#M551610</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T07:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with inserting a record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459092#M551611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. refresh your itab just before the select max statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.  to update the dbtable use modify stt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify zinv_mov  from table itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this way even if a record exists in the dbatable with the same key it will not dump&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 07:53:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inserting-a-record/m-p/2459092#M551611</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2007-06-25T07:53:41Z</dc:date>
    </item>
  </channel>
</rss>

