Friday, March 7, 2014

Table Maintenance Generator Events & programming


SAP has provided 39 events in the table maintenance generator. Now, some of us might not understand what table maintainenance generator events are.Well,SAP has provided events which can be triggered and made use of while updating/inserting/deleting data in a SAP table. One of the simplest examples would be in order to capture the data and time stamp when a record is moved to a table. We can create events(which are nothing less than a small include program/subroutine) and it would automatically add the date and time stamp and the user need not bother about it.Table maintenance generator events also helps is making life easier and also providing extra security of data if needed. There are 39 events for Table Maintenance Generator, which are::



01  Before saving the data in the database
02  After saving the data in the database
03  Before deleting the data displayed
04  After deleting the data displayed
05  Creating a new entry
06  After completely performing the function 'Get original'
07  Before correcting the contents of a selected field
08  After correcting the contents of a selected field
09  After getting the original of an entry
10  After creating the header entries for the change task (E071)
11  After changing a key entry for the change task (E071K)
12  After changing the key entries for the change task (E071K)
13  Exit editing (exit main function module)
14  After lock/unlock in the main function module
15  Before retrieving deleted entries
16  After retrieving deleted entries
17  Do not use. Before print: Event 26
18  After checking whether the data has changed
19  After initializing global variables, field symbols, etc.
20  after input in date subscreen (time-dep. tab./views)
21  Fill hidden fields
22  Go to long text maintenance for other languages
23  Before calling address maintenance screen
24  After restricting an entry (time-dep. tab./views)
25  Individual authorization checks
26  Before creating a list
27  After creation or copying a GUID (not a key field)
28  After entering a date restriction for time-dep. views
AA  Instead of the standard data read routine
AB  Instead of the standard database change routine
AC  Instead of the standard 'Get original' routine
AD  Instead of the standard RO field read routine
AE  Instead of standard positioning coding
AF  Instead of reading texts in other languages
AG  Instead of 'Get original' for texts in other languages
AH  Instead of DB change for texts in other languages
ST  GUI menu main program name
AI  Internal use only


Steps Involved:
1. Table creation
2. Table maintenance generator value maintenance.
3. Creation of event and updating the necessary code.

Ø  We shall create table  ZASOKA1 with fields as shown below:
Ø  Next goto Utilities à Table Maintenance Generator à and provide the details. Please note you need to provide authorization group, package. Package should not be a local transport and should be transportable, else SAP would not allow you to make save these settings. Choose the appropriate screen numbers and authorization group. Once, all done, the save button would be enabled and then save same.

Ø  Next choose Environment->Modification->Events.

 Ø  Choose the necessary event and give the subroutine name. Next click on the editor button associated with subroutine and write the necessary code

 Its often better to choose the new include of the table as for others one would need the developer key associated and could implement standard SAP code.

The table fields can be addressed as -field .For any external values or variables, necessary declarations are also needed.
Ø  The code needs to be written inside a FORM ENDFORM, just like a subroutine.

1 comment: