11-20-2007 6:48 PM
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.
11-20-2007 6:59 PM
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
11-20-2007 7:04 PM
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
11-20-2007 7:12 PM
11-20-2007 7:18 PM
11-20-2007 7:20 PM
It doesn't work.
Best would be to put validations after the statement.
AT SELECTION-SCREEN.
Amandeep