21
CRM Marketing and Campaigns How to create a campaign from start to finish: 1. Each campaign runs off a dataset, the dataset can consist of data from: a. The CRM system b. A different ECC system c. Or BW (and some other external systems) 2. The current method of getting data into campaigns is using infosets. (SQ02) a. There are several ways of creating infoset: i. Table Joins – Easy to implement, but difficult to maintain for complex queries ii. Data Reading Program – Takes a bit longer to create, but extremely dynamic (Code is in ABAP) 3. The Infoset is created on the system you wish to retrieve data from and is called via marketing architecture to retrieve the data from that system. 4. Once the infoset is complete, it needs to be connected to the CRM system. 5. This is done on CRM TCODE – CRMD_MKTDS. a. This transaction has several functions: i. Creating of dataset – Creates a connection to other systems via RFC and specifying infoset stored on that system ii. Creating an attribute list for that dataset – Attribute lists of a list of fields that you easily configure (based off infoset fields) – to be input/output or both. Names of fields for display can be changed and single/multiple value property can be set. Attribute list is what the user sees when creating segmentation for campaigns. 6. Once all this is completed – The campaign can be tested from crm via TCODE – WUI. This will open the Web UI for CRM. Choose the role as MSK/M24/Newspapers/Associate Campaign Admin. What is campaign, segment, target group and channels. Campaign is automated mechanism (container) for executing segments.

CRM Marketing and Campaigns

Embed Size (px)

DESCRIPTION

CRM Marketing and Campaigns

Citation preview

Page 1: CRM Marketing and Campaigns

CRM Marketing and Campaigns

How to create a campaign from start to finish:

1. Each campaign runs off a dataset, the dataset can consist of data from:a. The CRM systemb. A different ECC systemc. Or BW (and some other external systems)

2. The current method of getting data into campaigns is using infosets. (SQ02)a. There are several ways of creating infoset:

i. Table Joins – Easy to implement, but difficult to maintain for complex queries

ii. Data Reading Program – Takes a bit longer to create, but extremely dynamic (Code is in ABAP)

3. The Infoset is created on the system you wish to retrieve data from and is called via marketing architecture to retrieve the data from that system.

4. Once the infoset is complete, it needs to be connected to the CRM system.5. This is done on CRM TCODE – CRMD_MKTDS.

a. This transaction has several functions:i. Creating of dataset – Creates a connection to other systems via RFC and

specifying infoset stored on that systemii. Creating an attribute list for that dataset – Attribute lists of a list of fields

that you easily configure (based off infoset fields) – to be input/output or both. Names of fields for display can be changed and single/multiple value property can be set. Attribute list is what the user sees when creating segmentation for campaigns.

6. Once all this is completed – The campaign can be tested from crm via TCODE – WUI. This will open the Web UI for CRM. Choose the role as MSK/M24/Newspapers/Associate Campaign Admin.

What is campaign, segment, target group and channels.

Campaign is automated mechanism (container) for executing segments.

Segments contains attribute restriction based on scenario. Segment results are stored in target groups.

Target groups are BP’s. The result set of campaign is always BP driven.

Channels is for example – SMS, email , call list. Basically the mechanism that will utilize the result set.

What happens when I execute a campaign?

1. On CRM when executing a campaign, the CRM architecture calls several standard functions (which can be debugged).

Page 2: CRM Marketing and Campaigns

2. The first thing that happens, is a check on system to see destination of call (via Infoset, BW, etc)

3. In our case, the infoset definition is read from ECC, a query is auto generated for this infoset (based on input fields selected on campaign), and it is called via RFC.

4. Infoset code is called, data is sent as result.5. To test, simply click COUNT on Segment. No need to create all components on CRM for

campaign while still developing.

Page 3: CRM Marketing and Campaigns

Debugging

Below I attached 2 screen shots showing where debugging should take place.

Use external break-points. These break-points will kick from CRM WEB UI.

1. Showing first function module CRM architecture is calling:

