Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member212653
Active Contributor

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]

  • 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
ImportData to be transferred from SAP CRM UI to external URL
ExportData to be transferred from external URL to SAP CRM UI

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

  • 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.

    • 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.

    • 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.

  • 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.

  • Now if we can test our application.

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

    • 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.

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

    • 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.

12 Comments
Labels in this area