08-13-2007 1:52 PM
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
08-13-2007 2:00 PM
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
08-13-2007 1:56 PM
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.
08-13-2007 2:00 PM
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
08-13-2007 2:05 PM
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