11-26-2007 5:27 AM
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 didnt 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.
11-26-2007 5: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
11-26-2007 5: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.
11-26-2007 5: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
11-26-2007 6: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.
11-26-2007 7:11 AM