cancel
Showing results for 
Search instead for 
Did you mean: 

Validation Rule for Two Company Codes

sridhar_muthekepalli3
Active Contributor
0 Kudos

Dear Friends,

Previously, I have written the validation for one company code which has worked fine. Now, I have to write validation for two company codes.

Here the code which is not working.

1000,2000 - Company Code.

ABC,DEF,GHI,JKL,MNO,PQR,STV = Business Area

Prerequisite: BSEG-BUKRS = '1000' AND BSEG-BUKRS = '2000'

Check: BSEG-GSBER = 'ABC' OR

BSEG-GSBER = 'DEF' OR

BSEG-GSBER = 'GHI' OR

BSEG-GSBER = 'JKL' AND

BSEG-GSBER = 'MNO' OR

BSEG-GSBER = 'PQR' OR

BSEG-GSBER = 'STV'

Error Message : Please Check Business Area.

Please advise what is wrong in the code and what should i correct to get the validation working for two company codes?

Thanks

Sridhar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sridhar,

Your Prerequisiteis : BSEG-BUKRS = '1000' AND BSEG-BUKRS = '2000'.

But I think it should be OR instead of AND because you can give only one company code in a document not both together.

In Check: BSEG-GSBER = 'ABC' OR

BSEG-GSBER = 'DEF' OR

BSEG-GSBER = 'GHI' OR

BSEG-GSBER = 'JKL' AND

BSEG-GSBER = 'MNO' OR

BSEG-GSBER = 'PQR' OR

BSEG-GSBER = 'STV'

It should be OR not AND.

Regards,

Akhila.

sridhar_muthekepalli3
Active Contributor
0 Kudos

Dear Friends,

The Code which is given is not working.

The requirement is that

When user enters Comapny code = 1000, he must be able to select business areas ABC,DEF,GHI,JKL.

When user enters Comapny code = 2000, he must be able to select business area MNO,PQR,STV .

From my side, i have created only one validation ZBREA and only one prequiste,check and message . In only one Validation, I am trying with two company codes validation rule.

Does it work?

Please advise me on these and sample code also.

Thanks

Sridhar

Former Member
0 Kudos

Hi,

My Suggestion is to create two different Validation Rules for the two company codes. It will avoid the complicacy which you are facing right now.

Regards,

Amit

Former Member
0 Kudos

Hi Sridhar,

In that case you can do one thing.

For one validation you can create multiple steps.

In step 1,

Prerequisiteis : BSEG-BUKRS = '1000'

In Check: BSEG-GSBER = 'ABC' OR

BSEG-GSBER = 'DEF' OR

BSEG-GSBER = 'GHI' OR

BSEG-GSBER = 'JKL'

In step 2,

Prerequisiteis :BSEG-BUKRS = '2000'

In Check: BSEG-GSBER = 'MNO' OR

BSEG-GSBER = 'PQR' OR

BSEG-GSBER = 'STV'

I hope it works.

Regards,

Akhila.

Former Member
0 Kudos

Yes, Akhila is right, just two steps is ok

Edited by: SAM XIAO on Feb 10, 2010 7:54 AM

sridhar_muthekepalli3
Active Contributor
0 Kudos

Hi Akhila.,

As per your advise, I have created step

Step 002 2000 - Restrictng Business Areas

Prerequisite : BSEG-BUKRS = '2000'

Check : BSEG-GSBER = 'MNO' OR

BSEG-GSBER = 'PQR' OR

BSEG-GSBER = 'STV'

Message:023-Please check business area.

Step 001 is working fine, whereas Step002 is tasking the wrong the business area.

Please advise how to reslove.

Regards

Sridhar

Former Member
0 Kudos

Hi Sridhar,

Have you checked whether all the business areas are created and assigned to company code 2000. Assigning business area to compnay code will be done through plant.

The Businees Area will be assigned to Plant (Tcode OMJ7) and Plant to Company Code(OX18).

Regards,

Akhila.

Edited by: Akhila Doppalapudi on Feb 10, 2010 5:54 PM

Edited by: Akhila Doppalapudi on Feb 10, 2010 6:00 PM

iklovski
Active Contributor
0 Kudos

Hi,

Activate a trace on your valdation, and post the document. You'll be able to see what conditions and/or checks are wrong or not fulfilled.

Regards,

Eli

sridhar_muthekepalli3
Active Contributor
0 Kudos

Hi,

In the step 02, I have given the validation rule and in the simulation , I enter the co.code and wrong business area.

The system is showing step 002 - Condition False, but no message as mentioned in the Message.

In the Message i have selected the message 'Mismatch in Section Code and Business Area'

Ths message is not getting displayed after simulation.

AND

I have activated the trace and posted the document. I used the T.code F-02,FB50

yet, I am unable to see the errors in the validation.

Can you explain the process how to see the errors when using the validation.

Thanks and regards

Sridhar

Edited by: Sridhar M on Feb 11, 2010 2:58 PM

iklovski
Active Contributor
0 Kudos

Hi,

If condition is False, then it means that no message should be issued. Check the boolean logic of your condition...

Regards,

Eli

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear,

Check: BSEG-GSBER = 'ABC' OR

BSEG-GSBER = 'DEF' OR

BSEG-GSBER = 'GHI' OR

BSEG-GSBER = 'JKL' AND (AND will mean two business are in the line item)

BSEG-GSBER = 'MNO' OR

BSEG-GSBER = 'PQR' OR

BSEG-GSBER = 'STV'

That should be OR I think....

Please also tell if system issues an error or not and also requirement in words like what validation you want in non-technical language.

Regards,

Chintan Joshi