Scenario: Creating a table with TMG and then creating table events.
Step 1. Go to Tcode- SE11.
Step2. Provide the below table name and click on create button.
Step3. Provide delivery class and other details and click on Technical settings.
Step4. Provide the details, Save it and click on the Back button.
Step5. Under the fields tab, provide some fields and activate the table.
Step6. Navigate along the menu path to create the TMG.
Step7. Provide the details and click on the Create button to create the TMG.
Step8. After the TGM is created, navigate along the highlighted path.
Step9. Select the screen and click on Continue button.
Step10. Click on the Layout button as highlighted.
Step11. We will make the field ‘ADD_YEAR’ in display mode which will be automatically filled by the table events. Double click on the field ‘ADD_YEAR’.
Step12. The below screen appears.
Step13. Deselect the Input and output field and select output only.
Step14. Now the field ADD_YEAR appears in Display mode. Click on Flow Logic button to go Back.
Step15. Activate it and go back.
Step16. Navigate along the highlighted path to create the table Event.
Step17. Click on New Entries button.
Step18. Press F4 key from the keyboard to select one of the predefined event number.
Step19. Below screen appears displaying all available table events.
Step20. Select event 05 and Under the FORM Routine tab, provide a subroutine name and press Enter from key board. After that One Editor Icon will appear Under Editor tab. Click on the Editor Icon.
Step21. Select the First Include program and click on continue button.
Step22. The selected include program will be inserted in the main program ‘SAPLZSTUD_EVENT’ and click on Continue button
Step23. Provide the below code and activate it and go back.
Step24. Now go to SE38.
Step25. Provide the main program name ‘SAPLZSTUD_EVENT’ and click on change button.
Step26. The Program status is inactive as the include containing the event is inserted in the program. Click on Activate button.
Step27. The main program status is active.
Step28. Now in SE11, navigate along the high lighted path to create the record.
Step29. Click on New Entries button.
Step30. The screen appears in editable mode except the field ‘ADD_YEAR’.
Step31. Provide the ID, name and mark and then hit Enter key from keyboard.
Step32. The table Event is triggered and the ADD_YEAR is filled with current Year vale.
Step33. Now lets create another event. So navigate along the highlighted path.
Step34. Click on New Entries.
Step35. Select the Event as ’01’, provide a subroutine name and hit Enter key from key board. Click on the Appearing Editor Icon under Editor tab.
Step36. Select the proposed Include and click on the continue button.
Step37. Click on Continue button.
Step38. Provide the below code. Here the field symbol: <table2> carries the current record to be inserted in the table. For details refer to step number :. Activate it and go back.
Step39. So upto this we created two table events.
Step40. In SE38, Provide teh main program name ‘SAPLZSTUD_EVENT’ and click on change button.
Step41. The status is inactive as another include is inserted into it. Click on Activate button to activate it.
Step42. The status is active now.
Step43. Now navigate along the highlighted path to create table entries.
Step44. Click on New Entries.
Step45. Provide the below values and hit Enter.
Step46. The ADD_YEAR is filled by one of the table event. Now select the row and save it.
Step47. Now provide another vales for the record and hit Enter key from keyboard.
Step48. Select the particular row and click on Save button.
Step49. The error message is thrown by the table event as the TOT_MARK is grater than 750.
Step50. To check the details, Go to SE38.
Step51. Provide the main program name and click on change button.
Step52. Double click on the include.
Step53. Put a break point.
Step54. In the table again create a new record, select the row and click on the Save button
Step55. The global variable <table2> contains the vale of the current record.