Application Development 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: 

GENERAL DOUBT REG MODIFY AND DELETE

Former Member
0 Kudos

Hi all,

Iam using the following code .

Does this gives any problem.

when sy-ucomm eq 'SAVE'.

DELETE FROM Zxxx WHERE record = 9999.

MODIFY Zxxx FROM TABLE ITAB.

itab has multiple records for record number 9999.

I AM MAKING LOT OF CHANGES TO THE LINE ITEMS OF RECORD 9999.

I WANT WHETHER THIS WOULDNOT CREATE ANY PROBLEM, BECAUSE IAM DELETING AMD INSERTING IN CONSECUTIVE STEPS

DO I NEED TO DO ANYTHING LIKE COMMIT WORK ETC--

THANKS

4 REPLIES 4

Former Member
0 Kudos

Suchitra,

I dont see any problems with that unless you want to delete and create new rows.

In your case modify works just like an insert statement as u deleted records with record number 9999 and inserting new records with 9999 record number.

Former Member
0 Kudos

Hi Suchitra,

As long as the data in itab is accurate there should not be a problem. The delete will delete all the records from you Z table where record is 9999.

The modify will update a record in Z table if a record with same key exists already ELSE it will insert a new record.

Cheers

Former Member
0 Kudos

Hi,

I presume you are doing delete on a Ztable or some table based on the values you have on the itab..

It is better to do an update statement as it would automatically see if your condition is satisfied and only then will it update.

Thanks,

Amit

Former Member
0 Kudos

Hi Suchitra,

You can also use commit work to make sure that DB entries are deleted. Also your intrenal table should not have any duplicate records.