‎2008 Feb 05 8:28 AM
Hi Experts
i have to validate the selection screen like this :
select-option: s_matnr have lower range and higher range.
the logic developed by me is :
AT SELECTION SCREEN ON s_matnr.
SELECT matnr
FROM mara
INTO TABLE itab
WHERE matnr IN s_matnr.
IF sy-subrc <> 0.
MESSAGE exxx.
ENDIF.
but this is validating only the lower value, plse help me how validata upper (high) value.
it is allowing any kind of value in the upper range.
with regards
aaryaa
‎2008 Feb 05 8:34 AM
Hi Madhu,
If you want to validate a range, first of all it is not advisable, because purpose of a range would be lost. What if you have valid number 2 and 5.
Then user might enter S_MATNR as between 1 and 10.
The output should show 2 and 5, but since your program validates 1 and 10, it would not proceed
Anyway, if you still want to validate both then do this:
loop at s_matnr.
select single matnr from mara into v_matnr
where matnr eq s_matnr-low.
if sy-subrc ne 0. return error. endif.
check s_matnr-high is not initial.
select single matnr from mara into v_matnr
where matnr eq s_matnr-high.
if sy-subrc ne 0. return error. endif.
endloop.
Cheers,
Aditya
‎2008 Feb 05 8:34 AM
Hi Madhu,
If you want to validate a range, first of all it is not advisable, because purpose of a range would be lost. What if you have valid number 2 and 5.
Then user might enter S_MATNR as between 1 and 10.
The output should show 2 and 5, but since your program validates 1 and 10, it would not proceed
Anyway, if you still want to validate both then do this:
loop at s_matnr.
select single matnr from mara into v_matnr
where matnr eq s_matnr-low.
if sy-subrc ne 0. return error. endif.
check s_matnr-high is not initial.
select single matnr from mara into v_matnr
where matnr eq s_matnr-high.
if sy-subrc ne 0. return error. endif.
endloop.
Cheers,
Aditya
‎2008 Feb 05 8:36 AM
declare itab with header line.
also a variable say flag.
data flag.
AT SELECTION SCREEN ON s_matnr.
SELECT matnr
FROM mara
INTO itab
WHERE matnr IN s_matnr.
endselect.
IF sy-subrc <> 0.
move 'X' to flag.
ENDIF.
if flag is not initial.
message
endif.cheers,
Will.
‎2008 Feb 05 8:52 AM
Try this,
AT SELECTION SCREEN ON s_matnr.
SELECT matnr
FROM mara
INTO TABLE itab
WHERE matnr in( s_matnr-low s_matnr-high )
or matnr between s_matnr-low and s_matnr-high .
IF sy-subrc 0.
MESSAGE exxx.
ENDIF.