Application Development and Automation 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: 
Read only

Input Validation

Former Member
0 Likes
1,647

What is the simplest way to do input validation. A lot of times I need to design reports that have lets say 4 - 5 selection fields. For my input validation, I do single reads for each corresponding scenario but I find this to be to cumbersome. Is there a simpler way to do this?

For e.g. lets say the selection criteria is for plant, material and batch.

Then my input validation cases would be

if plant entered, check plant
if material entered, check material
if batch entered, check batch
if plant and material entered, check combination
if plant and material and batch entered, check combination 
if material and batch entered ......

And so on.. now if I have 6 or more selection criteria input validation can be even more cumbersome. Any better approach to this?

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
1,613

if the inputs are mandatory then you can directly check MCHB table...

Always looks for a place to write select single, which has as many input's as primary key's.

13 REPLIES 13
Read only

Former Member
0 Likes
1,613

You can use AT SELCTION-SCREEN instead of AT SELECTION-SCREEN ON <field>.

Read only

0 Likes
1,613

The input validation is done within AT SELECTION SCREEN. The problem is how to go about doing the input validation

Read only

former_member156446
Active Contributor
0 Likes
1,614

if the inputs are mandatory then you can directly check MCHB table...

Always looks for a place to write select single, which has as many input's as primary key's.

Read only

0 Likes
1,613

None of these inputs are mandatory. Hence as you can see in the algorithm, first I check if they are input, and then go about doing a single read to determine if the input is correct. How do you guys go about doing something like this. Just curious.

Read only

0 Likes
1,613

I would just check the individual entries, not the combinations.

Rob

Read only

0 Likes
1,613

Checking just the entries is not accurate is it?

Lets say you have matnr werks charg as input

Individually they could all exist but as a combination they may not.

Read only

0 Likes
1,613

>

> Lets say you have matnr werks charg as input

> Individually they could all exist but as a combination they may not.

this scenario is easy .. select single on MCHB will give you if it exist or not.... either if the fields are mandatory or not... I am wondering about some place where all the selection screen inputs doesnot co-exist in same table. In such case you need to have separate select singles...

Read only

0 Likes
1,613

Well, if you are interested in the material/plant combination, check them together from MARC rather than MARA. Don't know CHARG.

Rob

Read only

0 Likes
1,613

Your reply answers only one specific scenario when matnr werks charg are all entered

I can do single reads for

only matnr is entered

only werks is entered

only charg is entered

But then there are also the following cases, and I can always do single reads for these input validations as well

matnr and werks are entered

matnr and charg are entered

werks and charg are entered

But this is a simple case .. But if you design reports for MM with numerous selection criteria, it can get very wild.

Read only

0 Likes
1,613

Well, don't let it get wild. You have to decide what is really needed in input validation and check just those cases. If you check only the individual parameters, then you can let the report decide if the combinations are valid or not (by returning or not returning data).

Rob

Read only

0 Likes
1,613

So what you are saying is there is no need to do input validation for all possible scenarios up front. While extracting the data in start-of-selection, display error msgs based on ret code.

Read only

0 Likes
1,613

You are correct..there are endless possibilities to validate selection screen , for example in select option you can have multiple ranges...or single values etc , so I dont think we are expected to validate all the possibilities.

For example if you put a range for matnr no 1 to 10 you dont have to check if 1 is a valid material or 10 is valid material.if select single for material no between 1 and 10 returns 1 record its good to proceed.

similarly i believe if there is plant and material combination its not required to check all the materials between 1 - 10 and extended to the plant mentioned in the plant selection criteria.

In start of selection if no data is found for these combinations,

display a informative message and you can exit back to selection screen for the user to give another selection criteria.

ex:

if it_material[] is initial.

message sXXX display like E.

exit.

endif.

Read only

0 Likes
1,613

Hi Megan,

I would let the Select take charge of the return of the report for the values entered in the selection screen. If the result of the SELECT is empty, then show a message to the user that there is no data for the criteria used.

You should check for the parameters only if there is an exceptional case that you need it, for example, a field that you only need numbers, then validate that a number is entered.

Regards,

Gilberto Li