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

BAPI_INSPECTIONPLAN_CREATE - Issue

Former Member
0 Likes
3,111

Hi,

I am trying to create Inspection plan using BAPI -> BAPI_INSPECTIONPLAN_CREATE

As per requirement I want to copy Inspection plan details (like Material task allocation) of Material 'MAT1' to material 'MAT2'.

here MAT2 is created with reference to MAT1

For this i am importing following values to BAPI...

1. in table 'TASK' : group no(1), counter, valid from date, usage, plant, status and unit

2. in table MATERIALTASKALLOCATION : Material (MAT2), Plant and counter

On executing i am getting following messages:

E BAPI 001

A CPCL 006 Task list Q 1 1 already exists

A CPCC_DT 210 For further processing, the routing entry is missing

Can you please tell me why this has happen?

Is there any BAPI for Inspection plan Change/Display?

Also same scenario i have tested in QP01 with same details that i have mentioned above. There it is working properly.

8 REPLIES 8
Read only

Former Member
0 Likes
1,767

Hi,

Function Modules:

INSPECTIONPLAN_DISPLAY

INSPECTIONPLAN_CHAR_DISPLAY

In TASK table, you must enter a value for the following attributes to ensure the consistency of the header data:

TASK_LIST_USAGE, PLANT, TASK_LIST_STATUS, TASK_MEASURE_UNIT (unit of measure)

You can only specify a task list group (attributes TASK_LIST_GROUP and GROUP_COUNTER) with external number assignment. For internal number assignment, the task list group and the group counter are automatically determined during processing.

Read only

0 Likes
1,767

Hi Neenu,

I hv checked these FM:

INSPECTIONPLAN_DISPLAY

INSPECTIONPLAN_CHAR_DISPLAY

both function module are not usefull in my case as they are not giving me details related Material Task allocation

I am already passing these parameters : TASK_LIST_USAGE, PLANT, TASK_LIST_STATUS, TASK_MEASURE_UNIT (unit of measure) to BAPI but still getting error that i have mentioned above.

How to specify a task list group (attributes TASK_LIST_GROUP and GROUP_COUNTER) with external number assignment ?

thanks,

Read only

0 Likes
1,767

Hi,

Check structure: BAPI1191_TSK_C :Task List Header Data in CREATE-BAPI for Inspection Plans

Read only

0 Likes
1,767

Hi Neenu,

Thanks for attending my issue.

Please go though the test data that i am passing to BAPI

In table TASK

1. TASK_LIST_GROUP : 2 (already created)

2. GROUP_COUNTER : 1

3. VALID_FROM : 30.06.2009 (from table PLKO)

4. TASK_LIST_USAGE : 3

5. PLANT : A-L1

6. TASK_LIST_STATUS : 4

7. TASK_MEASURE_UNIT : EA

8. IND_UNITS_EXT_NUMBERING : 0 (any external numbering)

In table MATERIALTASKALLOCATION

1. Material : QMRM02 (this material has already allocated to group 1 and 3)

2. Plant : A-L1

3. Group counter : 1

Still i am getting these messages:

E BAPI 001

A CPCL 006 Task list Q 2 1 already exists

A CPCC_DT 210 For further processing, the routing entry is missing

If i go for testing in transaction QP01 with same data mentioned above then material is getting allocated to group '2' so why not i am getting success in BAPI ?

Read only

0 Likes
1,767

Still no luck from my side...

Should i switch to alternative solution like BDC for Tcode QP01 ? or i need to put extra efforts with same BAPI ?

Plz help...

Read only

0 Likes
1,767

I am also getting the error.

Can you let me know what was the fix for this?

Read only

0 Likes
1,767

You can eliminate this error by tweaking the main logic a little bit for Group Counter.

  • Fetch task list group & group counter from table MAPL based on Material, Plant and Task List Type as 'Q' and store the results in an Internal Table IT_MAPL.
  • Then sort the records in the Internal Table IT_MAPL by Material Plant Task List Group descending & Group Counter descending.
  • Read Internal Table IT_MAPL with index as '1'.
  • Derive the new Group counter by incrementing IT_MAPL-PLNAL.
  • Assign this new Group Counter to TASK Structure.

