Skip to Content

question about validation

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 29, 2008 at 04: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 29, 2008 at 04: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.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 29, 2008 at 05: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2008 at 05:48 PM

    thanx guys

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.