Application Development 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: 

Validation

Former Member
0 Kudos


SELECT VBELN BSARK VTWEG SPART VDATU FROM VBAK INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE
 ERDAT IN S_ERDAT
 AND VKORG IN S_VKORG
 AND VTWEG IN S_VTWEG
 AND BSARK IN S_BSARK
 AND SPART IN S_SPART.

I want to provide validation for the above statements in selection screen.Can anyone plz tell the code for it.

5 REPLIES 5

Former Member
0 Kudos

Hi

Declare them as select-options

write BSARK field also like this

select-options: s_vkorg for tvko-vkorg ,

s_vtweg for tvtw-vtweg,

s_spart for tspa-spart.

and in the at selection-screen write the code as below.

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.

endform. "screen_check

Regards

Anji

Former Member
0 Kudos

We normally validate paramaters but not select options. The reason is that the user could put in a number of single entries, some of which are wrong, but if there is at least one correct entry, the select option will pass the validation check.

Rob

Former Member
0 Kudos

Why cant You use VALUE CHECK in selection screens

0 Kudos

I don't think VALUE CHECK works for select options - try it.

Rob

0 Kudos

It doesn't work.

Best would be to put validations after the statement.

AT SELECTION-SCREEN.

Amandeep