‎2008 Apr 04 1:45 PM
Hi,
can we use update to fill data in Z table rather than using insert command.
‎2008 Apr 04 1:49 PM
No,
MODIFY
adds data if not available or updates when available
regards
‎2008 Apr 04 1:47 PM
‎2008 Apr 04 1:48 PM
‎2008 Apr 04 1:49 PM
No,
MODIFY
adds data if not available or updates when available
regards
‎2008 Apr 04 1:53 PM
Well Matthias Rieken ,
Actually my requirment is that if data inserted into table i want to set one field which is FLAG in table as "N" means it inserted firsted time but when it already exist then that FLAG should be set "U" means it updated.
please advise..
‎2008 Apr 04 1:56 PM
check if the entry already exists in the Z table ..
select single * from ztable .....
if sy-subrc = 0.
update ... with flag = 'U'
else.
Insert .... with flag = 'N'
endif.
‎2008 Apr 04 1:57 PM
hmm
my first idea where
SELECT * FROM TABLE WHERE KEY = KEY
IF SY-SUBRC = 0
UPDATE ..... WHERE KEY=KEY
ELSE
INSERT .....
ENDIF
‎2008 Apr 04 1:49 PM
hi,
the answer is no but you can use modify table if you want to insert entries in case they do not exist in the database or update the z table if the keys exist.
regards,
peter
‎2008 Apr 04 1:52 PM
and still i tell you rather use insert or append than modify even tho modify works.
‎2008 Apr 04 2:00 PM
You can use modify statement instead of update.
Modify statement updates the reocord when record already exits and it is inserted when the record does not exits.
Edited by: S@N on Apr 4, 2008 3:01 PM
‎2008 Apr 04 2:14 PM
‎2008 Apr 04 2:36 PM
Thank you All................
Problem has been solved and confusion has been cleared now.
i did by this way...
INSERT zpayroll FROM it_final.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
it_final-updte = 'U'.
UPDATE zpayroll FROM it_final.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
ENDIF.
And Done.