‎2007 Feb 22 4:28 AM
Hi All,
I have 2 select-options in my selection-screen.i have to vlaidate if user entered correct value or not for low and high values.
Plese give me the code.
thakns&Regards.
Ramu.
‎2007 Feb 22 4:32 AM
hi,
why dont u try this..
select-options: s_a for csks-kostl .
at selection-screen on s_a .
if s_[]is initial .
error message
else .
if s_a-low is initial and s_a-high is initial .
*error message
endif .
endif .
Rewards useful points....
Siva
‎2007 Feb 22 4:33 AM
Hi,
Make sure that u are validating against the header table.
say eg if u wnat t validate matnr in marc, then do as below.
SELECT-OPTIONS: s_matnr FOR marc-matnr. "Material No
AT SELECTION-SCREEN.
*Validate material no details
PERFORM validate_matno.
FORM validate_matno.
DATA: v_matnr LIEK mara-matnr.
IF NOT s_matnr[] IS INITIAL.
LOOP AT s_matnr.
SELECT SINGLE matnr INTO v_matnr
FROM <b>mara</b>
WHERE matnr = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM.<b>Dont select from marc.</b>
Hope this is clear.
‎2007 Feb 22 4:34 AM
Hi,
write the code in AT selection-screen to validate the same
regards
Shiva
‎2007 Feb 22 4:34 AM
select-options : s1 for mara-matnr,
s2 for mard-lgort.
at selection-scree.
if s1-low ne '1000'.
message 'error' type 'E'.
endif.
if s1-high ne '1003'.
message 'error' type 'E'.
endif.
like that for s2-low and s2-high...also
start-of-selection.
regards
shiba dutta
‎2007 Feb 22 4:35 AM
Hi,
for example you have s_werks as selectoption.
we need to validate this from checktable,because check table contain all possible values of that perticular field.
SELECT WERKS
FROM TOO1W
INTO LV_WERKS
WHERE WERKS IN S_WERKS_LOW.
IF LV_WERKS IS INITIAL.
WRITE: 'ENTER VALID PLANT'.
ENDIF.
For validating high value do as follows.
select werks
from t001w
into lv_werks
where werks in s_werks_high.
if l_werks is initial.
write:'enter valid plant'.
endif.
Thanks,
Sarala.
Message was edited by:
Sarala
‎2007 Feb 22 4:43 AM
Hi,
at selection-screen output.
if not s_1[] is initial.
loop at s_1.
if s_1-low = value1 .
endif.
if s_1-high = value2.
endif.
endloop.
endif.
‎2007 Feb 22 4:43 AM
Hi,
here is the code for one of the select-options field..
select-options:s_phase for QMEL-PHASE .
AT SELECTION-SCREEN ON s_phase.
PERFORM validate_phase_low USING s_phase-low.
PERFORM validate_phase_high USING s_phase-high.
*************************************************************
FORM validate_phase_low USING S_PHASE_LOW.
IF NOT s_phase_low IS INITIAL.
SELECT phase
FROM qmel INTO s_phase_low
WHERE phase EQ s_phase_low.
EXIT.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e897(qm) WITH text-002.
ENDIF.
ENDIF.
ENDFORM. " validate_phase_low
*************************************************************
FORM validate_phase_high USING S_PHASE_HIGH.
IF NOT s_phase_high IS INITIAL.
SELECT phase
FROM qmel INTO s_phase_high
WHERE phase EQ s_phase_high.
EXIT.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e897(qm) WITH text-002.
ENDIF.
endif.
ENDFORM. " validate_phase_high
thanks,
Manjunath MS
‎2007 Feb 22 5:15 AM
‎2007 Feb 22 5:17 AM
Hi,
I have given u the code for one say one is MaTNR and the other is userid.
Same way
AT SELECTION-SCREEN ON s_user.
Perform validation_user.
Let me know the two fields and table names.
‎2007 Feb 22 5:22 AM
Ramu,
say you have the below two Select-options:
SELECT-OPTIONS: s_matnr for mara-matnr,
s_werks for marc-werks.
write check as below:
DATA: p_matnr like mara-matnr,
p_werks like marc-werks.
AT SELECTION-SCREEN.
IF NOT s_matnr[] IS INITIAL.
select single matnr into p_matnr from mara where matnr in s_matnr.
if sy-subrc ne 0.
*ERROR MESSAGE
endif.
ENDIF.
IF NOT s_werks[] IS INITIAL.
select single werks into p_werks from too1w where werks in s_werks.
if sy-subrc ne 0.
*ERROR MESSAGE
endif.
ENDIF.
‎2007 Feb 22 5:26 AM
Repeate the same code for second select-option field also.
its same for each and every select-option.
Thanks,
Sarala.