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:-
- Go to transaction CRM_SURVEY_SUITE.
- 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…
Regards,
Nice Blog Harish.
Thanks
Kumar
Thanks Kumar,
Regards,
Harish Kumar
Nice Blog Harish Kumar!!
Thanks Modadugu Hemanth,
Regards,
Harish Kumar
Good One...Thanks for sharing ... 🙂
Thanks Rajesh,
Regards,
Harish Kumar
It's always good to explore standard code and examples. It gives a lot of knowledge. Which may not be applied right now, but definitely will help in the future.
Hi Andrei,
Thanks for your comment..
The code i have used is standard one from standard FM which also contains some more stuff related to Survey.
Regards,
Harish Kumar
good one Harish
Nice blog harish..
Ravi
Thanks Ravi
Regards, Harish Kumar
Harish it is not working for my case...
Should we have to configure anything other than this?
Even I follow the exactly same coding.... (Only code). but image is not coming in my case...
it should work ..
for reference check FM CRM_SVY_EXAMPLE_DYNAMIC_PBO check code from
line 19---78 * Set the link to the picture
Regards Harish Kumar
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 'http://www.sap.com/global/images/sap_logo.gif'.
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", "");'
'nodeDiv.appendChild(nodeImg);'
INTO ls_javascript-script. "#EC NOTEXT
CONCATENATE ls_javascript-script
'document.getElementsByTagName(''body'')[0].insertBefore'
'(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
EXPORTING
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
EXPORTING
it_on_event = lt_svy_on_event.
* </Assign script to event onLoad in the BODY-tag>
try with any other image link..
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,
Did you encountere the above issue ?
I also posted this in separate discussion but didn't get any reply thats why posting here...
No ,, we implement same number of times and used same code above.
Thanks Harish Kumar, it's nice blog... definitely will help in the future. 🙂
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.
Thanks
Srini
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,
Joyca
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.