10-08-2007 10:55 AM
Hi,
I have a ztable with 10fields and 11th field is date field. I also have a work area with these fields.
For every record in the Ztable...all the 10 fields have data but 11th filed does not have data(its empty).
Now I want to insert/modify/update database table ztable in such a way that:
IF the date field is empty..just update that date field only with SY-datum.
else leave it.
How do you do that?
Can you give me a sample code?
Thanks,
Arjun
10-08-2007 11:05 AM
Hi,
You can modify the exisitng ztable's data as follows
update ztable set date = value where date is initial.
10-08-2007 10:59 AM
Hi,
do like this..
Loop at itab into watab.
if watab-date is initial.
watab-date = SY-DATUM.
ENDIF.
MODIFY ITAB FROM WATAB transporting date.
ENDLOOP.
Now go for update statement with ztable
update ztable from table itab.
Regards,
Nagaraj
10-08-2007 11:00 AM
hi Arjun,
something like
SELECT *
INTO gt_ztable
FROM ztable
WHERE date EQ '00000000'.
LOOP AT gt_ztable INTO gw_ztable.
gw_ztable-date = sy-datum.
MODIFY gt_ztable from gw_ztable TRANSPORTING date.
ENDLOOP.
UPDATE ztable FROM TABLE gt_ztable.
IF sy-subrc EQ 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
hope this helps
ec
10-08-2007 11:05 AM
Hi,
You can modify the exisitng ztable's data as follows
update ztable set date = value where date is initial.
10-08-2007 4:34 PM
hi Jayanti,
thats perfect answer.
my problem is solved.
I have given you points.
thanks again
bye
Arjun
10-08-2007 11:05 AM
Hi,
How this Ztable is getting updated?
if its thru Zprogram: then u can write thru codeand Modify Ztable.
If its thru maintenance view, then u need to write the code in Maintenance prgm.
Regards
Kannaiah