05-29-2008 5:45 PM
Hi People
Sorry for posting this in general but didnt know wat category this would go in.
The question is suppose i have a select options for materila say s_matnr on the selection scree. I wanna validate it so i put a piece of validation at-sel-screen saying
SELECT SINGLE * FROM mara WHERE
matnr IN s_matnr.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-t06 s_matnr-low text-e01.
ENDIF.
But wat if some one enters a multiple selection on the sel screen where the 3rd and the 4th material nos are incorrect. In that case the system is not returning any error message.
Can some one suggest me a better way??
is looping on s_matnr a good option?
05-29-2008 5:48 PM
You are doing SELECT SINGLE *........ remove single and just say
SELECT * FROM MARA INTO TABLE LT_MATA WHERE MATNR IN S_MATNR.
IF SY-SUBRC <> 0.
error message
ENDIF.
05-29-2008 5:48 PM
You are doing SELECT SINGLE *........ remove single and just say
SELECT * FROM MARA INTO TABLE LT_MATA WHERE MATNR IN S_MATNR.
IF SY-SUBRC <> 0.
error message
ENDIF.
05-29-2008 5:50 PM
and just select matnr, no reason to select the whole table if there are going to be multiple materials, might take too much time
05-29-2008 5:49 PM
s_matnr is a range, which in essence is a table.
check NOT s_matnr is INITIAL.
LOOP AT s_matnr.
SELECT SINGLE * FROM mara WHERE
matnr IN s_matnr-LOW. " <== note change here
IF sy-subrc 0.
MESSAGE e000 WITH text-t06 s_matnr-low text-e01.
ENDIF.
ENDLOOP.
05-29-2008 6:21 PM
Hi,
do like this.
TYPES : BEGIN OF st_ebeln,
matnr TYPE mara-matnr,
END OF st_ebeln.
data : it_matnr TYPE STANDARD TABLE OF st_ebeln.
AT SELECTION-SCREEN ON so_matnr.
PERFORM validate_matnr.
&----
*& Form validate_ebeln
&----
FORM validate_ebeln.
SELECT matnr
FROM mara
INTO TABLE it_matnr
WHERE matnr IN so_matnr.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH text-014.
ENDIF.
ENDFORM.
Regards
Sandeep Reddy
05-29-2008 6:48 PM