02-27-2009 3:55 PM
Hi All,
We need to update the created date and time as well as changed date and time for a custom table.Please have a look at the below piece of code.But the date never gets commited as well as when there is any change made to the entries in the table they are not getting commited.Please help.
Thanks,
Sham.
LOOP AT total.
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc EQ 0.
l_index = sy-tabix.
ELSE.
CLEAR l_index.
ENDIF.
MOVE total TO w_mat.
IF status-action EQ 'A'.
w_mat-created_on = sy-datum.
w_mat-creation_time = sy-uzeit.
w_mat-created_by = sy-uname.
w_mat-changed_on = sy-datum.
w_mat-changed_by = sy-uname.
w_mat-changed_time = sy-uzeit.
ELSE.
w_mat-changed_on = sy-datum.
w_mat-changed_by = sy-uname.
w_mat-changed_time = sy-uzeit.
ENDIF.
OVERLAY total WITH w_mat.
MODIFY total.
CHECK l_index GT 0.
extract = total.
MODIFY extract INDEX l_index.
ENDLOOP.
sy-subrc = 0.
ENDFORM.
Added code tags
Edited by: Rob Burbank on Feb 27, 2009 11:06 AM
02-27-2009 5:30 PM
Hi ,
Try using
commit work
statement after the enloop and check if it gets updated.
Regards,
Siddarth
02-28-2009 6:22 AM
total-created_on = sy-datum. "w_mat-created_on = sy-datum.similarly for other values
MODIFY total .
"total is table with header line
"other option: MODIFY total from wrk_mat TRANSPORTING created_on etc