cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Validations in T Code SPRO

06-20-2006 2:42 PM
633 views 9 comments
0 Likes
SAP Managed Tags
Subscribe

Hi All,

Can anybody calrify this.

In TCode 'SPRO' , To perform Validations on document posting. I want to post the Document (FI) to the particular cost centre by the particular user. If that user want to post the document to any other cost centre then system give an error message.

In Step :

Prerequisite : I wrote syst-uname = 'abcd' and bseg-kostl <> '123456'.

Check : I wrote syst-name <> 'abcd' and bseg-kostl = '123456'

Message : I am giving the message.

Then it is allowing only to the cost centre 123456 by abcd. Other than 123456 it is giving the message.

Suppose i want to add another user.

So i wrote like this

Prerequisite : I wrote (syst-uname = 'abcd' and bseg-kostl <> '123456')or(syst-uname = 'efgh' and bseg-kostl <> '654321') .

Check : I wrote (syst-name <> 'abcd' and bseg-kostl = '123456') or (syst-name <> 'efgh' and bseg-kostl = '654321')

Message : I am giving the message

But it is not working. Can anybody help regarding this.

Why it is not working.? If i wrote for singl;e user it is working but i specified two users it is not working.

It means the error message is not appearing.

Regards

Prashanth

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

If the reqmnt is to allow only 123456 for user abcd AND 654321 FOR efgh

then in Pre

SYST-UNAME = 'ABCD' or SYST-UNAME = 'EFGH'.

Check

{SYST-UNAME = 'ABCD' AND BSEG-KOSTL = '123456'}

or

{SYST-UNAME = 'EFGH' AND BSEG-KOSTL = '654321'}

Message

Warm Regards

Anup Varghese

Former Member
0 Likes

OOps got it wrong

If the reqmnt is to allow only 123456 for user abcd AND 654321 FOR efgh

then in Pre

SYST-UNAME = 'ABCD' or SYST-UNAME = 'EFGH'.

Check

{SYST-UNAME = 'ABCD' AND BSEG-KOSTL <> '123456'}

or

{SYST-UNAME = 'EFGH' AND BSEG-KOSTL <> '654321'}

Message

Warm Regards

Anup Varghese

Former Member
0 Likes

Thanks Mr Anup

it is working correctly. But i have one doubt

Is it must and should that we have to use only one condition field in pre ? Why i am asking that in my Pre there r two condition fields.

in ur pre it is only one field plz clarify this.

Can you clear this doubt if i want to make this thing for 500 users then what should i do?

If i create a set id how can i link user and cost centre .

Plz clarify.

sridhar_k1
Active Contributor
0 Likes

You'r not getting error message after adding second user, because, second Check condition is true if you are testing for sy-uname = abcd and KOSTL = 654321 or the first check condition is true if the sy-uname = efgh and KOSTL = 12345 and hence validation step never raises error message.

Use AND instead of OR in the check condition.

U can have any prerec conditions

If you ahve 500 users I would recommend using user exit feature in the validation step definition. refer to OSS 842318 or validation/substitution rule documentation in Special purpose ledger SAP library documentation.

Regards

Sridhar

Former Member
0 Likes

No you can have multiple cond in prereq.if you have more values then you need cerate set values, but again if the reqmnt is 1:1 for UNAME:KOSTL, then i would suggest to go for a user exit. you can maintain the possible combinations in a Z table and code the same in the user exit.

Warm Regards

Anup Varghese

Former Member
0 Likes

Hi Anup,

Thanks for reply and suggestion. I will use the exits which are availble in validations. But if i want to write my logic in exits it is asking the access key. Normally exits won't ask the access keys. To write my logic i have to use accesss key ? Please help regarding this.

Regards

Prashanth

Message was edited by: Prashanth Konda

Message was edited by: Prashanth Konda

Former Member
0 Likes

Hai Anup,

Thanks for giving the solution. But one small doubt. I wrote the my logic in the exits. But how can i use that exit in the Pre and Check.

Here I am using the U100 exit . In that i wrote the logic. I set B_result = B_true for one conditon else

b_result = b_false.

Then i save and activated. But how can use this Exit in the pre and check.

I wrote like this

U100 = TRUE .

and checked but it is showing syntax error.

WHAT I HAVE TO WRITE IN PRE AND CHECK PLZ HELP

Please clarify this doubt.

Regards

Prashanth.

Former Member
0 Likes

when you have the exit, don't give any condition, i mean just U100. is fine (don't give U100 = true). all the logic should be in U100( Uname = 'XXXXX'....)

similary you can give in check also.

Warm Regards

Anup Varghese

Former Member
0 Likes

maintain set id with list of users and cost centers ?

then put a condition like this

GS01 to create set id

<b>syst-uname in zuser and bseg-kostl in zcost</b>

Regards

Prabhu