2. Showing the call via RFC to external system

Page 4: CRM Marketing and Campaigns

A real life example: Creating the Credit Card Expiry Campaign for MSK

ECC System:

TCODE – SQ02 (Infosets) Infosets are done in Global Area under ZCRM in Role/Group Assignment

As you noticed this is a Data- Reading Program (Meaning most of the work is done using ABAP)

Fields groups: If the field does not exist on the field group (Right side box) – It will not available for use in field attributes on the CRM side.

Page 5: CRM Marketing and Campaigns

Click Code (or SHIT + F8) and goto data reading program tab

Below is copy out code with explanations written in orange

report  rsaqdvp_template .**---------------------------------------------------------------------**   declarations*   (insert your declarations in this section)*---------------------------------------------------------------------*

Comes standard:{data:  zcrm_seg_msk_ccexpire_struct   type zcrm_seg_msk_ccexpire_struct  ,  it_data type standard table of zcrm_seg_msk_ccexpire_struct  .

}

Can be added as your standard: Will always be required {data: lt_selections     type standard table of rsparams,      ls_selections     type rsparams,      lt_fieldinfo      type table of rsel_info,      ls_fieldinfo      type rsel_info,      lv_repid          type syrepid,

Page 6: CRM Marketing and Campaigns

      lv_name           type rsscr_name,      lv_yday           type sy-datum,      lv_sy-uzeit       type sy-uzeit.

}

Custom data definition:

Lt_period is a field we going to populate based off selections inputted into infoset{

data:lt_period   type zcrmt_seg_period.

data:ls_period   type zcrm_seg_period.}

Comes standard:{

field-symbols: <struc> type zcrm_seg_msk_ccexpire_struct  .

}

*-------------------------------------------------------------------**   selection screen statements*-------------------------------------------------------------------**   (define your selection-screen here)* !! the following comment MUST NOT BE CHANGED !!*<QUERY_HEAD>*-------------------------------------------------------------------**   read data into IT_DATA*-------------------------------------------------------------------**  (select your data here into internal table IT_DATA)

Add as your standard – Used to get values from selection variables:{lv_repid = sy-repid.*** read selections of querycall function 'RS_REFRESH_FROM_SELECTOPTIONS'  exporting    curr_report     = lv_repid  tables    selection_table = lt_selections.*** get fieldinfos for selectionscall function 'RS_REPORTSELECTIONS_INFO'  exporting    report     = lv_repid  tables    field_info = lt_fieldinfo.

}

Page 7: CRM Marketing and Campaigns

Used to move values from selection screen tables to internal variable we created for use in function module below this for selecting data:{

call method zcl_crm_mkt_msk_attribs=>seg_cc_expire  exporting    it_selections = lt_selections    " ABAP: General Structure for PARAMETERS and SELECT-OPTIONS    it_fieldinfo  = lt_fieldinfo    " Transfer structure, info about report selections  importing    lt_period     = lt_period.

}

Does the selections using the variable we just populated:{call function 'ZCRM_SEG_MSK_CCARD_EXPIRE'  exporting    it_period = lt_period  tables    et_data   = it_data.}*------------------------------------------------------------**   output of the data*   (this section can be left unchanged)*------------------------------------------------------------*

Comes standard:{loop at it_data assigning <struc>.  move-corresponding <struc> to zcrm_seg_msk_ccexpire_struct  .* !! the following comment MUST NOT BE CHANGED !!*<QUERY_BODY>

Becareful {On generation – all selection values are checked here by SAP – Autogenerated. So, the field in structure being checked should have the value it is expecting}endloop.

}

Class ZCL_CRM_MKT_MSK_ATTRIBS

method SEG_CC_EXPIRE.  data: ls_fieldinfo  type rsel_info,          ls_selections type rsparams.

  data: ls_period type  zcrm_seg_period.

  read table it_fieldinfo into ls_fieldinfo with key dbfield = 'ZCRM_SEG_MSK_CCEXPIRE_STRUCT-PERIOD'.  if sy-subrc = 0.    read table it_selections into ls_selections with key selname = ls_fieldinfo-name.    if ls_selections-low is not initial.      ls_period-sign = ls_selections-sign.

