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!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

Some time we need company image to be display on survey.

So below given are few steps to add image in survey.

Steps to add  image into survey:-

  1. Go to transaction CRM_SURVEY_SUITE.
  2. Select the required application (Marketing in this case) as :-

3) After selection of required survey from application, click on Maintain Survey Attributes button.

4) After click on this button following window will appear.

5) Now we have to copy the standard function module CRM_MKTCA_SURVEY_MKT_PBO to our Z FM so that we can make required changes into it.

Add following code into this Z (PBO) FM.

CONSTANTS: lc_link_to_picture TYPE string

   DATA: lt_javascript   TYPE survy_t_javascript,
ls_javascript   TYPE survy_s_javascript,
lt_svy_on_event TYPE survy_t_on_event,
ls_svy_on_event TYPE survy_s_on_event.

* <Create and insert JavaScript>
   ls_javascript-name     = 'insertImage'. "#EC NOTEXT
   ls_javascript-language = 'JavaScript1.3'. "#EC NOTEXT
   ls_javascript-script   = 'function insertImage() {'. "#EC NOTEXT
   CONCATENATE ls_javascript-script
  'var nodeDiv = document.createElement(''div'');'
  'nodeDiv.setAttribute("align", "center");'
  'var nodeImg = document.createElement(''img'');'
INTO ls_javascript-script. "#EC NOTEXT

   CONCATENATE ls_javascript-script
  'nodeImg.setAttribute("src", "' lc_link_to_picture '");'
  'nodeImg.setAttribute("alt", "");'
INTO ls_javascript-script. "#EC NOTEXT

   CONCATENATE ls_javascript-script
  '(nodeDiv, document.getElementsByTagName(''body'')[0].firstChild);}'
INTO ls_javascript-script. "#EC NOTEXT

   APPEND ls_javascript TO lt_javascript.

   CALL METHOD ir_survey_values->javascript_add
       it_script = lt_javascript.

  ls_svy_on_event-question_id   = 'html'.                       "#EC NOTEXT
  ls_svy_on_event-answer_id     = 'body'.                       "#EC NOTEXT
  ls_svy_on_event-name          = 'onLoad'.                     "#EC NOTEXT

  CONCATENATE ls_javascript-name '()' INTO ls_svy_on_event-call_function."#EC NOTEXT

  APPEND ls_svy_on_event TO lt_svy_on_event.

  CALL METHOD ir_survey_values->on_event_add
      it_on_event = lt_svy_on_event.

6) Assign your Z FM to Callback PBO as:-

Function Module CRM_SVY_EXAMPLE_DYNAMIC_PBO has code example for this.

And also contains some other code examples.

Hope it will help...



Labels in this area