‎2008 Apr 18 11:40 AM
hi all,
i have to update database table from internal table values.
pls suggest me how to update/insert databasetabel.
best regards,
ashok reddy.
‎2008 Apr 18 11:43 AM
if you want to update a custome tABLE THEN YOU CAN USE MODIFY.
if you want to update standard table , i dont think this is the sugestable way.
‎2008 Apr 18 11:43 AM
you can use
insert <dbtab> from table <itab>.
this will insert new record if primary key is new else it will modify older record with same primary key
that will do
plz reward if useful
vivek
‎2008 Apr 18 11:43 AM
Hi,
You can update a database table using Modify or update statement.
Modify: It inserts one or several lines specified in source in target or overwrites the existing lines.
MODIFY target FROM source.
Eg., modify z_employee from table it_employee[].
Where z_employee is the database (custom) table & it_employee is the internal table.
Update: The statement UPDATE changes the content of one or more lines of the database table specified in target. The entries in source determine which columns of which lines are changed, and how they are changed. If no records in the target system are found, a new record will be created.
Refer
https://forums.sdn.sap.com/click.jspa?searchID=10903258&messageID=3412558
Regards
Kiran
‎2008 Apr 18 11:43 AM
This code works for adding, but changing the INSERT to MODIFY will update the table if the record exists, and insert is if it doesn't.
IF NOT ittax[] IS INITIAL.
IF p_load = 'X'.
** DELETE FROM ztax CLIENT SPECIFIED
** WHERE mandt = sy-mandt.
INSERT ztax FROM TABLE ittax.
ENDIF.
PERFORM display_data.
ELSE.
WRITE: 'No data input. Nothing was Loaded'.
ENDIF.
‎2008 Apr 18 11:44 AM
hi
insert <dbtab> from table <itab>
insert <dbtab> from <WA>
modify <dbtab> from <wa>
insert <dbtab> from table <itab>
regards
prasanrth
‎2008 Apr 18 11:48 AM
create lock entry for the table
call ENQUEUE function module to lock the entry...
and use update table...
e.g. UPDATE zcsv_crws_rec
FROM e_zcsv_crws_rec.
after successfull update DEQUEUE the corresponding entry
‎2008 Apr 18 11:48 AM
Hi,
See this Link.
It will be helpful.
[Insert DataBase Table|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
Regards,
Balakumar.G.
Reward Points if helpful.