Page 8: CRM Marketing and Campaigns

      ls_period-option = ls_selections-option.      ls_period-low = ls_selections-low.      ls_period-high = ls_selections-high.      append ls_period to lt_period.    endif.  endif.

endmethod.

Function Module Code - ZCRM_SEG_MSK_CCARD_EXPIRE

 data: begin of lt_data occurs 0,          partner type bu_partner,          addrnumber type adrc-addrnumber,        end of lt_data.  data: ls_period type  zcrm_seg_period,        lv_date type sydatum.

  if not it_period[] is initial.    read table it_period into ls_period index 1.    if sy-subrc = 0.      case ls_period-low.        when '1M'.          lv_date = sy-datum + 30.        when '2M'.          lv_date = sy-datum + 60.        when '1W'.          lv_date = sy-datum + 7.      endcase.    endif.  endif.

*  select to get data - create a new internal table to cater for address  select t6~kunnr as partner  "t7~partner    into corresponding fields of table lt_data    from veda as t1      inner join fpla as t2        on t2~vbeln = t1~vbeln      inner join fpltc as t3        on t3~fplnr = t2~fplnr      inner join but0cc as t4        on t4~ccnum = t3~ccnum      inner join ccard as t5        on t5~ccins = t4~ccins and           t5~ccnum = t4~ccnum      inner join vbpa as t6        on t6~vbeln = t1~vbeln*      inner join but000 as t7*        on t7~partner = t6~kunnr*      inner join adrc as t8*        on t8~addrnumber = t6~adrnr

Page 9: CRM Marketing and Campaigns

    where t5~datbi >= sy-datum and          t5~datbi <= lv_date and          t1~VBEGDAT <= sy-datum and          t1~VENDDAT >= sy-datum.

  sort lt_data.  delete adjacent duplicates from lt_data comparing all fields.  delete lt_data  where partner is INITIAL.  loop at lt_data.*    Get telephone data - Why?

*    Append data to result table    et_data-partner = lt_data-partner.    et_data-period = ls_period-low.    append et_data.  endloop.

CRM System:

TCODE – CRMD_MKTDS (Maintain datasources and attribute lists)

Datasets:

Page 10: CRM Marketing and Campaigns

The RFC used is set as well and infoset name on the external system.

You will need to say which field return either the BP or BP GUID.

Save and its complete.

Attribute Lists:

When creating a new attribute list:

Page 11: CRM Marketing and Campaigns

You assign the datasource you created easlier, and click update attributes whenever you change fields on field groups on infoset in ECC.

Whichever field is selected – means it can be used in the Campaign creation screen.

Page 12: CRM Marketing and Campaigns

Used to set description and attribute values allowing it to be single selection or multiple.

Creating a filter criteria – It allows a user using the campaign to use defaults values that can be pre-defined here.

Page 13: CRM Marketing and Campaigns

Important – During Creation of infoset on ECC – if an attribute will require a search help (in this case 1M, 2M, 1W – as values for using period in this campaign) – it must be defined against the domain on the field used in infoset on ECC.

Click save – and everything is ready. Now to just test this campaign.

Some CRM Web UI Screens:

Choosing the Role:

Finding a segment/campaign:

Click marketing and then search:

Page 14: CRM Marketing and Campaigns

Generally, the most developers would do is create the segment. This allows us to test.

Lets find a segment recently created

Page 15: CRM Marketing and Campaigns

This is the modeller: Used by users to add criteria for segments. (Selections)

If wanting to create the segment, first select attribute list:

Page 16: CRM Marketing and Campaigns

Lets view the current selections:

Left Click on segment and select EDIT

Page 17: CRM Marketing and Campaigns

Filters can be added and removed as user like:

To test this segment, select count – This will execute infoset.

If count is greater than zero – It means it returned a results.

