Application Development and Automation 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: 
Read only

How to use MIC in bapi BAPI_INSPECTIONPLAN_CREATE?

Akshay_Yerawar
Active Participant
0 Likes
4,914

Hello all,

I have a scenario where i have to use same MIC( Master Inspection Characteristic ) in multiple Inspection plans, thats why i have created Quantitative MIC as incomplete copy model, where i have passed only two values i.e. Decimal places & Unit of measure. Now when i am trying to pass lower and upper specification limits from bapi 'BAPI_INSPECTIONPLAN_CREATE' it's not accepting values which i have passed in program. Bapi showing me error to enter lower specification limit and enter upper specification limit.Now if i enter lower and upper specification limit in QS21 then it's working fine, but i dont want this as i want to reuse MIC in multiple plan with different values.

I am really confused what input should i pass to field  'INSPCHARACTERISTIC-CHA_MASTER_IMPORT_MODUS' ?

Please help me to solve this issue.

Thanks.

Hello all,

I have a scenario where i have to use same MIC( Master Inspection Characteristic ) in multiple Inspection plans, thats why i have created Quantitative MIC as incomplete copy model, where i have passed only two values i.e. Decimal places & Unit of measure. Now when i am trying to pass lower and upper specification limits from bapi 'BAPI_INSPECTIONPLAN_CREATE' it's not accepting values which i have passed in program. Bapi showing me error to enter lower specification limit and enter upper specification limit.Now if i enter lower and upper specification limit in QS21 then it's working fine, but i dont want this as i want to reuse MIC in multiple plan with different values.

I am really confused what input should i pass to field  'INSPCHARACTERISTIC-CHA_MASTER_IMPORT_MODUS' ?

Please help me to solve this issue.

Thanks.

10 REPLIES 10
Read only

deependra_shekhawat3
Contributor
0 Likes
4,202

Hi Akshay,

What error message you are getting through BAPI ?

could you please paste sample code which you have passed to BAPI ?

Thanks

Deependra

Read only

0 Likes
4,202

Hello Deependra,

I have attached screen shot of the errors. Please have look on it.

Read only

0 Likes
4,202

Hi Akshay,

Have you passed both value to BAPI structure 'inspcharacteristic' of type BAPI1191_CHA_C. This will be great if you provide code which you are passing to BAPI Tables.

Thanks

Deependra

Read only

0 Likes
4,202

Hi Deependra,

Yes, I have pass both the values to the bapi. Below is the code of my program. Please go through it. I debugged it also, values are in internal table but bapi not taking these values. And also i am passing INSPCHARACTERISTIC-CHA_MASTER_IMPORT_MODUS as "C".

*&---------------------------------------------------------------------*

* MAIN LOOP

*&---------------------------------------------------------------------*

   LOOP AT ITAB.

     MATERIALTASKALLOCATION-MATERIAL     = ITAB-MATERIAL.

     MATERIALTASKALLOCATION-PLANT        = ITAB-PLANT.

     MATERIALTASKALLOCATION-VALID_FROM   = ITAB-VALID_FROM.

     TASK-VALID_FROM                     = ITAB-VALID_FROM.

     TASK-TASK_LIST_USAGE                = ITAB-TASK_LIST_USAGE.

     TASK-PLANT                          = ITAB-PLANT.

     TASK-TASK_LIST_STATUS               = ITAB-TASK_LIST_STATUS.

*  TASK-LOT_SIZE_FROM = 

     TASK-DESCRIPTION                    = ITAB-DESCRIPTION.

     TASK-TASK_MEASURE_UNIT              = ITAB-TASK_MEASURE_UNIT.

     APPEND : MATERIALTASKALLOCATION, TASK.

     LOOP AT IT_FINAL WHERE MATERIAL EQ ITAB-MATERIAL.

       OPERATION-VALID_FROM              = ITAB-VALID_FROM .

       OPERATION-ACTIVITY                = IT_FINAL-ACTIVITY .

       OPERATION-OPERATION_ID            = IT_FINAL-OPERATION_ID .

       OPERATION-CONTROL_KEY             = IT_FINAL-CONTROL_KEY  .

       OPERATION-WORK_CNTR               = IT_FINAL-WORK_CNTR  .

       OPERATION-PLANT                   = ITAB-PLANT  .

       OPERATION-DESCRIPTION             = IT_FINAL-DESCRIPTION_OP  .

       OPERATION-OPERATION_MEASURE_UNIT  = ITAB-TASK_MEASURE_UNIT .

       OPERATION-DENOMINATOR             = '1'.

       OPERATION-NOMINATOR               = '1'."

       OPERATION-BASE_QUANTITY           = IT_FINAL-BASE_QUANTITY  .

       APPEND OPERATION.

       LOOP AT IC_FINAL INTO WC_FINAL WHERE MATERIAL EQ ITAB-MATERIAL AND ACTIVITY EQ OPERATION-ACTIVITY .

         INSPCHARACTERISTIC-OPERATION_ID            = OPERATION-OPERATION_ID  .          INSPCHARACTERISTIC-ACTIVITY                = OPERATION-ACTIVITY .          INSPCHARACTERISTIC-INSPCHAR                = WC_FINAL-INSPCHAR .

         INSPCHARACTERISTIC-MSTR_CHAR               = WC_FINAL-MSTR_CHAR  .

         INSPCHARACTERISTIC-PMSTR_CHAR              = ITAB-PLANT.

         INSPCHARACTERISTIC-VALID_FROM              = ITAB-VALID_FROM.

         INSPCHARACTERISTIC-CHA_MASTER_IMPORT_MODUS =

         WC_FINAL-CHA_MASTER_IMPORT_MODUS  .

         INSPCHARACTERISTIC-LW_TOL_LMT              = WC_FINAL-LW_TOL_LMT.

         INSPCHARACTERISTIC-UP_TOL_LMT              = WC_FINAL-UP_TOL_LMT.

         INSPCHARACTERISTIC-SMPL_PROCEDURE   = WC_FINAL-SMPL_PROCEDURE  .

         INSPCHARACTERISTIC-SMPL_UNIT               = WC_FINAL-SMPL_UNIT.

         INSPCHARACTERISTIC-SMPL_QUANT              = '1'.

         APPEND INSPCHARACTERISTIC.

         CLEAR: INSPCHARACTERISTIC,WC_FINAL.

       ENDLOOP. " END OF INSPCHARACTERISTIC

       CLEAR OPERATION.

     ENDLOOP. " END OF OPERATION

