cancel
Showing results for 
Search instead for 
Did you mean: 

Validation on company Code

Former Member
0 Kudos

Hi Experts,

I have a requirement in which I am giving a select option for the company code field,which is from t001-bukrs.Based on the validation result , i have to proceed in the program flow.

Now I have to write a code to validate the entered company code.If say user enter company code from 1 to 50 and out of this,say only 1,2,3 and 49 are valid,so i have to process only these and rest all(3-48 and 50) should be shown as invaild company code with the no.

Please give me the logic as soon as possible.

Thanks a lot.

Krishan

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member195698
Active Contributor
0 Kudos

You can fire a select query on the table T001 with the select option and get the data in an internal table. This table will only have the valid "Company Codes"...

select bukrs

into table t_bukrs

from T001

where bukrs in s_bukrs

where s_bukrs is a select option for company code.

Now the table t_bukrs will have the Valid Company Codes and this table can be used for Further Processing.

Regards,

Aj

Former Member
0 Kudos

Hi Aj,

Thanks a lot for your immediate response.

As you told that t_bukrs will have the valid company code.

I do agree with that.

But according to my requirement,I have to pocess the valid company code and also show all invalid company code as a message or error file.

So please suggest me acc to this requirement.

Regards,

Krishan

former_member195698
Active Contributor
0 Kudos

Hi Krishan,

Finding the invalid company codes is easy only in the case where the user enters Single Values in the Select-Option.

Like

1200

1400

1500

1700

But in case the user enters a range then it will be difficult to find the invalid company codes as it will be all the values between a range.. e.g. user enters 1200 - 2400.

Now in this case only valid values are 1200, 1400, 1500, 1700

And the invalid will be 1201-1399, 1401-1499, 1501-1699, 1701-2400.

which will become further confusing if the user gives range like

1200-1400 , 1800-2000 and also fills the NOT conditions

What you can try is to only allow select option with SINGLE VALUES. i.e. NO INTERVALS. Then i think it will be easier to find invalid codes.

Former Member
0 Kudos

Hi Abhishek,

Thanks a lot for your helpful suggestion.

But my requiement is like that only. Company code can have a range of values.

condtion expected result

1 Input improper company Error to be prompted as

code Invalid Company code

2 Input one improper company Error to be prompted for one

code in the range company code only.The rest

to be processed successfully.

Please help me in this scenario.

Regards

Krishan