08-25-2006 6:21 AM
Hi
I want to INSERT a record in a Z-Table if a material belongs to a particular plant.
My Code is:-
IF plant is not initial and plant = say 'ABC'.
INSERT ztable with material number
ENDIF.
Please corerct it if it is wrong at any place
Thank You
08-25-2006 6:22 AM
Hi,
Correct. Also add a commit work to write the record to the database.
Try to use MODIFY instead of INSERT.
MODIFY will insert the record if the record is not present, otherwise it will be modify the record..
Thanks,
naren
Message was edited by: Narendran Muthukumaran
08-25-2006 6:23 AM
08-25-2006 6:26 AM
08-25-2006 6:28 AM
plant='ABC' means it is not initial. Then y to use the condition plant is not initial? Try testing by removing the redundant code
08-25-2006 6:42 AM
Hi,
lets say you`re checking the existence of the plant data, try the following code --- it should work much better.
IF PLANT = 'XXX'.
MODIFY ZTABLE.
ENDIF.
You can use modify if you would want to change already existing entries, else use INSERT and check for sy-subrc.
Reward if helpful.
Regards