Wednesday, April 13, 2011

Implementing events in Table Maintenance

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:



No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites