Application Development 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: 

how to maintain default values for custom table fields -- Urgent

Former Member
0 Kudos

Hi all,

I've a requirement wherein i need to create a Z table (with maintainence view) in which i'll have date and time as two of its field which should have current date and current time as default value. Can somebody suggest as how am i to maintain the date and time fields defaulting to current date and current time.

Incase if someone is unable to intrepret what i'm trying to say, please query me, i'll elaborate it further.

Please give in your quick inputs which is highly valuable to me and also will be highly appreciated.

Thanks in advance,

Vaishnavi Varadarajan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In the table maintenance screen, PROCESS AFTER INPUT event, create a module.

E.g.:

PROCESS AFTER INPUT.

MODULE SET_USER_DATE.

MODULE SET_USER_DATE.

TABLE-AENAME = SY-UNAME.

TABLE-AENDATE = SY-DATUM.

TABLE-AENTIME = SY-UZEIT.

ENDMODULE.

Hope this helps,

Thanks,

SKJ

2 REPLIES 2

Former Member
0 Kudos

In the table maintenance screen, PROCESS AFTER INPUT event, create a module.

E.g.:

PROCESS AFTER INPUT.

MODULE SET_USER_DATE.

MODULE SET_USER_DATE.

TABLE-AENAME = SY-UNAME.

TABLE-AENDATE = SY-DATUM.

TABLE-AENTIME = SY-UZEIT.

ENDMODULE.

Hope this helps,

Thanks,

SKJ

Former Member
0 Kudos

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.

Using the events, we can achieve this.

Please refer the following link:

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

Also,

Write a form routine in table maintanance generator.

1. SE11 > utilities > table maintenance generator

2. environment > modification > event

define the event and form routine to make use of the tigger. in the form routine define an object for the class and call the relevant method.

Or u can do it as:

Table maintenance generator is basically used to do table operations like (insert, delete, modify...).

if you create table maintenance for your table it will build a module pool program, by using you do the above operations.

below is the procedure to create table maintenance generator.

1) Create one function group.

2) after activating your Ztable, choose 'Utilities'----> 'Table maintenance genrator'.

3) then give the authorization group and function group created abobe in the next screen.

4) Then choose the "create" button in your application tool bar, which will creates the module pool program.

5) then create one Tcode by chosing "Transaction with parameters( parameter transaction)".

6) in transaction field give "SM30", select the check box "Skip initial screen".

7) in the below of that screen you can find the "Default values" frame.

😎 there under the "name of screen field" select the "View name' and 'update".

9) in value column against to "view name" give you table name, and against to "Update" put 'X' in capital letters.

save it then you can straight away use this newly created Tcode to maintain your table.

Note:- 1) make the modification while saving the data into your table using this newly generated program to carry out your validation (even though it looks like standard program; no need to enter the access key).

2) if you do any changes to your table and press the activate button automatically the table maintenace generator will be goes off, you need to create this again.

cheers,