‎2008 May 15 2:58 PM
hi all,
I have to validate a screen feild in selection screen.
Its a parameter on selection screen of type business partner.
from table but000-partner.
I want that if the user enters anything other than business partner number, the program should throw an error.
saying the business partner doen't exist.....or invalid entry....
could you help me in how to do this validation...???
Points would be awarded.
‎2008 May 15 3:39 PM
Hi,
You can do by this way.
AT SELECTION-SCREEN ON so_partner.
PERFORM validate_partner.
&----
*& Form validate_partner
&----
FORM validate_partner.
SELECT partner
FROM but000
INTO TABLE it_partner
WHERE partner = so_partner.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH text-014.
ENDIF.
ENDFORM.
Here you need to declare it_partner.
And you can give your required message.
Regards
Sandeep Reddy
‎2008 May 15 3:01 PM
Write a select single statement in the
AT SELECTION-SCREEN event , if the entry is not foudn disaply the error message.
Regards
Naren
‎2008 May 15 3:04 PM
Hi Runal. You need to use AT SELECTION-SCREEN ON VALUE-REQUEST event. Do the select to validate and use the MESSAGE statement to show the error message. Thanks!
‎2008 May 15 3:13 PM
Hi,
You must validate it on AT SELECTION-SCREEN event.
There, you must make a selection, using the parameter value as filter, and use the return of the selection (sy-subrc) to check whether the value exists, or not.
Regards,
Brian Gonsales.
‎2008 May 15 3:26 PM
Hi Runal,
See the code below :
DATA w_but000 LIKE but000.
PARAMETER p_prtnr LIKE but000-partner.
AT SELECTION-SCREEN ON p_prtnr.
SELECT * FROM but000
INTO w_but000
WHERE partner = p_prtnr.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE 'Bad partner' TYPE 'E'.
ENDIF.
reward points if this is helpful.
regards,
Advait
Edited by: Advait Gode on May 15, 2008 4:26 PM
‎2008 May 15 3:39 PM
Hi,
You can do by this way.
AT SELECTION-SCREEN ON so_partner.
PERFORM validate_partner.
&----
*& Form validate_partner
&----
FORM validate_partner.
SELECT partner
FROM but000
INTO TABLE it_partner
WHERE partner = so_partner.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH text-014.
ENDIF.
ENDFORM.
Here you need to declare it_partner.
And you can give your required message.
Regards
Sandeep Reddy