Page 18: CRM Marketing and Campaigns

Count refers to number of BP’s returned. Count in this case is 1.

This is a view of the infoset I debugged:

FUNCTION /1BCDWB/IQG000000003513EXTR.*"--------------------------------------------------------------------*"*"Local Interface:*"  TABLES*"      %SELOPT STRUCTURE  RSPARAMS*"      %DTAB STRUCTURE  /1BCDWB/IQG000000003513*"  CHANGING*"     VALUE(%RTMODE) TYPE  AQLIMODE*"  EXCEPTIONS*"      NO_DATA*"      NO_AUTHORIZATION*"      ILLEGAL_PACKAGE*"      CURSOR_NOT_OPEN*"--------------------------------------------------------------------

  call function 'RSAQRT_SET_IDENTIFICATION'       exporting iqid        = %iqid                 sscr_report = sy-repid       changing  rtmode      = %rtmode.

  if %rtmode-pack_on = 'X'.    raise illegal_package.  endif.

  if %rtmode-pack_on = space or %rtmode-first_call = 'X'.    call function 'RSAQRT_FILL_SELECTIONS'         tables   selopt = %selopt         changing rtmode = %rtmode.  endif.

Page 19: CRM Marketing and Campaigns

  call function 'RSAQRT_INIT_TEXTHANDLING'       exporting class   = 'CL_TEXT_IDENTIFIER'                 wsid    = 'G'                 infoset = 'ZCRM_SEG_MSK_CC_EXPIRE'.

  if %rtmode-no_authchk = space     and ( %rtmode-pack_on = space or %rtmode-first_call = 'X' ).    refresh %auth_tabs.    call function 'RSAQRT_AUTHORITY_CHECK'         exporting            auth_tabs         = %auth_tabs            auth_clas         = 'CL_QUERY_TAB_ACCESS_AUTHORITY'         changing            rtmode            = %rtmode         exceptions            NO_AUTHORIZATION  = 1.    if sy-subrc = 1.      raise no_authorization.    endif.  endif.*-------------------------------------------------------------------**   read data into IT_DATA*-------------------------------------------------------------------**  (select your data here into internal table IT_DATA)lv_repid = sy-repid.*** read selections of querycall function 'RS_REFRESH_FROM_SELECTOPTIONS'  exporting    curr_report     = lv_repid  tables    selection_table = lt_selections.*** get fieldinfos for selectionscall function 'RS_REPORTSELECTIONS_INFO'  exporting    report     = lv_repid  tables    field_info = lt_fieldinfo.call method zcl_crm_mkt_msk_attribs=>seg_cc_expire  exporting    it_selections = lt_selections    " ABAP: General Structure for PARAMETERS and SELECT-OPTIONS    it_fieldinfo  = lt_fieldinfo    " Transfer structure, info about report selections  importing    lt_period     = lt_period.call function 'ZCRM_SEG_MSK_CCARD_EXPIRE'  exporting    it_period = lt_period  tables    et_data   = it_data.*------------------------------------------------------------**   output of the data*   (this section can be left unchanged)*------------------------------------------------------------*loop at it_data assigning <struc>.  move-corresponding <struc> to zcrm_seg_msk_ccexpire_struct  .* !! the following comment MUST NOT BE CHANGED !!

Page 20: CRM Marketing and Campaigns

      if %rtmode-acc_check <> space.        %rtmode-acc_number = %rtmode-acc_number - 1.        if %rtmode-acc_number < 0.          exit.        endif.      endif.      check SP$00001.      call function 'RSAQRT_TEXTFIELD_REFRESH'.      %dtab-PARTNER = ZCRM_SEG_MSK_CCEXPIRE_STRUCT-PARTNER .      %dtab-PERIOD = ZCRM_SEG_MSK_CCEXPIRE_STRUCT-PERIOD .      append %dtab.endloop.  read table %dtab index 1 transporting no fields.  if sy-subrc ne 0.    raise no_data.  endif.

endfunction.