‎2008 Apr 07 7:27 AM
Dear friends,
I have data in internal table ITAB.
i want to update some record in the internal table.
I have data in Header line.
EX: itab-num = 100.
itab-name = 'Arnold'.
itab-sal = 60000.
now i want to append that header line to internal table.
IF the record already exists in the internal table, it should update the existing record by updating some fields.
If that does not exists in the ITAB, it should append that record.
Please let me know the solution for this.
Thanks in advance.
Regards,
Ajay
‎2008 Apr 07 7:29 AM
‎2008 Apr 07 7:31 AM
Hi,
sort table by some key (e.g. num in your case) .
read table itab into ls_itab with key num = 100.
if sy-sybrc <> 0.
insert wa into itab.
endif.
<REMOVED BY MODERATOR>
Regards.
Ashish.
Edited by: Alvaro Tejada Galindo on Apr 7, 2008 11:48 AM
‎2008 Apr 07 10:55 AM
Hi,
read table itab into wa with key itab-num = 100.
wa-name = 'Arnold'.
wa-sal = 60000.
MODIFY TABLE itab FROM wa TRANSPORTING name,sal.
‎2008 Apr 07 4:47 PM
loop at itab into wa-itab.
modify <database table> from wa-itab.
endloop.