Skip to Content
0
Former Member
Jan 27, 2011 at 10:18 AM

Attach Inbound Mail to CRM Service Order

174 Views

Hi Guys,

I create CRM Service Tickets from inbound mails via inbound processing on a CRM 5.0 System.

I want now to create a link between the inbound mail and the created ticket via doc_flow. I have heard that this should be possible.

I am using following code untill now:

 
 DATA:
ls_doc_flow TYPE crmt_doc_flow_wrk,
it_guid             TYPE crmt_object_guid_tab,
ls_doc_link TYPE crmt_doc_flow_extd.
 
ls_doc_flow-ref_guid = '4D3854CE43600EB0E1008000AC141439'. "GUID of Service-Ticket
ls_doc_flow-objkey_a = '4D3854CE43600EB0E1008000AC141439'.
ls_doc_flow-objtype_a = 'BUS2000116'. "eg. BUS2000116
ls_doc_flow-vona_kind = 'A'.
ls_doc_flow-objkey_b = '4D397B1E10EE0DB0E1008000AC141439'. "ObjektKey of eMail GUID
 
ls_doc_flow-objtype_b = 'CRM_MAIL'. "ObjektTyp of eMail(SOFM)
ls_doc_flow-brel_kind = 'A'.
ls_doc_flow-reltype = 'INTO'.
ls_doc_flow-related_guid = '4D3854CE43600EB0E1008000AC141439'.
 
insert ls_doc_flow-ref_guid INTO TABLE it_guid.
 
MOVE-CORRESPONDING ls_doc_flow TO ls_doc_link.
CALL FUNCTION 'CRM_DOC_FLOW_GET_RELATIONID_OB'
EXPORTING
is_doc_link = ls_doc_link
IMPORTING
ev_relationid = ls_doc_flow-relationid.
 
CALL FUNCTION 'CRM_DOC_FLOW_PUT_OB'
EXPORTING
is_doc_flow_wrk = ls_doc_flow
EXCEPTIONS
error_occurred = 1
OTHERS = 2.
IF sy-subrc = 0.
CALL FUNCTION 'CRM_DOC_FLOW_SAVE_OB'
EXPORTING
iv_header = ls_doc_flow-ref_guid
EXCEPTIONS
error_occurred = 1
OTHERS = 2.
ENDIF.
 

This code creates a link within the CRM Service Order but it's not linked to the mail. So I don't get to the mail if I double click on it.

I have also tried several objtypes like 'CRM_MAIL', all had the same behavoir.

Am I missing some customizing needed for object relations? Or have done something wrong in the coding?

Thanks and best regards

Abousi