Skip to Content
author's profile photo Former Member
Former Member

Events not updating the database correctly

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 05:30 PM

    Hi ,

    Try using

    commit work

    statement after the enloop and check if it gets updated.

    Regards,

    Siddarth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2009 at 06: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
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.