‎2009 Nov 17 7:37 AM
Hai ,
I am using table maintaince generator in single step , I am using events for updating the back ground entries like created by and changed by and I am using the total structure , the Table is getting updated in case of create and if the same entry is being modified in same screen the value it is over wrriting and the created field in the data base it is not populating for this i am using the event befor save .
below is the code that i have used .
LOOP AT total INTO l_wa_total.
*
IF l_wa_total-action EQ 'N'.
l_wa_total-createdon = sy-datum .
l_wa_total-createdby = sy-uname .
endif .
IF l_wa_total-action EQ 'U'.
l_wa_total-changedon = sy-datum .
l_wa_total-changedby = sy-uname .
ENDIF.
MODIFY TOTAL FROM l_wa_total.
regards,
K.Vinay Kumar
‎2009 Nov 17 4:27 PM
Hi,
Modify your code as below:
LOOP AT total INTO l_wa_total.
*
IF l_wa_total-action EQ 'N'.
l_wa_total-createdon = sy-datum .
l_wa_total-createdby = sy-uname .
MODIFY TOTAL FROM l_wa_total transporting createdon createdby.
endif .
IF l_wa_total-action EQ 'U'.
l_wa_total-changedon = sy-datum .
l_wa_total-changedby = sy-uname .
MODIFY TOTAL FROM l_wa_total transporting changedon changedby.
ENDIF.
Thanks,
Navneeth K.
Endloop.
‎2009 Nov 17 4:27 PM
Hi,
Modify your code as below:
LOOP AT total INTO l_wa_total.
*
IF l_wa_total-action EQ 'N'.
l_wa_total-createdon = sy-datum .
l_wa_total-createdby = sy-uname .
MODIFY TOTAL FROM l_wa_total transporting createdon createdby.
endif .
IF l_wa_total-action EQ 'U'.
l_wa_total-changedon = sy-datum .
l_wa_total-changedby = sy-uname .
MODIFY TOTAL FROM l_wa_total transporting changedon changedby.
ENDIF.
Thanks,
Navneeth K.
Endloop.
‎2009 Nov 17 5:02 PM
DO these:
1. Use clear whenever necessary.
2. Use different workarea . not as you are using at present . Use one for loop and second for new values.
3. Use sy-index to modify your table. It is faster and accurate.(AS, per my understanding this will solve your issue)
‎2009 Nov 17 5:09 PM
Have you checked the help for event 01? It's explained there.
Rob
‎2009 Nov 25 2:38 PM
Hi Vinay,
There is a workarea exist with the same name of the table .So use that work area in your code.
Any ways if its while creation or update you want to fill the sy-datum and sy-uname.
Just use the update the value of the ZTABLE-changedon and Ztable-changedby.
The standard code of the table maintainance will handle the rest of the thing.
I hope this will help you.
‎2009 Nov 25 3:32 PM
hai ,
I have solved the problem thanks for your information .
Regards
K Vinay Kumar