Académique Documents
Professionnel Documents
Culture Documents
(EVENT-01)
Refrence link -http://scn.sap.com/thread/1851232
In Above screen shot there are 3 fields which needs to be populate automatically when user enter data
in table through TMG(SM30).
E.g. When add new record in table ,system automatically should take current date(record added date)
also when user change the exisitng record thorugh sm30 system shoul capture current date and time.
On change of table record we need to handle the changed record of table with field-symbols for
TABLES and EXTRACT .
Note- TABLES and EXTRACT are the two internal tables get automatically created when we
create the TMG .
-Sumit Patil
-Sumit Patil
-Sumit Patil
-Sumit Patil
Above screen shot created on ,changed on , Time coloumns make it non-editable mode. Thorugh se51.
-Sumit Patil
-Sumit Patil
01 Event trigger for create and change (add record /change/delete from tmg table)
-Sumit Patil
-Sumit Patil
-Sumit Patil
After creating event for TMG, Use FORM -ENDFORM. To write ABAP Code otherwise will get
"statement not accessible error" in TMG event editor.
FORM change_rec.
DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found
field-symbols : <fs> type any.
BREAK-POINT.
LOOP AT TOTAL.
-Sumit Patil
endloop.
ENDFORM.
"change_rec
Or below code.
*----------------------------------------------------------------------*
***INCLUDE LZCFCOLLF01 .
*----------------------------------------------------------------------*
FORM change_rec.
DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found
field-symbols : <fs> type any.
BREAK-POINT.
LOOP AT TOTAL.
IF <ACTION> = 'U'. " Update
READ TABLE EXTRACT WITH KEY <vim_xtotal_key>.
IF SY-SUBRC EQ 0.
F_INDEX = SY-TABIX.
ELSE.
CLEAR F_INDEX.
ENDIF.
check f_index <> 0.
* Update By
*
Assign component 'AENAM' of structure
*
<vim_total_struc> to <fs>.
*
<fs> = sy-uname.
* Update on
Assign component 'CHANGEDON' of structure
-Sumit Patil
<fs> = sy-datum.
<vim_total_struc> to <fs>.
"Lase Update Date
Time
Assign component 'ZTIME' of structure
<vim_total_struc> to <fs>.
<fs> = sy-uzeit.
"Lase Update time
MODIFY TOTAL.
EXTRACT = TOTAL.
MODIFY EXTRACT INDEX f_index.
clear f_index.
*
*
*
*
*
endloop.
ENDFORM.
-Sumit Patil
"change_rec
Thanks.
Sumit.Patil.
-Sumit Patil