CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Consider a situation where you want texts (sometimes referred to as notes) to be copied into the activity generated as part of campaign execution.

1.       To do this create a new text determination procedure

2.       Add two text types. Here I am assuming the generated activity will have only two text types; Note – which will be used by the end user to take activity notes and Description – which will be used to pull the campaign text into the activity.

3.       Notice the Access Sequence ZCPGDESC maintained on the text type. This currently does not exist and I will show you in the next few steps how to create it and you will subsequently have to come back and add it here.

4.       Create a new access sequence ZCPGDESC - Campaign Description as indicated in the screenshots below

5.       Let us now look at the main part which is the code for the function module Z_CRM_REFERENCE_TEXT_GET  in the second screenshot above

FUNCTION z_crm_reference_text_get.

*"----------------------------------------------------------------------

*"*"Local Interface:*" 

IMPORTING

*"     REFERENCE(IV_PROCEDURE) TYPE  COMT_TEXT_DET_PROCEDURE

*"     REFERENCE(IV_OBJECT) TYPE  COMT_TEXT_TEXTOBJECT

*"     REFERENCE(IV_TEXTNAME) TYPE  TDOBNAME

*"     REFERENCE(IV_TEXTID) TYPE  COMT_TEXT_TEXTID

*"     REFERENCE(IT_COMSTRUC_FIELDTAB) TYPE  COMT_TEXT_FIELD_VALUE_TAB

*"       OPTIONAL

*"     REFERENCE(IV_PREDECESSOR) TYPE  TDOBNAME OPTIONAL

*"  EXPORTING

*"     REFERENCE(ES_REFERENCE) TYPE  STXH_KEY

*"----------------------------------------------------------------------

 
DATA: ls_comstruc_fieldtab    TYPE comt_text_field_value_rec,
        ls_ref_text_buffer     
TYPE crmt_ref_text_buffer,
        ls_object              
TYPE comt_text_o_rec,
        lv_found               
TYPE crmt_boolean,
        lv_guid                
TYPE crmt_object_guid32,
        lv_predecessor         
TYPE crmt_object_guid32,
        lt_doc_flow            
TYPE crmt_doc_flow_wrkt,
        ls_doc_flow            
LIKE LINE OF lt_doc_flow,
        lv_guid_1o             
TYPE crmt_object_guid.

 
DATA: lv_ref TYPE REF TO data.
 
FIELD-SYMBOLS: <lv_any> TYPE any,
                 <lv_key_c>
TYPE c,
                 <lv_guid>
TYPE crmt_object_guid32,
                 <lv_component>
TYPE any.
* Get the name of the key structure to decypher the guid from textname
 
CALL FUNCTION 'COM_TEXT_CUST_I_OBJECT_READ'
   
EXPORTING
      iv_object           
= iv_object
   
CHANGING
      es_o                
= ls_object
   
EXCEPTIONS
      textobject_missing  
= 1
      textobject_not_found
= 2
      structure_not_found 
= 3
      other_error         
= 4
     
OTHERS               = 5.
 
CHECK sy-subrc = 0.
* Find the guid in such a way that Unicode Check doesn't complain
 
CREATE DATA lv_ref TYPE (ls_object-keystructure).
 
ASSIGN lv_ref->* TO <lv_key_c> CASTING.
 
ASSIGN lv_ref->* TO <lv_any>.
 
MOVE iv_textname TO <lv_key_c>. " To pass the Unicode Checks
 
ASSIGN COMPONENT 'OBJECT_GUID' OF STRUCTURE <lv_any>
                                
TO <lv_guid>.
 
CHECK sy-subrc = 0.
 
MOVE <lv_guid> TO lv_guid.
 
MOVE iv_predecessor TO <lv_key_c>. " To pass the Unicode Checks
 
ASSIGN COMPONENT 'OBJECT_GUID' OF STRUCTURE <lv_any>
                                
TO <lv_guid>.
 
CHECK sy-subrc = 0.
 
MOVE <lv_guid> TO lv_predecessor.

 
CALL FUNCTION 'BCA_OBJ_RTW_GUID_CONVERT_32_16'
   
EXPORTING
      i_guid32
= lv_guid
   
IMPORTING
      e_guid16
= lv_guid_1o.

 
CHECK lv_guid_1o IS NOT INITIAL.
 
CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
   
EXPORTING
      iv_header_guid 
= lv_guid_1o
   
IMPORTING
      et_doc_flow_wrk
= lt_doc_flow.

 
READ TABLE lt_doc_flow INTO ls_doc_flow INDEX 1.
 
IF sy-subrc EQ 0.
    es_reference
-tdname   = ls_doc_flow-objkey_a.
    es_reference
-tdspras  = sy-langu.
 
ENDIF.
ENDFUNCTION.

6.       Needless to say but now go add the text determination procedure to the transaction type that will be used for the activity generated upon execution of the campaign.

7.       For all of this to work a communication medium and method needs to be defined for campaign execution that uses the activity type in step 6 under SPRO – Customer Relationship Management – Marketing – Marketing Planning and Campaign Management –  Campaign Execution – Define Communication Medium

1.

1 Comment