cancel
Showing results for 
Search instead for 
Did you mean: 

CRM Copy control: CRM_COPY_BADI for document relationship

Former Member
0 Kudos

Hello!

I need CRM copy control from an opportunity to another opportunity. The implementation of badi CRM_COPY_BADI should include document relationships: target document should be related to the same documents linked in the source document.

I cannot find a method to do this.

Please, could anyone suggest me a solution?

Thank you.

Kind regards.

Elena

Accepted Solutions (1)

Accepted Solutions (1)

SandeepJha
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Elena,

Please follow the steps below:

1) Go to transaction CRMV_EVENT

Click on "Object Function/Callback" button

Create a new entry with following values:

Function Module: ZCRM_DOCFLOW_COPY_EC

Object Function: CRM_DOC_FLOW

2) Go to IMG Path: Customer Relationship Management -> Transactions -> Basic Settings -> Edit Event Handler Table :

Here create a new entry with the following details

Trans. Category BUS2000111 Opportunity

Execution Time 1 Immediately

Priority 99

Object Name ORDERADM_I Administration item

Event AFTER_CREATE_WITH_REFERENCE

Attribute <*>

Function ZCRM_DOCFLOW_COPY_EC

Perform Function for Doc.Header = "Checked"

Perform Function for Document Item = "Checked"

Call Callback = space

3) Create function module ZCRM_DOCFLOW_COPY_EC with the following signature:

*" IMPORTING

*" REFERENCE(IV_STRVAL_OLD) TYPE ANY OPTIONAL

*" REFERENCE(IV_STRVAL_NEW) TYPE ANY OPTIONAL

**Code:

DATA:

FIELD-SYMBOLS:

<ls_orderadm_i_wrk> TYPE crmt_orderadm_i_wrk,

<lu_orderadm_i_wrk> TYPE crmt_orderadm_i_wrk.

ASSIGN iv_strval_new TO <ls_orderadm_i_wrk>.

ASSIGN iv_strval_old TO <lu_orderadm_i_wrk>.

**

4) Now in this function module you can read the docflow of old opportunity (<lu_orderadm_i_wrk>) using 'CRM_DOC_FLOW_READ_OB'

Build the new docflow entry for the new opportunity and call 'CRM_DOC_FLOW_MAINTAIN_OW'

Please let me know if any questions.

Thanks,

Sandeep

Former Member
0 Kudos

Hello Sandeep !

Thank you very much for this answer. Please, could you check IMG Path ? I cannot find "Customer Relationship Management -> Transactions -> Basic Settings -> Edit Event Handler Table".

Please, note I'm working in CRM 5.00.

Could you suggest me the transaction for this event handler ?

Thank you.

Bye.

Elena

SandeepJha
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you please open the maintenance view CRMV_EVENT_CUST instead?

Former Member
0 Kudos

Hello Sandeep !

Thank you very much.

I'm implementing f.m. Z_CRM_DOCFLOW_COPY_EC. As our opportunities don't include items, I'm usingi the following abap instructions:

FUNCTION Z_CRM_DOCFLOW_COPY_EC.

*"----


""Interfaccia locale:

*" IMPORTING

*" REFERENCE(IV_STRVAL_OLD) TYPE ANY OPTIONAL

*" REFERENCE(IV_STRVAL_NEW) TYPE ANY OPTIONAL

*"----


DATA: ...

FIELD-SYMBOLS:

<ls_orderadm_i_wrk> TYPE crmt_orderadm_h_wrk,

<lu_orderadm_i_wrk> TYPE crmt_orderadm_h_wrk.

break-point.

ASSIGN iv_strval_new TO <ls_orderadm_i_wrk>.

ASSIGN iv_strval_old TO <lu_orderadm_i_wrk>.

I'm able to read old document relationships by f.m. CRM_DOC_FLOW_READ_OB. How can I call f.m. CRM_DOC_FLOW_MAINTAIN_OW ? Which value the function needs as iv_ref_guid ? It seems this parameter has to be filled by a document item guid.

Thank you.

Elena

Former Member
0 Kudos

Hello Sandeep!

I solved the problem. If the document does not include items, parameter iv_ref_guid must be equal to iv_header_guid.

Thank you very much for the your solution.

Kind regards.

Elena

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi people,

A little doubt about this:

2) Go to IMG Path: Customer Relationship Management -> Transactions -> Basic Settings -> Edit Event Handler Table :

Here create a new entry with the following details

Trans. Category BUS2000111 Opportunity

Execution Time 1 Immediately

Priority 99

Object Name ORDERADM_I Administration item

Event AFTER_CREATE_WITH_REFERENCE

Attribute <*>

Function ZCRM_DOCFLOW_COPY_EC

Perform Function for Doc.Header = "Checked"

Perform Function for Document Item = "Checked"

Call Callback = space

The transaction category ( BUS2000111 Opportunity in this example) correspond to the category of the follow up activity or is the category of the transaction from which is being created?

Thank you!

Regards,

Mariano.

ashish_nagpal
Active Contributor
0 Kudos

hi

why not instead of copy control you try to create an opportunity as a follow up document to the existing document ,this will have the same content as the original opportunity document

this way u need not do the copy control

also you can create the opportunity as follow up to lead

best regards

ashish

Former Member
0 Kudos

Hello Ashish.

Sorry, but I know to customize follow up document you need the same routines used in copy control. How can I obtain the same contents ?

Thank you.

Elena

ashish_nagpal
Active Contributor
0 Kudos

hi

yes you need the same contents as you are having in original documents but its not mandatory that you use copy control for that,well right if you are doing that way

i would like to advise now that use action which will create an automatic followup transaction as soon as action is triggered

do one thing that create an action profile and use there processing type as method call

and there you specify parameter as copy_document

and also create a container there process_type in which you have to give the initial value as the follow up transaction which you want like for opportunity give the transaction type as initial value

after you are done with your action profile attach it to your opportunity transaction

and then while creating transaction trigger the action it will create a follow up opportunity with the same contenats as in the original document

hope it solves your purpose

best regards

ashish

SandeepJha
Product and Topic Expert
Product and Topic Expert
0 Kudos

Please implement DOC_FLOW method

Former Member
0 Kudos

Hi !

Thank you. I found method DOC_FLOW, but, unfortunately, I cannot obtain it is executed. If I put a break-point instruction, it is not available in debug mode.

Please, could you help me ?

Thank you.

Elena