Skip to Content
Author's profile photo Kumar Prashant

Using RFC as WebService in WebDynpro


Since WebAS 6.20, SAP started to make business functions available through standard based Web Services Technology.

Many SAP business processes and data can be accessed through RFC-enabled function modules. BAPIs are implemented as RFC-enabled function modules and provide standardized programming interface. All SAP provided RFC-enabled function modules (so all the BAPIs) are exposed as web services by default.This feature is available since WebAS 6.20. I will be discussing how to access and use these SAP provided Webservices in WebDynpro application as well as how to expose our own Function module as WebService and use them in WebDynpro applications, I am assuming that the reader has worked with WebDynpro and is familiar with working with models.
Please Go through the WebDynpro Tutorials provided on SDN

WebDynpro Tutorials



Steps to Expose your Remote Enabled Function module as WebService


Use transaction SE37 to open your function module.Go to Attributes tab page and confirm that the remote enabled radio button is selected.


Go to Utilities –> More Utilities –> Create WebService –> From the Function Module


A Wizard opens


WebDynpro Tutorials

1.Download the WSDL file locally or refer to the URL for the WSDL file in model creation wizard.

2.When you are using Userid/Passwd for authentication you need to pass the UserId/ Passwd with the model object before executing it.

Here I have provided the sample code:

public void executeRequest_ZemailKp_zPrashantRfc( )
IWDMessageManager manager = wdComponentAPI.getMessageManager();
wdContext.currentRequest_ZemailKp_zPrashantRfcElement().modelObject()._setUser(“User Name”);
} catch(Exception ce) {
manager.reportException(ce.getMessage(), false);


While you are Using a WebService with a very complex interface (Most of the standard SAP provided WebServices are) you might get SOAP Exceptions. This may be due to the fact that you are initailizing and passing values for only few Input parameters, as you may need only few. The rest of the Input Parameters are not initialized, This may create problems sometimes and you will get

SOAP Marshalling Exception or Improper Message Structure Exception

In that case you need to observe your request response values using some utility applications and identify the parametrs for which the problem is occuring. After that either initialize those input parameters or remove those Input parameters from the WSDL file by editing the WSDL file. Although Editing the WSDL file manually is not a good idea as you may require those parameters at a later stage.

If you are getting the

Authentication Exception

, check the userid/passwd you are providing or, the validity of client certificate.

Please provide your valuable comments, feedbacks, suggestions.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Thomas Jung
      Thomas Jung
      I feel that there are serious problems with this weblog:

      First you start off showing how web services are exposed in 6.20 via the WebServiceBrowser, but you never mention that this technique is limited to just 6.20 and should NOT be used beyond 6.20.  There are several problems with the approach used in 6.20 not the least of which is the fact that all webservices come out of one web endpoint making security very difficult.  The other problem is that ALL RFCs are automatically exposed.

      Then you go into the process used to expose a function module as a web service in 6.40 and higher - but you never mentions that you have switched to a different release.  Nor do you show the Web Service Browser that should be used for this release and higher.  You talk a lot about 6.20, but most of these steps can't be done on that release. 

      The steps to create a web service already have been written about in other Weblogs and in the offical documentation anyway so there is nothing new here - in fact it isn't done here as well as in other places.

      Finally you don't even show the full steps to call the web service from Java Web Dynpro. You talk about the model creation wizard, but you have no screen shots or instructions around that.  You has a small code snippet, but this isn't the entire process. 

      I also wonder why in the world you would call an ABAP RFC from Web Dynpro Java via a direct Web Service when you have Adaptive RFC.  I can see the added value if this was an Enterprise Service, but technically it just doesn't make much sense to trade RFC for basic Web Service.  Of course you always do have Web Service functionality to call out to other languages, but that really doesn't have anything to do with the rest of your weblog. 

      The argument that you don't have to maintain a Jco destination, just seems wrong. Adaptive RFC destinations are helpful for maintaining access and connections to different systems as you move an application through a landscape not a hinderance.  In fact in 04S SP8 SAP introduces Adaptive Web Services that use a similar mechanism.  So it seems the message here is opposite of the direction that SAP is headed. 

      Author's profile photo Kumar Prashant
      Kumar Prashant
      Blog Post Author
      Hi Thomas,
      First of all thanks for your valuable comments.
      All the screen shots provided here are taken on WAS 6.40 only, I just wanted to emphasize that the Web Service Browser facility is available since 6.20. I will put a note regarding that in the blog soon.
      The steps for creating a WebDynpro Application by using the WebService is very well explained in WebDynpro tutorials available at SDN, I will certainly put a link to that.I just gave the code snippet of the step where it differs from the standard way of calling the WebService.
      I fully agree with you that Adaptive RFC is a better way to call RFC's rather than using them as WebService. Here I would like to mention that The Adaptive RFC way is available only to WebDynpro applications whereas the Web Services can be accesed through various platforms, and further I dont see any harm in knowing more than one way of calling the RFC.I used WebDynpro to call the WebService just to make it easier to understand and hide the unneccesary details which would not have been possible if I would have used Java or C.
      Looking forward for suggestions and comments.


      Author's profile photo Kumar Prashant
      Kumar Prashant
      Blog Post Author
      Hi Thomas,
      I have updated the Weblog and made necessary changes.
      Thanks once again.


      Author's profile photo Olaf Reiß
      Olaf Reiß
      Dear Thomas,

      you have been talking about a new webbrowser, which should be used in releases beyond 6.20.

      What kind of webservice browser are you refering to?

      Thanks for the hint.

      Best Regards,

      Olaf Reiss

      Author's profile photo Former Member
      Former Member
      Hi Prashant,

      Thanks for the weblog, it wil be of great help if you could mention how to expose RFCs as web services in 6.2 and also once exposed how to send a SOAP request and receive the same.(If you are aware of links discussing that topic please mention the same)

      Author's profile photo Angelo Antonello Borges
      Angelo Antonello Borges
      Hi, i have a similar problem... i need to consume a RFC as WebService, but with High Auth (using SSO). Have you any tutorial ou sugestion? Or plans to generate a "Part 2" for this post with another samples?

      I thank you for any help!

      Author's profile photo Former Member
      Former Member
      I am following the steps mentioned here, but getting Access Refused. What privilege do I need to create Web Service from RFC? I already can run wsconfig (obsolete), wsadmin (obsolete) and soamanager t-codes.