Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2756

Re: Upload inspection setup using BAPI

$
0
0

Hi,

You can use below code. it will be work, Just now i checked in my development system, It is working.

If you don't mind small suggestions.

 

1)Choose one material code then add it manually. If u add inspection type successfully. then again go to mm02  delete that inspection type . then use the below code and add the inspection type  For that material Code only,then only you know whether bapi is having the problem or particular material is having the problem.

 

 

 

 

 

**Test

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

 

WS_QMAT-INSPTYPE = 'A1'. "Your Inspection type

WS_QMAT-MATERIAL = 'abcd'. "Your material code.

WS_QMAT-PLANT = '1000'.

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.


Viewing all articles
Browse latest Browse all 2756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>