2016 Feb 12 6:51 AM
Hi,
I have a table Z123 which is having a key field f1.
I am using the statement : modify Z123 from WA.
Here, when an entry is found with the same key, it is updating the record..
I need to make sure that a new record appears when I do the process for a different non key field value.
I believe MODIFY and UPDATE will not work...and INSERT might..
Do I need to make the non key fields as key fields to add a new record in the table or what is the syntax for the INSERT statement...
Regards
Madhukar
2016 Feb 12 6:54 AM
INSERT IT FROM WA
Go through following link
Inserting Lines into Tables - ABAP Programming (BC-ABA) - SAP Library
2016 Feb 12 7:11 AM
Hi Madhukar,
for insert you could do it like:
INSERT INTO Z123 VALUES Z123wawhere "Z123 _wa" is a line of your table.
The modify is similar to the insert statement:
MODIFY Z123 FROM Z123waIf you INSERT new Data and the key field is identical, then a error should come. Because of this, you should proof sy-subrc if table modify was correct.
2016 Feb 12 7:12 AM
2016 Feb 12 7:17 AM
Hi,
You can use modify to create new records.
Just fill the fields that compose the key with different values.
Debug your code.
Read the help for modify command .
Regards.