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

Parameter validation

Former Member
0 Likes
672

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
635

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

5 REPLIES 5
Read only

Former Member
0 Likes
635

Write a select single statement in the

AT SELECTION-SCREEN event , if the entry is not foudn disaply the error message.

Regards

Naren

Read only

rodrigo_paisante3
Active Contributor
0 Likes
635

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!

Read only

Former Member
0 Likes
635

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.

Read only

Former Member
0 Likes
635

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

Read only

Former Member
0 Likes
636

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