Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

delete any entry in the table before adding an entry?

Former Member
0 Likes
718

Hello ABAP Experts,

I have the data in the work area. I can modify / update / insert to the table.

How to write the ABAP code for this situation.

1) to delete any entries in the table

2) update this entry

so finally always there would be only one entry.

Suggestions appreciated.

Thanks,

BWer

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
690

Hi,

Delete the entries of table by this stmt.

DELETE FROM (dbtabname).

Then insert the values from workarea

INSERT INTO dbtab VALUES <work_area>.

And u can upadte the entry with values of workarea by this stmr.

UPDATE (dbtabname) FROM wa.

Dont use MODIFY. It will add a new record if its a new entry.

Rgds,

Prakash

Hello ABAP Experts,

I have the data in the work area. I can modify / update / insert to the table.

How to write the ABAP code for this situation.

1) to delete any entries in the table

2) update this entry

so finally always there would be only one entry.

Suggestions appreciated.

Thanks,

BWer

4 REPLIES 4
Read only

Former Member
0 Likes
690

use update statement

update ztab from wa.

If there is a match with the same key fields, then the record will be updated, if not no updates wil be done.

Regards,

ravi

Read only

Former Member
0 Likes
691

Hi,

Delete the entries of table by this stmt.

DELETE FROM (dbtabname).

Then insert the values from workarea

INSERT INTO dbtab VALUES <work_area>.

And u can upadte the entry with values of workarea by this stmr.

UPDATE (dbtabname) FROM wa.

Dont use MODIFY. It will add a new record if its a new entry.

Rgds,

Prakash

Read only

0 Likes
690

hi,

Delete the entries of table with

<b>DELETE FROM <dbtable>.</b>

For inserting the values from workarea Use

<b>INSERT INTO <dbtable> VALUES <wa>.</b>

For Updatimg the values from work area. Use

<b>UPDATE <dbtabname> FROM wa.</b>

Regards,

Santosh

Read only

Former Member
0 Likes
690

Hi,

1) to delete any entries in the table

Delete From <database table name>

to delete specific entries

Delete From <database table name> where <condition>

2) update this entry

insert into <database table name> from <workarea>

Sameena

Message was edited by: sameena attarwala