Hi Adalbert,
Please follow below Procedure.
For demo purpose i have created 1 table containing 3 fields. EBELN, EBELP, MATNR (Po doc number, po line item number, Material Number).
No I am creating TMG of this table.
Now I am Creating Event 01 with and Pressing Editor Button which pop up a new screen .
I am creating New Include Name ->
Click -> Continue -> Continue .
Editor will be open . Write below code.
FORM BEFORE_SAVE.
ENDFORM.
This is most important part. You have to create Form Endform for the Form Routine name which you have assigned while creating Event. In our case it is BEFORE_SAVE.
Ones your code has been written , Save it and activate it. (Don't use check button, direct save and activate).
Go back and Press Save button for your Event as below.
GO Back -> Go to SE80 -> Function Group -> Pass your Function group name which you have created while creating your TMG.
in our case it is ZTEST_STU.
Refer Below Snapshot.
Activate Whole Function Group . Remember in your routine write proper code . Don't write just break point. You can use global Variable to fulfill your validation.
Ones this will activate again go to SE11 -> Table -> Environment-> Event -> Click on Editor button ->change the code. Activate Function Group -> And Run Se16n.
Hope this will work.
Regards,
Sagar