Vous êtes sur la page 1sur 6

Survey processing without opening a connection to the CRM Backend from the Internet

In a comment to the Blog Create, run and analyze an E-Mail Campaign with a Survey (Part 1) vijay kothari asked if it is possible to use surveys without providing a connection to the backend system as described in Setup SAP Web Dispatcher with URL Filter on SuSE Linux 9.0. So here is a solution to this problem: Use the mailto function to send the Survey answers via mail to the backend SAP CRM system.

Create Parameter XML for mailto


Start transaction CRM_SURVEY_SUITE and click on the Button "Survey Repository":

Open the Folders Parameter XMLs -> mailto, Mark the default entry "CRM_SVY_PARAM_MAILTO.XML" and press F8 to export it to the local disk.

Adopt the file content and replace the Action with the local E-Mail address, also rename the File to "CRM_SVY_PARAM_MAILTO_CR4.XML":

<?xml version="1.0" encoding="UTF-8"?> <SurveySystemParam Action="mailto:crm.survey@example.com" Method="post" Enctype="application/x-www-form-urlencoded" IncludeStylesheetInOutput="true"/>


Choose the Folder mailto and press F7 to upload the file. Fill the Fields as mentioned here:

That should be the result:

Create the Survey TEST_MAIL


Now you can create a survey as described in the Blog Create, run and analyze an E-Mail Campaign with a Survey (Part 1) or SAP Note 988209 - CA: Direct response scenario. Here I've created first a German version of the Survey with three radio buttons in transaction CRM_SURVEY_SUITE, Appl. Folder Marketing. Then I did the translation to English:

This survey can be downloaded via Extras -> Download Presentation Format:

In the next screen you have to choose mailto as the send option, the Parameter XML uploaded before and Media Type Screen:

This resulted in the download of a TEST_MAIL.html file which I've downloaded to my local files:

Setup Inbound Processing of the Survey Mail


To process the mail which will be created from the just downloaded HTML File the Inbound Mail Processing has to be configured in Transaction SO50 for the E-Mail address crm.survey@example.com (which was used in the Parameter XML) with the Exit Name: CL_SVY_SMTP_INBOUND:

Test Survey
With everything above prepared we can now doubleclick on the TEST_MAIL.html file created above and you will see this content in your Browser:

When you click Save you get a warning that the Form will be sent via E-Mail

And then you again have to confirm that it should be sent with Outlook:

You can verrify that the mail was processed in transaction CRM_SURVEY_SUITE when you choose your survey and click the Button "Evaluation" (Ctrl+Shift+F3):

On the next screen you should see the counter for the evaluated survey to be at least 1:

If you're running a Unicode CRM System you might have to check out SAP Note 1286258 - Unicode issues with IF_INBOUND_EXIT_BCS~PROCESS_INBOUND which solves an encoding issue which prevents incoming E-Mails to be processed on Unicode CRM Systems.

PHP Script to replace mailto action


After this successful test we have to setup a way how the survey can be placed on a public website. You can simply upload the survey to a web server and keep the form action mailto. But that will result in the warning messages we've seen above. So I decided to use my web scripting language of choice PHP to implement a script that will take a GET parameter "SURVEY" to read the survey HTML file with the same name and replace the mailto-action with another PHP Script that will process the POST parameters of the survey and that send out an E-Mail.

Example PHP Script to create mail from form POST parameters


Warning: This PHP Script does not provide any sanitation of the input values. It should be seen for for demonstration purpose only!

<?php

$to = 'crm.survey@crm.example.com';

while (list($key, $val) = each($_POST)) { if($key == 'MIG') { $message .= $key . '=' . $val . '&'; } else { $message .= $key . '=' . urlencode(rtrim($val)) . '&'; } }

$status = mail($to,'Survey',$message);

if($status) { echo "The Survey was sent and will be processed."; } else { echo "There was an error sending the Survey."; }

?>

Vous aimerez peut-être aussi