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: 

Table Maintanance events.

Former Member
0 Kudos
61

Hi,

I have a z table in that there is a numeric, non key field with entries 1,2 .....etc.

now my requirement is i have restrict user with out entering duplicate values through sm30.

If user enter duplicate value, then throw a message by allowing the user to change the value.

Thanks in advance,

Sudheer. A

3 REPLIES 3

Former Member
0 Kudos
40

hi sudheer,

try changing it to a Primary Key.

If cannot change it, u need to change at Function Group, look it:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20im...

Regards

Allan Cristian

Former Member
0 Kudos
40

Hi

u need to create an exit where u can insert the code to check a duplicate value: after genereting the program for SM30 go to Enviroment->Modification->Events:

here you can indicate the name of the routine has to be triggered to check the duplicate values: you can use the event 05 (Creating a new entry).

Max

Former Member
0 Kudos
40

hi Sudeer,

For TMG, u have the screen. The flow logic of the editable. In the PAI event after the Loop--endloop statement.

Do the following:

chain: field (fieldname) module check.

Create the module by double clicking it and write the following code:

Module Check.

Select single * from dbtable into the wa where fieldvalue = fieldvalue from the screen.

If sy-subrc = 0.

Message 'value already exists in the Db' type 'S' display Like 'E'.

Endif.

Endmodule.

Thank you.

Reward points if found useful.