Skip to Content
0
Former Member
Feb 27, 2009 at 03:55 PM

Events not updating the database correctly

245 Views

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