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

selection screen validations

Former Member
0 Likes
418

i have a selection screen field PO, where in when i give any po numner.it should accept when that po exist or else should throw some error

3 REPLIES 3
Read only

RaymondGiuseppi
Active Contributor
0 Likes
396

Try this syntax

AT SELECTION-SCREEN ON PO.
  SELECT COUNT(*) FROM EKKO
  WHERE EBELN = PO. 
IF sy-subrc <> 0.
  MESSAGE Exxx(xx=?
ENDIF.

Regards

Read only

Former Member
0 Likes
396

Hi Tara,

WelCome to the this FORUMS...

Its simple as Raymond says.

In addition to that:

AT SELECTION-SCREEN on <b>s_po</b>. " (PO field defined on screen)

select.....

if sy-subrc <> 0.

error mssg.

endif.

This event (AT SELECTION-SCREEN on <b>s_po</b>. )is assigned to the selection screen fields corresponding to the report parameter or selection criterion s_po.

If the report starts an error dialog at this point, precisely these fields become ready for input.

Read only

Former Member
0 Likes
396

Hi Tara,

You can the selection screen validations through either AT SELECTION-SCREEN or AT SELECTION-SCREEN ON <FIELD> eveent.

Check with this code.

PARAMETERS: P_EBELN TYPE EKKO-EBELN.

AT SELECTION-SCREEN ON P_EBELN.
DATA V_EBELN TYPE EKKO-EBELN.
SELECT SINGLE EBELN
FROM EKKO
INTO V_EBELN
WHERE EBELN = P_EBELN.
IF V_EBELN IS INITIAL.
MESSAGE E000(ZI) 'No PO exists with this number, Plz try again'.
ENDIF.

Thanks,

Vinay