Skip to Content
author's profile photo Former Member
Former Member

Validate plant and material on selection screen

Hi all,

I want to validate plant and material on selection screen. More over I need to validate the combination of that also (i.e plant based materials). Individually I made the validations, but combination I didn’t get it.

For your information both are select-options, please reply me if you have an idea. The table to get the relationship is KEKO. I have the below code for parameters, but I require code for select options.

SELECT MATNR WERKS FROM KEKO UP TO 1 ROWS

INTO (KEKO-MATNR, KEKO-WERKS)

WHERE MATNR = P_MATNR AND

WERKS = P_WERKS.

IF SY-SUBRC <> 0.

MESSAGE E023 WITH 'COST ESTIMATE NOT FOUND FOR '

P_MATNR P_WERKS 'COMBINATION'.

ENDIF.

ENDSELECT.

<b>Note: I need to calidate on KEKO only..</b>

Surely I will reward you.

Thanks in Advance,

Raghu.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 05:36 AM

    if u want materials under a plant then how can u declare select-options for both

    is it possible plz let me know

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 05:37 AM

    in the AT SELECTIO-SCREEN OUTPUT event give the following querry...

    SELECT SINGLE WERKS FROM KEKO

    WHERE MATNR = P_MATNR

    AND WERKS = P_WERKS.

    IF SY-SUBRC <> 0.

    MESSAGE E023 WITH 'COST ESTIMATE NOT FOUND FOR '

    P_MATNR P_WERKS 'COMBINATION'.

    STOP.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 05:38 AM

    hi raghu,

    there is no use of giving SY-SUBRC inside select and endselect give it outside it will work

    i hope it will help you

    regards,

    karthik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 06:22 AM

    Hi rag ,

    The following code will works .... i have practically used in my report.

    • Local data declaration

    DATA: l_material TYPE matnr.

    • Validation check for material

    IF s_matnr IS NOT INITIAL.

    SELECT matnr "material

    FROM mara

    UP TO 1 ROWS

    INTO l_material

    WHERE matnr IN s_matnr.

    ENDSELECT.

    IF l_material IS INITIAL .

    • Invalid material entered .

    MESSAGE e136.

    ELSEIF s_mawerk IS NOT INITIAL.

    CLEAR l_material .

    • Validation check for material exists in plant

    SELECT matnr "material

    FROM marc

    UP TO 1 ROWS

    INTO l_material

    WHERE matnr IN s_matnr

    AND werks IN s_mawerk.

    ENDSELECT.

    IF sy-subrc NE 0 .

    • Invalid material entered for the plant.

    MESSAGE e130.

    ENDIF .

    ENDIF.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 07:11 AM

    Hi , give that SY-SUBRC , outside of Select , End select

    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.