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: 

validating field on selection screen

Former Member
0 Kudos

wht is the meaning of validation

how to validate a particular field on selection screen

suppose parameters:p_vkorg like vbak-vkorg.

how to validate p_vkorg.

pz give me coding

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello pavan,

Validation means "checking whether the input which u are gining to the selection secreen is valid or not". means...

Lets take your example only...

parameters:p_vkorg like vbak-vkorg.

in selection screen you will give inout in that parameter....

users can give any input... lets suppose I'll give input as ABC... which is not in the table VBAK. No need to excute the code once we came to know that the input is not there in the table. So we will do validation like...

at selection-screen on p_vkorg.

select * from vbak where vkorg = p+vkorg. " This is the case with Parameter.

at selection-screen on p_vkorg.

Select * from vbak where vkorg = p+vkorg. " This is the case with Selct-option.

if the input that u r giving is present in the table... the above stmt will execute successfully, otherwise not.

You can make use of System variable SY-SUBRC and you can go ahead with ur coding...

Reward If Helpful

Regards

--

Sasidhar Reddy Matli.

Message was edited by:

Sasidhar Reddy Matli

3 REPLIES 3

Former Member
0 Kudos

Hi,

Validation means check whether the value exist in the table or not.

Example:

AT SELECTION-SCREEN.

SELECT SINGLE vkorg

INTO l_vkorg

FROM vbak

WHERE vkorg EQ p_vkorg.

IF sy-subrc <> 0.

MESSAGE ...

ENDIF.

Former Member
0 Kudos

Hello pavan,

Validation means "checking whether the input which u are gining to the selection secreen is valid or not". means...

Lets take your example only...

parameters:p_vkorg like vbak-vkorg.

in selection screen you will give inout in that parameter....

users can give any input... lets suppose I'll give input as ABC... which is not in the table VBAK. No need to excute the code once we came to know that the input is not there in the table. So we will do validation like...

at selection-screen on p_vkorg.

select * from vbak where vkorg = p+vkorg. " This is the case with Parameter.

at selection-screen on p_vkorg.

Select * from vbak where vkorg = p+vkorg. " This is the case with Selct-option.

if the input that u r giving is present in the table... the above stmt will execute successfully, otherwise not.

You can make use of System variable SY-SUBRC and you can go ahead with ur coding...

Reward If Helpful

Regards

--

Sasidhar Reddy Matli.

Message was edited by:

Sasidhar Reddy Matli

Former Member
0 Kudos

Hello,

Validation is the process to check whether the input in the selection screen is valid or not.

For vkorg field validation please refer the below code.

<b>* Validate Customer No.

AT SELECTION-SCREEN ON p_vkorg.

SELECT SINGLE * FROM tvko WHERE vkorg = p_vkorg.

IF sy-subrc <> 0.

MESSAGE e041 WITH 'Enter valid Sales Organization.'.

ENDIF.</b>

Regards,

LIJO JOHN