Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

question about validation

Former Member
0 Likes
737

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
706

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.

5 REPLIES 5
Read only

Former Member
0 Likes
707

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.

Read only

0 Likes
706

and just select matnr, no reason to select the whole table if there are going to be multiple materials, might take too much time

Read only

Former Member
0 Likes
706

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.

Read only

Former Member
0 Likes
706

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

Read only

Former Member
0 Likes
706

thanx guys