Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table Maintenance Events

Former Member
0 Likes
2,156

Hi

I'm having a table in which i'm using Sequence Number. Now i'm creating entries through SM30. Now my query is the Sequence Number field has to auto generated. I Have to maintain total coding in Table maintenance events.

For suppose, there are 10 entries in the table, When User go to Sm30 and click on New Entries, Sequence Number field should be 11 and this field will be in display mode.

Can i know the procedure and also the sample coding for this

Regards

Krishna

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,493

Hi

While creating the tables, sometimes we may need to update the table fields in the background

Lets take an example, if create a table with 10 fields in those 10 fields there are 2 fields which are User name and the Date, these 2 fields should update automatically when a record Inserted/Updated in the table.

For this, we need to create a table maintenance generator for that table. There in the table maintenance generator we have an option to create EVENTS.

In the table maintenance generator, Environment --> Modifications --> Events then a screen will be appear here,we need to create the Events, for updating the fields create 05(Creating a new entry) and 21(Fill hidden fields) .

In the EVENTS screen, press new Entries, there give 05 and give a name(This will become a PERFORM), then click the Editor pushbutton, this will be there at the right side of the entry, then a popup will be appear, you can create an include program, there inside of the include program write the below code

form CREATE_ENTRY.

TABLE-USERNAME = sy-uname.

TABLE-CHANGED_ON = sy-datum.

endform.

Then in the events screen enter 21 and give the form name as HIDDEN_FIELDS, then press the editor button, then in the editor

form HIDDEN_FIELDS.

TABLE-USERNAME = sy-uname.

TABLE-CHANGED_ON = sy-datum.

update TABLE.

endform.

This CREATE_ENTRY Perform will be triggered for every new entry and the HIDDEN_FIELDS fields will be triggered for every changed value in the table, so the Fields USERNAME and the CHANGED_ON fields will be updated automatically when a new record inserted into the table or an existed record changes through the table maintenance generator.

If you want any more functions, and then look at the events, you can press the F4 and look at the description of the event, then you come to know how to use and where to use.

Check these links

http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/content.htm

http://abapliveinfo.blogspot.com/2007/12/events-in-table-maintenance-in-sap.html

Regards

Pavan

Hi

I'm having a table in which i'm using Sequence Number. Now i'm creating entries through SM30. Now my query is the Sequence Number field has to auto generated. I Have to maintain total coding in Table maintenance events.

For suppose, there are 10 entries in the table, When User go to Sm30 and click on New Entries, Sequence Number field should be 11 and this field will be in display mode.

Can i know the procedure and also the sample coding for this

Regards

Krishna

6 REPLIES 6
Read only

Former Member
0 Likes
1,494

Hi

While creating the tables, sometimes we may need to update the table fields in the background

Lets take an example, if create a table with 10 fields in those 10 fields there are 2 fields which are User name and the Date, these 2 fields should update automatically when a record Inserted/Updated in the table.

For this, we need to create a table maintenance generator for that table. There in the table maintenance generator we have an option to create EVENTS.

In the table maintenance generator, Environment --> Modifications --> Events then a screen will be appear here,we need to create the Events, for updating the fields create 05(Creating a new entry) and 21(Fill hidden fields) .

In the EVENTS screen, press new Entries, there give 05 and give a name(This will become a PERFORM), then click the Editor pushbutton, this will be there at the right side of the entry, then a popup will be appear, you can create an include program, there inside of the include program write the below code

form CREATE_ENTRY.

TABLE-USERNAME = sy-uname.

TABLE-CHANGED_ON = sy-datum.

endform.

Then in the events screen enter 21 and give the form name as HIDDEN_FIELDS, then press the editor button, then in the editor

form HIDDEN_FIELDS.

TABLE-USERNAME = sy-uname.

TABLE-CHANGED_ON = sy-datum.

update TABLE.

endform.

This CREATE_ENTRY Perform will be triggered for every new entry and the HIDDEN_FIELDS fields will be triggered for every changed value in the table, so the Fields USERNAME and the CHANGED_ON fields will be updated automatically when a new record inserted into the table or an existed record changes through the table maintenance generator.

If you want any more functions, and then look at the events, you can press the F4 and look at the description of the event, then you come to know how to use and where to use.

Check these links

http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/content.htm

http://abapliveinfo.blogspot.com/2007/12/events-in-table-maintenance-in-sap.html

Regards

Pavan

Read only

Former Member
0 Likes
1,493

hi ,

well as per ur requirement u will have to develop a module pool , so u cannot use the sm30 for ur maintenance of table .

Read only

former_member404244
Active Contributor
0 Likes
1,493
Read only

0 Likes
1,493

HI

Thanks for your replies

Basically i want to have a field in display mode while creating a new entry and which will display a sequence randomly.

Regards

Krishna

Read only

0 Likes
1,493

Hi

Any one plz provide solution for my scenario

Read only

0 Likes
1,493

Plz provide me your Valuable inputs

Regards

Krishna