Application Development 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: 

Validate plant and material on selection screen

Former Member
0 Kudos

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.

5 REPLIES 5

Former Member
0 Kudos

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

is it possible plz let me know

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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