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

insert statement not working

rangerlet_mesee
Participant
0 Likes
4,046

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

4 REPLIES 4
Read only

sabirshah1
Participant
0 Likes
1,724
Read only

0 Likes
1,724

Hi Madhukar,

for insert you could do it like:

INSERT INTO Z123 VALUES  Z123wa

where "Z123 _wa" is a line of your table.


The modify is similar to the insert statement:


MODIFY Z123 FROM Z123wa

If 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.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,724

In SE11 you declare primary keys, so define UNIQUE keys without NULL values.

So if you want multiple records you MUST extend the key list. This is a SQL constraint, and no statement will be able to bypass it.

Regards,

Raymond

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,724

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.