Header Ads

Creating Web Service in SAP CRM


Creating Web Service in SAP CRM

 Summary This guide is intended to demonstrate how to create webservices in SAP CRM 7.0.this web service could be consumed by external system.Author(s): Rajwin Singh SoodCompany: AccentureCreated on: 30th Mar 2010  
Step by step approach for creating web service in SAP CRM

This document puts forth the methodology for creating web service in SAP CRM.
There are two ways of creating web service SAP:- 
  1. Via Object browser.
  2. Via function module editor (SE37).
    Few important prerequisites in our scenario we'll be creating web service on RFC enabled function module. But web service could also be created on BAPI, Function group and message interface including our case of RFC enables function module.
    For function module to be wrapped with web service it has to be RFC enabled. As far as our scenario is concerned we have a Z function module ZTEST_WEBSERVICE created wherein the complete structure of the function module is shown in the screenshots given below:- 



    Above is the Remote Enabled Module flag which we have set in order to create web service on this function. 






    This function module basically adds two parameters PARAM1 and PARAM2(in import parameter)  and places the result in export parameter PARAM3. Below is the screen shot which shows the execution of the function module. 

    Now we'll cover the first methodology that creating web service on object browser.
1.      user transaction SE80 to open the object browser window and enter in the package name wherein you have saved your function module as shown in the screenshot below:- 

2.      After the function module is opened in the web browser right mouse click on the function module name and then click on the create and then select webservice. As shown in the screen shot below:- 

3.      After clicking on the web service the web service wizard starts as shown below. 
4.      Please provide the service definition name and description and in the end point select function module but it could show multiple options as it has been mentioned previously that web service could be created on BAPI, BAPI, Function group and message interface respectively. 

5.      select continue wherein we would go the next screen of the wizard which asks for the function module name. The flag Mapping Der Name is nothing but the existing labels of function module import and export parameters, if this is set then the existing labels for the endpoint are copied. Only the beginning letters are uppercase letters and underscores are removed. After this press continue to proceed on to next wizard screen. 

6.      the next screen  basically deploys the web service which we are creating. If you don't want to it in the wizard it could be achieved by using the transaction wsconfig. But we would do it over here itself. 

After configuring the webservice we say continue where its asks for the package and transport request and then we just need to click on complete button. Which would complete the creation of web service.   
So over here we have generated the web service using the object browser.
For creating the web service using the second method we just need to open the function module in se37. then go Utilities and in utilities select the web service from the function module. 

After this the same wizard will start which we have described above with all the above steps to be followed.
After successfully creating the web service we could view and that web service by using the transaction wsadmin amd then executing the webservice in web service navigator configured for the CRM system in order to test it.
This web service which we have created is now exposed and available for the external system to consume it.
Powered by Blogger.