Can not insert or update [TABLE] from internal table in method

10-11  Source: Network gathering  Views:0 

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.
"An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
This is error code.
  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->conversion_input( EXPORTING im_vendor = gw_data-vendor
                              CHANGING  ch_vendor = gw_data-vendor ).
        APPEND gw_data TO gi_data.
      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.
      MESSAGE 'No data found' TYPE 'I'.
  ENDMETHOD.                    "set_data_to_table
Hi Matthew,
I think there is no difference in database insert between OO and non-OO.
The correct syntax according to ECC600 online documentation is
[Inserting Several Lines|]
To insert several lines into a database table, use the following:
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.
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.
I think the syntax
INSERT my_dbtable FROM TABLE gi_data.
should work, your suggestion may lead to syntax error.
Related articles
  • Can not insert or update [TABLE] from internal table in method 10-11

    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. "An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab"" After  i cha

  • Update databse from internal table statement not using index 10-11

    Hi Guys, We are updating a databse table from a file. The file has a couple of fields which have data different from what the database has (non-primary fields :). We upload the file data into an internal table and then update the database table from

  • How to update Records from Internal table to u2018Zu2019 table? 10-11

    Hi Friends, How to update Records from Internal table to u2018Zu2019 table. I have records in Internal table , that records want to update on u2018Zmarau2019 Table. ( my internal table & u2018 Zu2019 table structures are same.) Thanking you. Regards,

  • Modify database table from internal table 10-11

    Hi All, I need to update database table from internal table which is having around 30000 records. I am using MODIFY tabname FROM TABLE int_tabname... Using this statement, I can modify the databse records very well. But user has some additional requi

  • Fill database table from internal table 10-11

    I made one table ZDISP_CHDOC_CC and want to fill that table from internal table.and i got runtime error. that duplicate entry and two entry are like 10 200000    likhp 10                                     10 200000    likp   10 DESCRIBE TABLE IT_CH

  • Update ztable from internal table 10-11

    I want to update the Ztable from internal table datas. what is the syntax to update. Its urgent send with coding example is betterHi PARAMETERS: p_carrid TYPE sflight-carrid,             percent(1) TYPE p DECIMALS 0. DATA sflight_tab TYPE TABLE OF sf

  • How to update database table from Internal Table 11-30

    hi experts,     Can anyone please assist me in inserting records to a database table from an Internal Table whose structures are identical. Thanks in Advance, Sudhaa............Hi Sudha, Here are some example of update and insert: UPDATE SFLIGHT SET

  • How can i insert new updated values in a table?? 10-11

    Hi , Can any one suggest me is there any way to insert the recently added data from one table to another table where both the tables have the same structure. Suppose i have 10 rows in both table T1 and T2 and now if we add another 4 new rows in the t

  • Insert or Modify statement from internal table to database table 10-11

    Hi All, I have three tables wakh, wrf and wakp. I have an internal table with 5 columns col1, col2, col3, col4 and col5. The value in Col1 is my article no and the articleno. is in the table wakh. The value in col2 is my ccode and it is in the table

  • Update value from internal table into table control 10-11

    hi friends, i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz help me with some sample coding.hi Karthik , Here you go with the sample codi

  • Why I can not download and update software from App store? 11-30

    When I want to install some software, only display"please wait",I cannot download and update anyone! Please,help me!!!!Hi maplefox, it would be  a great help to the communities if you were to include: 1: the equipment you're using and any softwa

  • Is it possible to update internal table from database table 10-11

    Hello All:           I know how to update database table from internal table in one shot (batch) but is the reverse possible? Can I update some fields in an internal table from a database table in one shot (without looping) because my internal table

  • How to update whole external table(in ABAP dictionary) from internal table at once 10-11

    Hi, How can I update the content of the external table (in ABAP dictionary) from the content of internal table data at once. I created the internal tables with out the header line, with the work area. I tried UPDATE TARGET_EXTERNAL_TABLE FROM TABLE I

  • Can not insert/update data from table which is created from view 10-11

    Hi all I'm using Oracle database 11g I've created table from view as the following command: Create table table_new as select * from View_Old I can insert/update data into table_new by command line. But I can not Insert/update data of table_new by SI

  • Help!!urgent!!can not insert/update clob:the row containing the lob is not locked 10-11

    Hi, could you do me help? i can not insert a string into a oracle clob field, it echo as: ORA22920 row containing the lob value is not locked. ORA 06512 at "SYS.DBMS_LOB" line 708 ORA 06512 at line 1; what its means? please. my table defined as

  • How to update value in internal table from cdpos taking fname n value_new? 10-11

    hello everyone,           i want to insert  value in internal table from cdpos table taking field name  from fname and value from value_new.but the problem is i am not getting how to map the corresponding field of internal table with fname value  whi

  • Question in ABAP syntax, read & insert data from internal table, while loop 10-11

    Hi, SDN Fellow. I am from Java background and learnt ABAP, I don't usually write much ABAP code. I am trying to implement the following logic in a RFC now. I have one z-custom database table, the structure as the following: It has two columns, with t

  • Inserting columns from internal table to a database table! 10-11

    Hi people, How do I go about to insert columns from an internal table -intab- into an data base table -dbtab-. These tables contain some similar columns, not all. A code example would be much appriciated! /Arminhi armin, INSERT  dbtab      FROM TABLE

  • Inserting records from internal table to database table 10-11

    Hi all, i want to insert records from internal table to zDatabase table, can u plz guide me which statement is better in performance to insert the records. 1) insert one by one record from internal table loop at itab. insert ztable from wa. endloop.

  • ADF 11g can not select and copy data from cell of readonly table in IE 10-11

    hi, In ADF 11g, when render view object as readonly table with Single RowsSelection, using IE browser can not select and copy data from the cell, but it work in firefox. is it a bug? Edited by: kent2066 on 2009-5-18 上午8:46Hi Timo, Sorry forgot to men