*&---------------------------------------------------------------------*

* CALL TO BAPI

*&---------------------------------------------------------------------*

     CALL FUNCTION 'BAPI_INSPECTIONPLAN_CREATE'

*   EXPORTING

*     TESTRUN                      = ' '

*     PROFILE                      =

      IMPORTING

        GROUP                        GROUP

        GROUPCOUNTER                 GROUPCOUNTER

       TABLES

         TASK                         = TASK

         MATERIALTASKALLOCATION       = MATERIALTASKALLOCATION

         OPERATION                    = OPERATION

*     REFERENCEOPERATION           =

*     PRODUCTIONRESOURCE           =

         INSPCHARACTERISTIC           = INSPCHARACTERISTIC

*     TEXTALLOCATION               =

*     TEXT                         =

         RETURN                       = RETURN

*     INSP_CHAR_VALUES             =

               .

     LOOP AT RETURN WHERE TYPE EQ 'E'" TO CHECK IS THERE ANY ERROR OR NOT

       FLAG = 1.

     ENDLOOP.

     IF SY-SUBRC NE 1 AND GROUP IS NOT INITIAL AND GROUPCOUNTER IS NOT INITIAL AND FLAG ne 1.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'  "COMMIT WORK

*     EXPORTING

*       WAIT          =

*     IMPORTING

*        RETURN        = RETURN.

     .

       CONCATENATE  MATERIALTASKALLOCATION-MATERIAL 'INSPECTION PLAN HAS BEEN CREATED SUCCESSFULLY !'

                    '   GROUP : ' GROUP 'AND GROUPCOUNTER : ' GROUPCOUNTER INTO CON SEPARATED BY SPACE.

       WRITE / CON.

     ELSE.

       CONCATENATE 'SORRY FOR' MATERIALTASKALLOCATION-MATERIAL  'INSPECTION PLAN CREATION FAILED!' INTO CON SEPARATED BY SPACE.

       WRITE / CON.

     ENDIF.

     CLEAR : MATERIALTASKALLOCATION, TASK, CON.

     REFRESH: MATERIALTASKALLOCATION,OPERATION,TASK,INSPCHARACTERISTIC.

   ENDLOOP." END OF TASK LIST*&---------------------------------------------------------------------*

Read only

0 Likes
4,202

Hi Akshay,

In inspection characterstics , wherever you have Quantitive value , you need to pass INSPCHARACTERISTIC-QUANTITATIVE_IND = 'X'. If QUANTITATIVE_IND indecator is blank that means Qualitive.

Please do with BAPI ,whatever you are doing through QS21 . These kinds of flags are more important with this BAPI

Deependra

Read only

0 Likes
4,202

Yes, I have already tried that also.Whenever i tried to set any indicator in program, that time i got error

2ECQCL204Do not enter control indicators (X ) and C in DIRECT INPUT

Thing is that when we use INSPCHARACTERISTIC-CHA_MASTER_IMPORT_MODUS system won't allow to set any indicators in program. As i told earlier if i enter lower and upper limit in QS21, the same code will work fine.

Read only

0 Likes
4,202

Akshay,

What is the use of INSPCHARACTERISTIC-CHA_MASTER_IMPORT_MODUS = 'C'. Could you please explain ?

Read only

0 Likes
4,202

This indicator is used by system to know how to copy MIC values and indicators in inspection plan, we can give 3 inputs to this field which are 'L', 'C' & 'N', but i am confused which indicator can solve my issue.

Read only

0 Likes
4,202

Hi

Check your code what value you pass "INSPCHARACTERISTIC-PRESET_CTRL_INDS_KEY = " ? "

and check the parameter documentation "INSPCHARACTERISTIC"  also check below screen shot regarding you'r above error (i.e. E CQCL 204 ).

Regard's

Smruti

Read only

0 Likes
4,202

Dear Smruti,

This is the option which i was trying before raising this post. But in this case i have to give all the values i.e. measurement unit, decimal places, lower spec. limit, upper spec. limit & description in program. It is as good as creating new MIC not reusing existing one.