Showing posts with label SM30. Show all posts
Showing posts with label SM30. Show all posts

The Events in Table Maintenance Generator SM30

There are 39 events for Table Maintenance Generator, follow this:
SE54 -> Enter Table Name (Which table you want) -> Environment -> Events -> Enter -> New Entries -> Under ' T ' -> Press F4.
Then you will get below events:
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

Table Maintenance Events


Scenario: We have a following custom table which contains the fields “Date on which record was created” and “Name of the person who created the object”. We would like to have these to be filled up with SY-DATUM and SY-UNAME respectively.
Go to Table Maintenance Generator:
Enter the details as shown below:
Now click on Environment -> Modification -> Events
Following screen is displayed.
Click on F4. Following entries are displayed:
Here you can observe that there are different types of events available like before saving the data, after saving the data, before deleting, after deleting and others. Let us go with “Creating a new entry”.
Click on the button in the Editor column and enter the following code: (Please note that you should also code FORM and ENDFORM as well).
Save and activate the table.
Testing the scenario:
Go to SM30 and try creating new entries. Do not enter the values for “Created on” and “Created by”.
Check your entries in the database table. You can observe that the date and user name are automatically filled-in. See the screenshot below:

Transaction for SM30

Assuming that you want the user to maintain a table or view using SM30 but you do not want them to see the initial screen of SM30. For e.g. SFLIGHT - Flight Data.

SE93 - Type in a transaction name e.g. SFLIGHT
Click create - choose parameter transaction
In the Create Parameter transaction screen, fill in the following fields :-
Transaction SM30
Tick Skip initial screen
Tick Inherit GUI attributes

Name of screen field Value
VIEWNAME SFLIGHT
UPDATE X

Press F8 or click the Test button for testing.

Save it and with the required authorization, the user will be able to use transaction code SFLIGHT to maintain the material group.