Hi,
I have a piece of code that calls two BAPI's.
The first one (BAPI_TARGETGROUP_REMOVE_BP) removes contacts from a target group.
The second call (BAPI_TARGETGROUP_ADD_BP) add contacts to the same target group.
When it is a large amount of data in the target group the program doesn't short dump but I get an e-mail from the system saying
Update was terminated. Error Info... CRM_MKTTG_TG 096: Error when changing entries in table CRMD_MKTTG_TG_I
I believe what is happening here is that the first call is somehow removing entries in an update task even though I do not call the BAPI explicitly in an update task.
When the second BAPI call executes this causes the failure because the first one has not finished updating.
Can anyone suggest how I can get round this?
I could put in a WAIT statement but even that could still fail if the target group is large enough.
My current code is:
CALL FUNCTION 'BAPI_TARGETGROUP_REMOVE_BP'
EXPORTING
targetgroupguid = gs_tg_guid
removeallbp = 'X'
TABLES
businesspartner = gt_bp_guids
return = gt_return.
COMMIT WORK.
CALL FUNCTION 'BAPI_TARGETGROUP_ADD_BP'
EXPORTING
targetgroupguid = gs_tg_guid
TABLES
return = gt_return
businesspartner = gt_bp_guids.
COMMIT WORK.
Many thanks
David