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: 

Validations

Former Member
0 Kudos
142

Hi,

i have created one table(ZVGROUP).This table contains the ZZGROUP(Group id),ZZDESC.All are primary keys.

I have created one more table(ZVPLANT).This Table contains the ZZGROUP(Group id),WERKS,ZZDESC.All are primary keys.

ZZGROUP is the check table for ZVPLANT.Iam doing for Validations for Group id.

My requirement is when Group id is not found in the Zplant table it will display the message "Group id does not exists".

I wrote one select query .But it is not working.

select single zzgroup from zvgroup into Ws_Group

where zzgroup = ZVplant-zzgroup.

and also for duplicate entry

check duplicate record entry, if it is found display message “The Plant already belongs to this group”.

How to do validations.Please give me quires for two validations.It is very urgent.

Thanks & Regards,

sairam

1 ACCEPTED SOLUTION

Former Member
0 Kudos
102

Hi there. To make one table a check table for another, you don't need to write a query. Go to transaction SE11 and enter the name of your table (ZVPLANT). Now go to the "Entry help/check" tab. For each field that needs to exist in ZVGROUP, in the column "check table" enter "ZVGROUP". Check the "foreign keys" box. Save, check, and activate your table. Whenever someone tries to create an entry in ZVPLANT it will now automatically check table ZVGROUP for the required values. I hope this helps.

- April King

10 REPLIES 10

Former Member
0 Kudos
103

Hi there. To make one table a check table for another, you don't need to write a query. Go to transaction SE11 and enter the name of your table (ZVPLANT). Now go to the "Entry help/check" tab. For each field that needs to exist in ZVGROUP, in the column "check table" enter "ZVGROUP". Check the "foreign keys" box. Save, check, and activate your table. Whenever someone tries to create an entry in ZVPLANT it will now automatically check table ZVGROUP for the required values. I hope this helps.

- April King

0 Kudos
102

It is possiable to write the query.

Thanks & Regards,

sairam

0 Kudos
102

Right, but why do you need the query when you can set the table up to do the validations automatically?

- April

0 Kudos
102

Suppose when i enter the invalid Groupid,SAP will give the automatically system message.Instead of that one i want to disply the custom messages like

"Invalid Group id".For that purpose i write the querey in the Tabel maintenace->Maintaince screen--


>Create include program.Here i write the quereys

for validations.

select single zzgroup from zvgroup into Ws_Group

where zzgroup = zvgroup-zzgroup.

This querey is not working?i want exact query?

Thanks & regards,

sairam

0 Kudos
102

There are options within SAP for this. From the help:

"Assign a message: A standard message is output if the value check by the foreign key on the screen field results in an invalid input. You can replace this standard message with any message. To do this, you must enter the message class of the message in the field AArea and the message number in the field MsgNo." Here's the link to more info:

http://help.sap.com/saphelp_erp2005vp/helpdata/en/6f/2000f79ffe11d3969500a0c929b3c3/frameset.htm

Make sure you are in the "maintain table" view. On the entry help/check tab, click on the field you want to validate. Then click on the foreign key button (the button that has a key with an arrow). This will bring up a new screen. This is where you can enter the message number and AArea that you want to use. Make your changes and click on the "copy" button. Then save and activate. If none of the available messages are what you want, then you can create a new message through transaction code SE91 (and then assign it using the above instructions).

- April

Message was edited by:

April King

0 Kudos
102

None of the messages are not showing in the forgien key screen.So i have create

custom messages" Invalid Group id", But it also not showing in the Foreign key screen.

Thanks & regards,

sairam

0 Kudos
102

Make sure that you select the right message class. The message class that you used when you created your custom message is what you need to enter in the "Aarea" field on that foreign key screen. Then the message number should be the number of the message that you created. Make sure that you save the message and message class before you try to assign them to the foreign key.

- April

0 Kudos
102

Hi King,

Thanks for ur reply.That process is not working.

Thanks & regards,

sairam

0 Kudos
102

What version are you on? This worked for me. We are on ERP2005, ECC 6.0.

- April

0 Kudos
102

Hi,

Thanks for all u replies.Iam giving some rewards points to u.

Thanks & regards,

sairam