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: 

Extending Material Inspection Setup in Quality Management View

janisar_munshi
Participant
0 Kudos

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.


1 ACCEPTED SOLUTION

JL23
Active Contributor

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

7 REPLIES 7

0 Kudos

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.

0 Kudos

Hi Stallone,

I am extending the material and the inspection data already available for the material in another plant.

Thanks,

Janisar

0 Kudos

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'.

JL23
Active Contributor

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

0 Kudos
Thanks Jürgen L. & stallone christian.

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

0 Kudos

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.

0 Kudos

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