2005 Dec 15 11:31 AM
Hi all,
How to validate a selection-screen field defined as a select-options.for Ex i declared a selection-screen field select-options:s_matnr for mara-matnr.
Then how to validate this field.
2005 Dec 15 11:36 AM
Hi,
write the below code in AT SELECTION-SCREN.
EX :
AT SELECTION-SCREEN.
*-- Validate the Selection screen data
PERFORM VALIDATE_SELSCR_DATA.
WRITE THE below code in Form "VALIDATE_SELSCR_DATA".
IF S_MATNR[] IS INITIAL.
*--MATNR is initial.
message e000(MsgCLass) with 'matnr is empty'.
ELSE.
SELECT MATNR
INTO MARA-MATNR
FROM MCHA
UP TO 1 ROWS
WHERE MATNR IN S_MATNR.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Invalid MATNR entered'.
ENDIF.
ENDIF.
Hi all,
How to validate a selection-screen field defined as a select-options.for Ex i declared a selection-screen field select-options:s_matnr for mara-matnr.
Then how to validate this field.
2005 Dec 15 11:34 AM
Hi
Use the below code..
AT SELECTION-SCREEN
IF NOT S_MATNR[] IS INITIAL.
<SOME MESSAGE>
ENDIF.
Regards,
Abdul
Message was edited by: Abdul Hakim
Message was edited by: Abdul Hakim
2005 Dec 15 11:36 AM
Hi,
write the below code in AT SELECTION-SCREN.
EX :
AT SELECTION-SCREEN.
*-- Validate the Selection screen data
PERFORM VALIDATE_SELSCR_DATA.
WRITE THE below code in Form "VALIDATE_SELSCR_DATA".
IF S_MATNR[] IS INITIAL.
*--MATNR is initial.
message e000(MsgCLass) with 'matnr is empty'.
ELSE.
SELECT MATNR
INTO MARA-MATNR
FROM MCHA
UP TO 1 ROWS
WHERE MATNR IN S_MATNR.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Invalid MATNR entered'.
ENDIF.
ENDIF.
2005 Dec 15 11:38 AM
at selection-screen.
if s_field[] is inital.
message...
else.
select ..
if sy-subrc <> 0.
message ...
endif.
endif.
2005 Dec 15 11:42 AM
Hi murali,
validations are made using the check tables
for ur ex.. for matnr the check table is mara
and code as follows would work
select single matnr
into v_matnr
from mara
where matnr in s_matnr.
if sy-subrc <> 0.
display error message.
endif.
2005 Dec 15 11:43 AM
In the event
at selection-screen.
perform validate_material.
form validate_material.
data: v_matnr type mara-matnr.
if not s_matnr is initial.
select matnr
from mara up to 1 rows
into v_matnr
where matnr in s_matnr.
endselect.
if sy-subrc <> 0.
message exxx(message-id) with 'Please enter valid Material'.
endif.
endif.
endform.
2005 Dec 15 11:57 AM
hi
use
AT SELECTION-SCREEN
IF NOT S_MATNR[] IS INITIAL.
<SOME MESSAGE>
ENDIF.
plz reward points if it solve dur query!!
Regards
Gunjan
2005 Dec 15 12:15 PM
Hi Murli,
The select-option is stores the data as an internal table and strctly validation to be done if the OPTION is 'EQ'. So on trick is to store all the entries s_matnr-low in an internal table when OPTION is EQ & sign is I.
Then select the data from mara where matnr in s_matnr and store the data in another internal table.
Now compare the two, if the entry is there in select option but not in data retrieved from Mara U can display error message.
2005 Dec 15 12:16 PM
Hi,
at selection-screen on s_matnr.
if not s_matnr[] is initial.
select single matnr into v_matnr from mara
where matnr in s_matnr.
if sy-subrc ne 0.
message e000 with 'Enter valid Material Number'.
leave list-processing.
endif.
endif.
Kindly reward points if it helps.
2020 Aug 29 9:23 AM
data : gv_matnr type mara-MATNR.
SELECT-OPTIONS : s_matnr FOR GV_MATNR.
if S_MATNR is INITIAL.
MESSAGE : 'Enter the Material Number ' TYPE 'E'.
ENDIF.