‎2007 Apr 09 12:38 PM
‎2007 Apr 09 12:55 PM
hi
here is the sample code for validations
in the PAI of the screen
select single <field name> into <variable> from itab.
if sy-subrc ne 0.
message e01(<message class>). * create message class in se91
endif.
this will clear ur doubt.
regards.
ravish
<b>plz reward if helpful.</b>
‎2007 Apr 09 12:39 PM
Hi,
If its a selection screen then u can do the validsations in AT SELECTION SCREEN event.
If it is a module Pool then u can do validations in the PAI event.
e.g. If u need to do validations on the Material in selection screen.
U can write after defining the selection screen:
AT SELECTION-SCREEN.
Select single * from mara where matnr = p_matnr.
if sy-subrc <> 0.
MESSAGE e000(0k) with 'Material doesnt exists'.
endif.
Regards,
Himanshu
Message was edited by:
Himanshu Aggarwal
‎2007 Apr 09 12:42 PM
Hi Prakash,
The screen validations can be done by using the events such as :
At-selection screen.
At-selection screen on <parameter name>
At-selection screen on value request.
Hope this helps u.
Regards,
Thasneem
‎2007 Apr 09 12:42 PM
Hi,
say your selection screen is like this:
select-options:s_bukrs for t001-bukrs no intervals no-extension
obligatory,
s_vkorg for tvko-vkorg no intervals no-extension,
s_vtweg for tvtw-vtweg no intervals no-extension,
s_spart for tspa-spart no intervals no-extension,
In at selection screen: you do the validations like:
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.
endform.
reward if useful
regards,
ANJI
‎2007 Apr 09 12:45 PM
Hi prakash,
you can do screen validations for report under events,
AT SELECTION-SCREEN.
AT SELECTION-SCREEN OUTPUT.
AT SELECTION SCREEN <ON FILEDNAME>.
<b>Reward if this helps,</b>
Regards,
Tejas
‎2007 Apr 09 12:54 PM
hi
here is the sample code for validations
in the PAI of the screen
select single <field name> into <variable> from itab.
if sy-subrc ne 0.
message e01(<message class>). * create message class in se91
endif.
this will clear ur doubt.
regards.
ravish
<b>plz reward if helpful.</b>
‎2007 Apr 09 12:55 PM
hi
here is the sample code for validations
in the PAI of the screen
select single <field name> into <variable> from itab.
if sy-subrc ne 0.
message e01(<message class>). * create message class in se91
endif.
this will clear ur doubt.
regards.
ravish
<b>plz reward if helpful.</b>