Skip to Content

Adding image into survey Web UI

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.

Function Module CRM_SVY_EXAMPLE_DYNAMIC_PBO has code example for this.

And also contains some other code examples.

Hope it will help…


Harish Kumar

You must be Logged on to comment or reply to a post.
  • Thanks Harish for Quick reply..

    I write the below code in my ZPBO Method exactly what in that FM.....

    But it is not coming.... Should we do anything extra in that ?

       Set the link to the picture
      CONSTANTS: lc_link_to_picture TYPE string
                                    VALUE ''.

      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.
    * </Create and insert JavaScript>

    * <Assign script to event onLoad in the BODY-tag>
      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.
    * </Assign script to event onLoad in the BODY-tag>

  • Thanx once again Harish, I will check and let u know.

    Another issue also I am facing. Do u face any issuelike this before.

    I am getting an error that

    Survey Was not Found or Is not Within the Validity Period.

    Why I am getting this error. =>

    I have added one save button whose Function Code is SAVE. Rather tha SUBMIT AND RESET as of standard

    When I test in GUI it is working fine.

    But when I create the URL and test it at that time

    whenever I am pressing save or pressing enter in that Survey URL, I am getting this error.

    Should I have to write any code for Function Code "SAVE".

    Where to write? How to solve this error?

  • Hi Harish,

    Thanks a lot for your blog. This was really helpful.

    Also, I am trying to modify the existing survey template so that it includes an option to browse and upload an image instead of enhancing the FM for each survey seperately. This would then be a more generalized option which will allow to upload different image in different surveys as per the requirement.

    Any help would be appreciated.



  • Dear,

    Adding the image works, however it only seems to work in Internet Exporer...

    In Chrome, Firefox, ..., the image is not displayed.

    Is there anything that can be done about that?

    Kind regards,


    Update: We found the cause, it was because we were trying out things in the code around the "allign - center" part. When removing the "center", IE still accepts this, but other browsers not.