‎2010 Aug 05 12:20 PM
Hi experts,
I have a req. in which I need to create events in the TMG.
I implemented the event in case the user entres some specific values, and the fields user name, time and date are automatically populated.
Now there is another requirement in which once the user changes any already existing enty, then the changed by user name, change date and change time should be updated automatically.
How can I achieve this functionality?
Thanks,
Mohit.
‎2010 Aug 05 12:32 PM
‎2010 Aug 05 12:35 PM
The following event can fulfil your requirement :
- [Event 01: Before Saving the Data in the Database|http://help.sap.com/saphelp_470/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm]
- [Event 21: Fill Hidden Fields|http://help.sap.com/saphelp_470/helpdata/en/91/ca9f4aa9d111d1a5690000e82deaaa/frameset.htm]
FORM event01.
DATA: f_index LIKE sy-tabix.
FIELD-SYMBOLS <fs> TYPE ANY.
LOOP AT total.
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc EQ 0.
f_index = sy-tabix.
ELSE.
CLEAR f_index.
ENDIF.
CASE <action>.
WHEN neuer_eintrag.
ASSIGN COMPONENT 'CREATEDBY' OF STRUCTURE total TO <fs>.
WHEN aendern.
ASSIGN COMPONENT 'CHANGEDBY' OF STRUCTURE total TO <fs>.
WHEN OTHERS.
CONTINUE.
ENDCASE.
CHECK <fs> IS ASSIGNED.
<fs> = sy-uname.
MODIFY total.
CHECK f_index GT 0.
extract = total.
MODIFY extract INDEX f_index.
ENDLOOP.
sy-subrc = 0.
ENDFORM.Regards,
Raymond
‎2010 Aug 05 12:46 PM
Hi Mohit,
Try this way..
for change date and Change time these field need to be in Display mode always.
so got to SE80 and enter the function Group you enterd in Table maintainace,
go to screen--> and write code in the PBO to make the fields change date and Change time in display mode only to output.
Next go to PAI .
and write your code in the
LOOP AT EXTRACT.
"add custom module here and check if the entry is already avaialable in tjhe table and it is modified the
"Update the change date and Change time
MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
ENDLOOP.
Regards,
Prabhudas