cancel
Showing results for 
Search instead for 
Did you mean: 

scripts

Former Member
0 Kudos

Hi all

Can you please explain about validation, how to do validation in reports..

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi manikantha,

the term validation means whenever u want a valid data for a valid input then u should go for validation...

this is generally written in following events,

AT SELECTION-SCREEN OUTPUT

AT SELECTION-SCREEN

for example if u want to check whether the input field is blank ...then u should use the following code

AT SELECTION-SCREEN.

if field is initial.

message 'please enter value' type 'E'.

endif.

hope this may help u out....

please reward incase usefull...

regards,

prashant

Answers (2)

Answers (2)

former_member196280
Active Contributor
0 Kudos

Under this event

AT SELECTION-SCREEN " do all your validations of selection screen

AT SELECTION-SCREEN ON <FIELD> " do validation for particular field.

Reward points if useful.

Regards,

SaiRam

Former Member
0 Kudos

hi,

Ur question is not so specific....

k lemme tell u

u can use the event AT SELECTION-SCREEN OUTPUT event for input validations like.........

AT SELECTION-SCREEN OUTPUT.

IF p_bukrs is initial.

*display error message her

endif.

here is one more good example code... go through it once...

selections screen declaration

select-options:s_bukrs for t001-bukrs ,

s_vkorg for tvko-vkorg ,

s_vtweg for tvtw-vtweg ,

s_spart for tspa-spart ,

s_werks for t001w-werks ,

s_kunag for kna1-kunnr,

s_vbeln for vbuk-vbeln.

*******At Selection Screen********************************************

at selection-screen.

  • Checking for the input values of selection screen.

perform screen_check.

&----


*& Form screen_check

&----


  • Ckecking for Selection Screen fields Validation

----


form screen_check.

  • Validation of Sales Organization

clear tvko.

if not s_vkorg-low is initial.

select vkorg from tvko up to 1 rows

into tvko-vkorg

where vkorg in s_vkorg.

endselect.

if sy-subrc ne 0.

message e009. " Invalid Sales Organization

endif.

endif.

  • Validation of Distribution Channel

clear tvtw.

if not s_vtweg-low is initial.

select vtweg from tvtw up to 1 rows

into tvtw-vtweg

where vtweg in s_vtweg.

endselect.

if sy-subrc ne 0.

message e010. " Invalid Distribution Channel

endif.

endif.

  • Validation of Division

clear tspa.

if not s_spart-low is initial.

select spart from tspa up to 1 rows

into tspa-spart

where spart in s_spart.

endselect.

if sy-subrc ne 0.

message e011. " Invalid Division

endif.

endif.

  • Validation for company code

clear t001.

if not s_bukrs-low is initial.

select single bukrs from t001

into t001-bukrs

where bukrs in s_bukrs.

if sy-subrc <> 0.

message e007. " Enter valid Company Code

endif.

endif.

  • Validation of billing Document Type

clear tvfk.

if not s_fkart is initial.

select fkart from tvfk up to 1 rows

into tvfk-fkart

where fkart in s_fkart.

endselect.

if sy-subrc ne 0.

message e012. " Invalid Billing Document Type

endif.

endif.

  • Validation of Billing Document Number

clear vbuk.

if not s_vbeln is initial.

select vbeln from vbuk up to 1 rows

into vbuk-vbeln

where vbeln in s_vbeln and

vbtyp = 'M'.

endselect.

if sy-subrc ne 0.

message e013. " Invalid Billing Doc Number

endif.

endif.

  • Validation of Customer

clear kna1.

if not s_kunag is initial.

select kunnr from kna1 up to 1 rows

into kna1-kunnr

where kunnr in s_kunag.

endselect.

if sy-subrc ne 0.

message e014. " Invalid Customer Number

endif.

endif.

  • Validation of Plant

clear t001w.

if not s_werks is initial.

select werks from t001w up to 1 rows

into t001w-werks

where werks in s_werks.

endselect.

if sy-subrc ne 0.

message e004. " Invalid Plant Number

endif.

endif.

endform. "screen_check

~~Guduri