<?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: Can not insert or update [TABLE] from internal table in method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006687#M957133</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there is no difference in database insert between OO and non-OO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct syntax according to ECC600 online documentation is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;To insert several lines into a database table, use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;I think the syntax&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
INSERT my_dbtable FROM TABLE gi_data.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;should work, your suggestion may lead to syntax error.&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;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 21 Jun 2008 14:50:33 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2008-06-21T14:50:33Z</dc:date>
    <item>
      <title>Can not insert or update [TABLE] from internal table in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006684#M957130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is error code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  METHOD set_data_to_table.
    REFRESH gi_data.
    CLEAR gi_data.

    IF gi_file[] IS NOT INITIAL.
* Set data for modify table
      LOOP AT gi_file INTO gw_file.
        MOVE-CORRESPONDING gw_file TO gw_data.

        me-&amp;gt;conversion_input( EXPORTING im_vendor = gw_data-vendor
                              CHANGING  ch_vendor = gw_data-vendor ).
        APPEND gw_data TO gi_data.
      ENDLOOP.


      INSERT [TABLE] FROM TABLE gi_data.

*      LOOP AT gi_data INTO gw_data.
*        INSERT INTO  [TABLE] VALUES gw_data.
*        IF sy-subrc = 0.
*          COMMIT WORK.
*        ELSE.
*          ROLLBACK WORK.
*        ENDIF.
*      ENDLOOP.
    ELSE.
      MESSAGE 'No data found' TYPE 'I'.
    ENDIF.

  ENDMETHOD.                    "set_data_to_table
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 05:25:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006684#M957130</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T05:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can not insert or update [TABLE] from internal table in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006685#M957131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is it  possible that i use  insert or update [TABLE] from internal table in method ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 07:01:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006685#M957131</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T07:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can not insert or update [TABLE] from internal table in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006686#M957132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand correctly, you're wanting to update a database table from an internal table in the method.  You've tried:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT my_dbtable FROM TABLE gi_data.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; but that doesn't work.  So you've tried.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT INTO  my_dbtable VALUES gw_data.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which compiles but doesn't give you the right result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct syntax is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT INTO my_dbtable FROM TABLE gi_data.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, in a OO context, you don't have tables with header lines, so you don't need &lt;STRONG&gt;IF gi_file[] IS NOT INITIAL.&lt;/STRONG&gt;  rather use &lt;STRONG&gt;IF gi_file IS NOT INITIAL.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 07:52:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006686#M957132</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-06-20T07:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can not insert or update [TABLE] from internal table in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006687#M957133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there is no difference in database insert between OO and non-OO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct syntax according to ECC600 online documentation is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;To insert several lines into a database table, use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;I think the syntax&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
INSERT my_dbtable FROM TABLE gi_data.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;should work, your suggestion may lead to syntax error.&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;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2008 14:50:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006687#M957133</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2008-06-21T14:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can not insert or update [TABLE] from internal table in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006688#M957134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're correct. My bad... &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2008 09:20:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-not-insert-or-update-table-from-internal-table-in-method/m-p/4006688#M957134</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-06-23T09:20:29Z</dc:date>
    </item>
  </channel>
</rss>

