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

Difference between screen level validations and field level validations????

Former Member
0 Likes
2,320

hi experts,

i am new to ABAP ,pls tel me what exactly validation mean? and,

the difference between screen level validations and field level validations??

3 REPLIES 3
Read only

Former Member
0 Likes
1,054

Hi Karthik,

Validation is nothing but checking the field ,whether the value entered in that field is correct or not.

Eg: You will have userid and password to logging to your sap system.Give any of the field wrong then it shows error message like password is wrong or username is wrong .Why because you have entered wrong details.This is called validation.

Suppose if u have a fields like  p_mantr  p_werks in selection screen.To validate the fields  we have events

'AT SELECTION-SCREEN'. event used for total selection screen - Screen Validation(both matnr and werks)

'AT SELECTION-SCREEN ON <FIELD> event used for particular field - Field Validation(specifically either matnr or werks)

Select-options : P_matnr for mara-matnr

                         P_werks for mara-werks.

AT SELECTION-SCREEN

If p_matnr-low ne 448224 and p_werks-high = FIb4 .

   Error message.

Endif.

AT SELECTION-SCREEN ON p_matnr

select-options  p_matnr for mara-matnr

If p_matnr-low ne 448224 and p_matnr-high ne 448236

   Error message.

Endif.

Thanks

Vamsi

Read only

Former Member
0 Likes
1,054

Validation is the check that you put in your program to see if the data inputted by the user is valid or not.

There are various ways you can do it.

You can verify that the inputted values is be one of the values in the domain for that datatype.

->*  For a parameter in the selection screen, you could validate the parameter using the addition value check in the parameter declaration .

Parameters bukrs type t001d-bukrs obligatory value check.

This would validate the input against the check table. (domain values for that field)

->* You could also call the function module. FM_DOMAINVALUE_CHECK. Give the domain name and the value in the parameters I_DOMNAME and I_DOMVALUE. The FM returns if the inputted value is valid or not by check it against the value table.

Note :

It is to be mentioned here that value table is generated at the domain level, while check table validates at field level, providing all the possible values for that field. Check this link to understand it better. .

http://wiki.scn.sap.com/wiki/display/Snippets/Dialog+programming,+dynpro+screen+field+validation

->* Else you could implement your own validation code in your program to see if the inputted value is valid.

In selection screen, you can put your validation in AT SELECTION-SCREEN OUTPUT event of the selection screen.

eg

AT SELECTION-SCREEN OUTPUT

if p_date GT sy-datum.

  message 'Date greater than current date' type i.

  exit.

endif.

->* For module pool program, there are various ways of validation the input.

http://wiki.scn.sap.com/wiki/display/Snippets/Dialog+programming,+dynpro+screen+field+validation

*Validating a single field on a dynpro screen via a PAI module call

  FIELD scr_field-ebeln

   MODULE validate_screen_field     "ABAP code for validation contained in PAI module

  ON INPUT.

*Validating multiple field on a dynpro screen via a PAI module call

  CHAIN.

    FIELD: scr_field-ebeln, scr_field-ebelp.

    MODULE validate_screen_fields.   "ABAP code for validation contained in PAI module

  ENDCHAIN.

*Validating a dynpro screen field via a direct ABAP table selection

  FIELD scr_field-ebeln.

    SELECT *

      FROM ekko

     WHERE ebeln = scr_field-ebeln

      INTO ekko

       WHENEVER NOT FOUND SEND ERRORMESSAGE 001

                         WITH ' Document Number '.

ON INPUT.


Read only

Former Member
0 Likes
1,054

Thankyou MOHAN and SUSHMITHA for ur valuable answers,now i am clear in validations.ur ans help me a lot