‎2008 Aug 04 10:53 AM
Hi Friend:
I've 10 fields on selection screen. All are select options.Out of that 3 are mandatory. Based on that I've fetched data in different internal tables. Now I've to put a validation for the case when the user might enter data in non mandatory select options. say. for S_matnr. Should I put a check on the final table or on itab_mara (in which I fectehd data related to MARA table). Please give me the code as well.
Thanks
‎2008 Aug 04 11:02 AM
Hi,
Try using the Validation for the field and giving an error if theres an invalid input,
AT SELECTION-SCREEN.
IF NOT s_matnr IS INITIAL.
SELECT SINGLE
matnr
FROM mara
INTO (w_matnr)
WHERE matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE e888(sabapdocu)
WITH 'Invalid Material number'.
ENDIF.
ENDIF.
This code checks for values entered into S_MATNR. If all the values entered are invalid it will throw up an error on the selection screen.
This restricts the execution of the program until a valid input is provided by the user on the screen.
‎2008 Aug 04 10:56 AM
Hi,
Put a validation,
If not s_matnr-low is initial or
not s_matnr-high is initial.
select * from mara
into itab_mara
where matnr in s_matnr.
endif.Best regards,
Prashant
‎2008 Aug 04 10:59 AM
Hi change below as per requirement
END-OF-SELECTION
Loop at s_matnr.
If s_matnr-LOW eq it_final-matnr.
endif.
endloop.
rgds
rajesh
‎2008 Aug 04 11:01 AM
validate all your select-options in
AT SELECTION SCREEN events.
if s_matnr is not initial.
select single matnr
from mara
into w_matnr
where matnr in s_matnr.
if sy-subrc NE 0.
message.....
endif.
endif.With luck,
Pritam.
‎2008 Aug 04 11:01 AM
When selecting data from database tables pass all select-options in the where clause using in operator.
Ex:
Select fld1...fldn
from <table>
into table i_tab
where fld1 in s_fld1
and fld2 in s_fld2
and ......
and fld10 in s_fld10.
For non-mandatory select-options in no value is given in the selection screen then it will fetch all the records.otherwise it will fetch only the record that is present in the select-option.
Regards,
JOy.
‎2008 Aug 04 11:02 AM
Hi,
Try using the Validation for the field and giving an error if theres an invalid input,
AT SELECTION-SCREEN.
IF NOT s_matnr IS INITIAL.
SELECT SINGLE
matnr
FROM mara
INTO (w_matnr)
WHERE matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE e888(sabapdocu)
WITH 'Invalid Material number'.
ENDIF.
ENDIF.
This code checks for values entered into S_MATNR. If all the values entered are invalid it will throw up an error on the selection screen.
This restricts the execution of the program until a valid input is provided by the user on the screen.