Skip to Content

This document is for demonstrating how to create an URL based transaction launcher in CRM UI to exchange data between SAP and an external URL in real time.

  • Declare URL and the Parameters [SPRO->Customer Relationship Management->UI Framework->Technical Role Definition->Define URLs and Parameters]

1.JPG

  • Declare URL Parameters. For this we must remember the meaning of import and Export parameters. For example, here, I’m creating 3 parameters: name (Import), xpos (Export) and ypos (Export).

Parameter

Type

Meaning
Import Data to be transferred from SAP CRM UI to external URL
Export Data to be transferred from external URL to SAP CRM UI

2.JPG

3.JPG

4.JPG

  • Now launch the Transaction Launcher wizard.[SPRO->Customer Relationship Management->UI Framework->Technical Role Definition->Configure Transaction launcher]

5.JPG

6.JPG

7.JPG

8.JPG

9.JPG

  • Now assign the transaction launcher in CRM UI as Workcenter link following usual process. I’m not detailing them here.[SPRO->Customer Relationship Management->UI Framework->Technical Role Definition->Define Navigation Bar Profile]
  • The class ZCL_LAUNCH_URL was created by the wizard. We need to make certain changes for data exchange to work.[Transaction:SE24]
    • Save the class under a transport as it gets created under local object by default.
    • Go to redefined CLASS_CONSTRUCTOR method to change the following code, it is required as we want data to flow back to SAP CRM.

10.JPG

    • Go to the redefined method IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW to add the following code. This super class method has the code to add the return URL information. The return URL is the SAP CRM URL which the external webpage will send the information to.

11.JPG

    • Go to redefined method IF_CRM_IC_ACTION_HANDLER~PROCESS_RETURN to add the code to handle return data. For example here I’m giving a message.

12.JPG

  • For demonstration purpose I’ve built a HTML webpage and hosted it using Apache in my local machine. Similarly any webpage can be used to exchange data with SAP CRM. This webpage displays the sent information from SAP i.e Name and has 2 input fields XPos and YPos. When “Go” button is clicked on the webpage the data is sent back to SAP CRM UI and displayed.
    • The source code of the webpage using some JavaScript functions.
<html>
<head>
<title>My Page</title>
<script type="text/javascript">
function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}
function decode(str) {
     return unescape(str.replace(/\+/g, " "));
}
var fullname = getUrlVars()["name"];
var returl    = getUrlVars()["ICRETURNADDRESS"];
var client    = getUrlVars()["ICRETURNCLIENT"];
var comid     = getUrlVars()["COMPONENT_ID"];
var guid      = getUrlVars()["GUID"];
var returl1   = decode(returl);
function submitform(){
this.action=returl1;
}
window.onload = function(){
   document.details.onsubmit=submitform;
}
</script>
</head>
<body>
<form id="name" name="name" >
Name           : <input type="text" name="fullname" readonly="readonly"/><br />   
</form>
<form id="details" name="details" method="post" action="" >
COMPONENT ID   : <input type="text" name="component_id" readonly="readonly"/><br />
Return address : <input type="text" name="value3" readonly="readonly"/><br />
Return Client  : <input type="text" name="client" readonly="readonly"/><br />
GUID           : <input type="text" name="guid" readonly="readonly"/><br />
XPOS           : <input type="text" name="xpos" value="" />
YPOS           : <input type="text" name="ypos" value="" />
<input type="submit" value="go!" />
</form>
<script LANGUAGE="javascript">
document.name.fullname.value        = decode(fullname)
document.details.component_id.value = comid
document.details.value3.value       = returl1
document.details.guid.value         = guid
document.details.client.value       = client
</script>
</body>
</html>

    • Now the Apache has to be running for testing this.

13.JPG

  • Now if we can test our application.

    • Log-in to SAP CRM UI and confirm a Business Partner.

14.JPG

    • Click on “Launch URL” Workcenter link to launch the external URL. You can notice the Fullname of the Business Partner has been transferred to the external webpage.

15.JPG

    • Now enter some data in the input fields XPOS and YPOS and click the “Go” button.

16.JPG

    • It can be seen that data is passed back to in SAP CRM. For demonstration purpose I’m displaying them as message but it can be easily stored in database or it can be used to trigger any business process.

17.JPG

To report this post you need to login first.

12 Comments

You must be Logged on to comment or reply to a post.

  1. Karthi M R

    Sourav,

    Thanks for your detailed document.

    For a BOR based transaction, is there any additional code to be added for the process_return i.e return data flow method to get triggered.

    Thanks.

    (0) 
  2. Benoît Sabys

    Hi Sourav,

    Nice job but I am having trouble trying to make it work.

    I did everything like you did but the method “process_return” of my transaction launcher is never called.

    I am using CRM 7.0 EHP3.

    Do you have an idea ?

    Regards

    (0) 
        1. Reecha Kayal

          Thanks for your reply.

          Yes, I had marked the variable GV_IS_RETURN_DF_REQUESTED as X.

          I can see that the control comes to UICMP_LTX page GenericLTXReturn.htm but then i do not see the code where the handler class gets called within the code for this page.

          Does this code need to be modified or do we need to create a new BSP application and do some custom coding to call the handler class on return?

          Thanks & Regards

          (0) 
            1. Reecha Kayal

              Thanks. I had referred this code as well, but the problem is that the control is not coming back to the handler class sub class of super class (CL_CRM_UI_LTX_ABSTRACT_URL) method PROCESS_RETURN

              (0) 
              1. Benoît Sabys

                Hi Reecha,

                Check the method OnRequest  in your BSP application for return (my ZUICMP_LTX), you need the component id sent by the called URL.

                Regards

                (0) 

Leave a Reply