Skip to Content

Handling Events in Table Maintenance Generator

Sometimes we need to do validations and checks while creating new entries in table. Or we need to store the current date and username in table fields while creating the new entries. Implementing the table maintenance events will be useful in such situations.

Consider the scenario, where we have to store the creation date and user name who updated the record.

Step 1 – Create custom Table.

Custom Table

Field

Table Key

Data Element

Data Type

Length

Text

MANDT

Yes

MANDT

CLNT

3

Client

CARRID

Yes

S_CARR_ID

CHAR

3

Airline Code

ERDAT

ERDAT

DATS

8

Creation Date

ERNAM

ERNAM

CHAR

12

Person Created

/wp-content/uploads/2012/12/screen1_165140.jpg

Step 2 Create table maintenance Generator.

Go to Utilities-> Table Maintenance Generator.

Authorization Group: &NC&

Function group: Any E.g.: ZEVENTS_TEST

Maintenance type: Two Step

  1. Maint. Screen no:

Overview screen 100

Single screen 200

Click on Create

Screen 2.jpg

Step 3- Create maintenance events

Go to Enviornment->Modification->Events

Screen3.jpg

Click on new entries

Screen 4.jpg

screen 5.jpg

List of Events Available.

screen 6.jpg

Click on the event ‘05’ Creating new entry

This event will be triggered while creating a new entry in SM30 or using the TCODE.

FORM Name- any suitable name e.g. CREATE_NEW_ENTRY

Double click on the editor .

screen 7.jpg

Create for ‘create_new_entry’

screen 8.jpg

Create another event: 02 for “After Save”

This will update the entries when any modifications done for the record.

FORM save_entries

.

Zevents_test-mandt = extract+0(3).

Zevents_test-carrid = extract+3(3)..

zevents_test-ERDAT = sy-datum.
zevents_test-ERNAM = sy-uname.

MODIFY zevents_test.

ENDFORM.

After this when you create or change any entry in the custom table, it will update the current date and user name to the table.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply