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

Update Terminated when executing BAPI_SERVNOT_ADD_DATA

Nkrish
Contributor
0 Likes
702

Hi,

I have used the BAPI_SERVNOT_ADD_DATA to add the cause codes in IW52 transaction. After the BAPI I use the BAPI_SERVNOT_SAVE and Then BAPI_TRANSACTION_COMMIT.

I dont need the partner update.

I am facing two problems :

when I dont write the sort numbers i.e ITEM_KEY or POSNR it gives me error : Sort number not entered

if I enter some number like 0010 or 0020 then update gets terminated and when I check sm13, ST22 for the reason it gives error :

SAPSQL_ARRAY_INSERT_DUPREC in the PM_PARTNER_UPDATE.

Could anyone please help me with this as I am not able to understand why does it need partner when updating causes.

This happens with BAPI_SERVNOT_MODIFY_DATA also.

I am using these BAPI immediately after CREATE.

Thanks and Regards,

Narayani

3 REPLIES 3
Read only

jayesh_gupta
Active Participant
0 Likes
629

Hi,

The sort field must be filled in order to create items, causes, task or activities. When creating a cause the sort field for the item must also be filled. The combination of sort field item/cause, item/task or item/activity must be unique within the same notification.

Please see the documentation available for BAPI_SERVNOT_CREATE. The same applies for BAPI_SERVNOT_ADD_DATA.

Regards,

Jayesh

Read only

0 Likes
629

Hi Jayesh,

Thanks for your answer. I tried but ufortunately get the same Update Terminated error.

I have attached my code below:

ls_qmur-CAUSE_SORT_NO  = '0001'.
    ls_qmur-CAUSE_KEY = '0001'.
    ls_qmur-ITEM_KEY = '0001'.
    ls_qmur-CAUSETEXT = 'HVACSYS'.
    ls_qmur-CAUSE_CODEGRP  = 'HVACSYS' .
    ls_qmur-CAUSE_CODE = '002'.
    ls_qmur-ITEM_SORT_NO = '0001'.
    APPEND ls_qmur to lt_qmur.


     ls_qmur_x-CAUSE_SORT_NO = 'X'.
     ls_qmur_x-CAUSE_KEY = 'X'.
     ls_qmur-ITEM_KEY = 'X'.
     ls_qmur-ITEM_SORT_NO = 'X'.
     ls_qmur_x-CAUSETEXT = 'X'.
     ls_qmur_x-CAUSE_CODEGRP = 'X'.
     ls_qmur_x-CAUSE_CODE = 'X'.
    APPEND ls_qmur_x to lt_qmur_x.

CALL FUNCTION 'BAPI_SERVNOT_MODIFY_DATA'
  EXPORTING
    number                   = number
*   NOTIFHEADER              =
*   NOTIFHEADER_X            =
* IMPORTING
*   NOTIFHEADER_EXPORT       =
TABLES
*   NOTIFITEM                =
*   NOTIFITEM_X              =
   NOTIFCAUS                = lt_qmur
   NOTIFCAUS_X              = lt_qmur_x
*   NOTIFACTV                =
*   NOTIFACTV_X              =
*   NOTIFTASK                =
*   NOTIFTASK_X              =
*   NOTIFPARTNR              =
*   NOTIFPARTNR_X            =
*   RETURN                   =
          .

  CALL FUNCTION 'BAPI_SERVNOT_ADD_DATA'
    EXPORTING
      number                  = number
*     I_BAPI                  = ' '
*  IMPORTING
*    NOTIFHEADER             = notif_header
*     NOTIFHDTEXT             =
   TABLES
*     NOTFULLTXT              =
*     NOTITEM                 =
     NOTIFCAUS               = lt_qmur
*     NOTIFACTV               =
*     NOTIFTASK               =
*     NOTIFPARTNR             =
*     KEY_RELATIONSHIPS       =
     RETURN                  = et_return
            .

    call function 'BAPI_SERVNOT_SAVE'
         exporting
              number = number
         tables
              return = et_return.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' "commit and wait for update
     EXPORTING
       wait          = 'X'
* IMPORTING
*   RETURN        =
              .

Thanks

Narayani

Read only

0 Likes
629

Try using BAPI_TRANSACTION_COMMIT with parameter WAIT = space instead of 'X'.

Regards,

Jayesh