You can write a wrapper FM for this logic or can use enhancement spot in the beginning of the BAPI.

Read only

Former Member
0 Likes
1,767

Hi Amol,

               Please check this Sample Code .

ZSTRUC_INSPECTION_PLAN

1 MATNR     Material Number
2 PLNAL     Group Counter
3 PLNNR     Key for Task List Group
4 STTAG      Key date
5 WERKS      WERKS_D

*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" ITAB STRUCTURE ZSTRUC_INSPECTION_PLAN OPTIONAL
*"----------------------------------------------------------------------
* Developed by Smruti Ranjan Mohanty


* Global data declarations


  DATA: W_TAB LIKE ZSTRUC_INSPECTION_PLAN.
  DATA: DAT TYPE BUDAT,
        V_BUDAT TYPE BUDAT.


  DAT = SY-DATUM .

   CALL FUNCTION 'CONVERT_DATE_FORMAT'
    EXPORTING
      I_DATE      = DAT
    IMPORTING
      E_CALC_DATE = V_BUDAT.


  LOOP AT ITAB INTO W_TAB.
    REFRESH BDCDATA.

    PERFORM BDC_DYNPRO      USING 'SAPLCPDI' '8010'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RC271-PLNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RC27M-MATNR'
                                  ' '.
    PERFORM BDC_FIELD       USING 'RC27M-WERKS'
                                  W_TAB-WERKS .          "'3300'.               " plant
    PERFORM BDC_FIELD       USING 'RC271-PLNNR'
                                  W_TAB-PLNNR.           "'vs_cons4'.           " group
    PERFORM BDC_FIELD       USING 'RC271-STTAG'
                                  V_BUDAT .              "'21.07.2011'.          "W_TAB-STTAG .   "        '21.07.2011'.           " date
    PERFORM BDC_DYNPRO      USING 'SAPLCPDI' '1200'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RC27X-ENTRY_ACT'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=MTUE'.
    PERFORM BDC_FIELD       USING 'RC27X-ENTRY_ACT'
                                  '1'.
    PERFORM BDC_DYNPRO      USING 'SAPLCZDI' '4010'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RC271-PLNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=P++'.
    PERFORM BDC_DYNPRO      USING 'SAPLCZDI' '4010'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RC271-PLNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=P+'.
    PERFORM BDC_DYNPRO      USING 'SAPLCZDI' '4010'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'MAPL-WERKS(02)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=BACK'.

    PERFORM BDC_FIELD       USING 'MAPL-PLNAL(02)'
                                  W_TAB-PLNAL .         "'1'.                              " 1

    SHIFT W_TAB-MATNR LEFT DELETING LEADING '0'.

    PERFORM BDC_FIELD       USING 'MAPL-MATNR(02)'
                                  W_TAB-MATNR .            "'40013140'.                      " ip
    PERFORM BDC_FIELD       USING 'MAPL-WERKS(02)'
                                  W_TAB-WERKS .         "'3300'.                          " plant
    PERFORM BDC_DYNPRO      USING 'SAPLCPDI' '1200'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RC27X-ENTRY_ACT'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=BU'.
    PERFORM BDC_FIELD       USING 'RC27X-ENTRY_ACT'
                                  '1'.

    PERFORM BDC_MATERIAL_ASSIGN USING 'QP01'.


* ****************GET ALL MESSAGE DATA............................

    CALL FUNCTION 'FORMAT_MESSAGE'
      EXPORTING
        ID   = SY-MSGID
        LANG = 'EN'
        NO   = SY-MSGNO
        V1   = SY-MSGV1
        V2   = SY-MSGV2
        V3   = SY-MSGV3
        V4   = SY-MSGV4
      IMPORTING
        MSG  = RETURN-MESSAGE.
    CLEAR: W_TAB.
  ENDLOOP.

ENDFUNCTION.


*Text elements
*----------------

Regard's

Smruti Ranjan