Skip to Content
0

EXEC_METHODCALL_PPF Multiple Documents Save Error

Feb 20, 2017 at 11:30 AM

213

avatar image

I am generating more than 1 task on one status change using action profiles.

But if I use function module CRM_ORDER_SAVE it is not generating any task giving error predecessor not found in database.

If I use function module CRM_ACTION_PUT_DOC_SAVE_OB it is not generating multiple tasks since during commit of second task guid of previous tasks is passed again giving DBSQL_DUPLICATE_KEY_ERROR dump in program SAPLCRM_ACTIVITY_H_DU.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Spencer Liang
Feb 20, 2017 at 11:42 PM
0

Hi Parab,

You may check

https://wiki.scn.sap.com/wiki/display/CRM/Method+call+in+action+with+BADI+EXEC_METHODCALL_PPF

and

https://wiki.scn.sap.com/wiki/display/CRM/Create+follow-up+document+via+Action

Above is the standard way to create followup whatever, like a task.

But, how can you generate more than 1 task within an action?

By standard, you cannot schedule or execute an action multiple times during one action determination. It means, for example you select status and the action will be executed, this action can be executed only once. So you cannot create several tasks within one action that is triggered when you select any status.

As you mentioned, you use FM crm_order_save, so most likely you have your z implementation of badi exec_methodcall_ppf?

In this case, I believe you need debug for the root cause. Better create a chat or sap incident.

Spencer

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hi Spencer,

I have 2 action profiles which are getting triggered on same status one is generating task using CRM_ORDER_MAINTAIN and other generating activity using BAPI_ACTIVITYCRM_CREATEMULTI.

For both action profiles I am passing source GUID and newly created GUID to CRM_ACTION_PUT_DOC_SAVE_OB.

But I observed that after commit internal table IT_RECORDS_TO_INSERT in function module CRM_ACTIVITY_H_UPDATE_DU the first GUID is getting inserted again with second GUID.

Regards,

Rohan

0

In standard BAPI_ACTIVITYCRM_CREATEMULTI will finally calls CRM_ORDER_MAINTAIN to create activity and crm_order_save to save it. As I understand, this bapi works the same as using crm_order_maintain directly in the badi

exec_methodcall_ppf.

So I guess,

in the first action, your z code calls crm_order_maintain. then you call CRM_ACTION_PUT_DOC_SAVE_OB.

CRM_ACTION_PUT_DOC_SAVE_OB calls crm_order_save to save it. This is ok.

in the second action, your z code calls BAPI_ACTIVITYCRM_CREATEMULTI.

BAPI_ACTIVITYCRM_CREATEMULTI calls crm_order_maintain and crm_order_save. Then you call CRM_ACTION_PUT_DOC_SAVE_OB which calls crm_order_save. so you save it twice and this is not correct.

If my understanding is correct. You may call BAPI_ACTIVITYCRM_CREATEMULTI only. Do not call CRM_ACTION_PUT_DOC_SAVE_OB anymore. You can have a try and perhaps the issue is solved.

If this is not the solution, hrrrrrrrrrrr, experiences tell me that we usually need to debug for the root cause. I can provide some debugging hints.

1, find out dump in st12 to know which object is being inserted, for example orderadm_h. Then you may watch its buffer. If you do not know what the buffer is, just let me know in comment.

2, set breakpoint for guid_create which creates the guid for every application functions in crm.

Spencer

1

Thanks Spencer, that was the correct answer.

0

Glad to know about it.

Mark it the best answer? ^_^

Spencer

0