03-21-2012 8:54 AM
HI
I want to extend the material master data from one plant to the other plant. I am new to MM Module.
I am using BAPI_MATERIAL_SAVEDATA to extend the material and working fine. However, the bapi do not extend the inspection data, hence i am using BAPI_MATINSPCTRL_SAVEREPLICA for extending data after material data extended using BAPI_MATERIAL_SAVEDATA.
While saving the Inspection data it is showing error "No Quality Management view has been created for material GMA000015". I guess in table MARC field QMATV should have value 'X' to copy the data. Please correct me if i m wrong. or i am using the wrong function code as '023'. I have tried using '009' as well but it give diff. error.
SELECT * INTO TABLE lt_qmat
FROM qmat
WHERE matnr = ls_clientdata-material AND
werks EQ plant-low.
LOOP AT lt_qmat INTO ls_qmat.
CLEAR : ls_bapi_qmat.
MOVE-CORRESPONDING ls_qmat TO ls_bapi_qmat.
ls_bapi_qmat-function = '023'.
ls_bapi_qmat-INSPTYPE = ls_qmat-ART.
ls_bapi_qmat-MATERIAL = ls_qmat-matnr.
ls_bapi_qmat-PLANT = to_plant-low.
ls_bapi_qmat-IND_INSPTYPE_MAT_ACTIVE = ls_qmat-AKTIV.
APPEND ls_bapi_qmat TO bapi_qmat.
ENDLOOP. "AT lt_qmat INTO ls_qmat.
CALL FUNCTION 'BAPI_MATINSPCTRL_SAVEREPLICA'
TABLES
return = lt_bapi_return
inspectionctrl = bapi_qmat.
03-21-2012 12:32 PM
You have to analyze BAPI_MATERIAL_SAVEDATA why the Quality managment view was not created.
It is usually the case if you do not submit a Q in PSTAT fields
03-21-2012 9:52 AM
Hey,
1st Please Check your Material Type Configuration in SPRO.
Is your Material GMA000015 has Quality Management View ,
If not then Configure for this Material's Type. Then Execute your code.
03-21-2012 10:16 AM
Hi Stallone,
I am extending the material and the inspection data already available for the material in another plant.
Thanks,
Janisar
03-21-2012 11:06 AM
I got it.
I have created same situation and done it.
1st see that QM in Procurement is Active or not for that Plant in Quality Management View,
Pass QM Control Key Also.
2. Code Change,
Do not Pass ls_bapi_qmat-function = '023'. Leave it Blank.
SELECT * INTO TABLE LT_QMAT
FROM QMAT
WHERE MATNR = 'NY01' AND "Material
WERKS EQ '1000'. "Ref Plant
LOOP AT LT_QMAT INTO LS_QMAT.
CLEAR : LS_BAPI_QMAT.
CALL FUNCTION 'MAP2E_QMAT_TO_BAPI1001004_QMAT'
EXPORTING
QMAT = LS_QMAT
CHANGING
BAPI1001004_QMAT = LS_BAPI_QMAT.
LS_BAPI_QMAT-PLANT = '2000'. "Your Plant to be Extended, can be same as ref
"Clear Etc fields from LS_BAPI_QMAT, or change
APPEND LS_BAPI_QMAT TO BAPI_QMAT.
ENDLOOP.
CALL FUNCTION 'BAPI_MATINSPCTRL_SAVEREPLICA'
TABLES
RETURN = LT_BAPI_RETURN
INSPECTIONCTRL = BAPI_QMAT.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
03-21-2012 12:32 PM
You have to analyze BAPI_MATERIAL_SAVEDATA why the Quality managment view was not created.
It is usually the case if you do not submit a Q in PSTAT fields
03-22-2012 6:07 AM
I got the answer. I mad following changes in BAPI_MATERIAL_SAVEDATA and it solved the error and now working fine.
BAPIMATHEAD-QUALITY_VIEW = 'X'
BAPIMATHEAD-INP_FLD_CHECK = 'W'.
and only
Apology for the foolish mistakes. I actually copied some initial code from sdn and forget to check all the available option in the BAPIMATHEAD. However, bapi help MAP2E_QMAT_TO_BAPI1001004_QMAT from arnold was very helpful.
Thanks and please accept points for the help.
Janisar
03-22-2012 6:11 AM
Thank you so much for Points.
I had worked with the same BAPI Before so I knew the Technical Problem.
You are most welcome for such discussion.
03-26-2012 6:30 AM
Any Idea on how to copy Localization data as well using BAPI_MATERIAL_SAVEDATA. I am working on SIN(india) Localization where i need to copy Excise Data as well for the material.
Thanks,
Janisar