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: 

Help with BAPI_MATINSPCTRL_SAVEREPLICA

Former Member
0 Kudos
2,398

Hi!

I need to update the "Inspection Setup" for some material masters. I found the fm "BAPI_MATINSPCTRL_SAVEREPLICA" which should be able to do this. But I have no idea how to use it.

Can somebody help me with that and show me an example how to fill the fields of the BAPI.

Thanks in advance,

Konrad

1 REPLY 1

Former Member
0 Kudos
646

Below code Update the 'Inspection setup' for material master

Report zcall_bapi.

*Internal table to store messages returned from BAPI

DATA:

ws_return LIKE " To store status

bapiret2 OCCURS 0 WITH HEADER LINE.

  • Internal table to store Inspection details to pass

  • as parameter to BAPI

DATA:

BEGIN OF ws_qmat OCCURS 0.

INCLUDE STRUCTURE BAPI1001004_QMAT.

DATA:

END OF ws_qmat.

DATA:

WS_INSP(2).

  • Retrieving Quality Score procedure from TQ34 table

select single QKZVERF

from TQ34

into ws_insp

where art = 'C003'.

ws_qmat-insptype = 'C003'.

ws_qmat-material = 'AMT1212'.

ws_qmat-plant = 'DM00'.

ws_qmat-IND_INSPTYPE_MAT_ACTIVE = 'X'.

WS_QMAT-QUAL_SCORE_PROCEDURE = ws_insp.

ws_qmat-PREFERRED_INSPTYPE = 'X'.

append ws_qmat.

CALL FUNCTION 'BAPI_MATINSPCTRL_SAVEREPLICA'

TABLES

return = ws_return

inspectionctrl = ws_qmat.

IF sy-subrc NE 0.

  • No sy-subrc check is required

ENDIF. " IF SY-SUBRC NE 0

IF ws_return-type EQ 'S' OR

ws_return-type EQ 'I' OR

ws_return-type EQ 'W'.

  • To commit the transation for succesfull records

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.