‎2007 Jan 19 9:36 AM
Hi All,
Kindly tell me how to evaluate selection screen fields.
1.u will use select matnr frim mara into p_matnr where matnr = ...
2 or u will use select single matnr...
3.or u will use select single *....
4. or select ..up to 1 row..
‎2007 Jan 19 9:40 AM
data : p_matnr like mara-matnr,
v_matnr like mara-matnr.
select single matnr from mara into v_matnr where matnr eq p_matnr.
write : v_matnr.
‎2007 Jan 19 9:42 AM
if u want only one field ie matnt from mara then use -
select single matnr into p_matnr from mara where...
‎2007 Jan 19 9:42 AM
Hi Shankar ,
You have listed most of the ways of validating a selection screen element.
The way i would do is use SELECT SINGLE MATNR , the reason for this i just want to check if the user has entered at least one valid value so that i proceed the rest of processing , so if i get at least one record which is valid then i can procceed with processing else will display an error message.
Why i dont prefer the other 3 cases is it results in unnecessary access of data from the tables which is actually not required.
Regards
Arun
‎2007 Jan 19 9:47 AM
Usually i try to optimize like thge following example:
(1) Define SSCRFIELDS strcture in your program
(2) In SELECTION-SCREEN control check if user press enter for control on lauched the program
AT SELECTION SCREEN ON s-matnr.
if SSCRFIELDS-ucomm = 'ONLI'
or SSCRFIELDS-ucomm = 'PRIN'.
select * from mara into table t_mara where matnr in s-matnr.
else.
select single * from MARA where matnr in s-matnr.
endif.
if sy-subrc <> 0.
message e665(cn).
endif.
So, in case of real execution, i can use previous controls result to execute complex controls, in other case, i perform only elementary checks.
Regards
‎2007 Jan 19 10:47 AM
hi,
data l_matnr type mara-matnr.
parameters : p_matnr like mara-matnr.
at selection-screen.
if p_matnr is not initial .
select matnr from mara into l_matnr .
if sy-subrc <> 0.
MESSAGE e027(zz_mess).
endif.
endif.