Oct 01

Turn any SAP remote-enabled function module into a Web Service – Part 2

In my previous blog I showed the steps into turning a simple function module into an Enterprise Service.  Now that we have the service defined in ECC, our next step is to configure it so an external application can call our newly created service.

I will show how to configure and test the Web Service on ECC with Service pack 14 and higher.   Before Service Pack 14, the configuration is completed in ECC, however after SP14 the configuration is completed on the Java Stack.

Now let’s get started.

Execute the following transaction:
Transaction: SOAMANAGER

This will initiate a Web session and prompt you to log into the WebAS.
Once you have logged in, the next step is to locate the Enterprise Service that you created earlier.
To locate your Enterprise Service go to
Business Administrator Tab  –> Web Service Administration

pic1

First we will want to find the Enterprise Service that we created.   In our scenario, we named our test service as “ZTESTWEBSERVICE”.  After you have found your service, you need to display it by pressing the “Apply Selection” button.

This will display the current settings for this service.  Since we have not yet defined the configuration we will want to create a new service.  In the Configuration tab, select “Create Service”.

pic2

Enter a Service Name and a Binding name that you would like.  I usually put a prefix of “SN” and “BN” when defining a Service Name and a Binding name.pic3

Here you will see all of the different type of runtime configuration options that are available.  As you can see you can configure other security and authentication options.  Once you are complete, press “SAVE”.

pic4

Now you are complete.  The Web Service should be up and running ready for an external application to call it.  Our next step is to obtain the wsdl location and execute a test a call to the Web Service from an external application..

Testing the Web Service

Before we can test the service we will first need to get the wsdl locations. With your service displayed,  go to the Overview tab.

Here you will want to click on “Open wsdl document for selected binding”

pic5

This will display the wsdl in another web session.  This is the URL that needs to be given to the external application that is initiating the call.  In our case, we will be using the WS Navigation tool to be doing this call.   Copy this URL.

pic6

Now we have the wsdl location, we will use the WS Navigator to perform the test.
In Overview tab, select the following link:
“Open Web Service navigator for selected binding”

pic7

Here you will enter the wsdl URL that you copied in the previous step.
Then press ‘Next’

pic8

Enter a valid user that will log into ECC when calling the Web Service

pic9

Now press ‘Test’.

pic10

Here is a list of available operations to call  this  Service.   Remember since we built it from just a function module it will only contain one operation.  If we want to build an service with multiple operation we would generate this service from a function group.

pic11

For this simple  example, the service will take any input and bring back a successful response.

pic12

And there you have it.  You know how to turn a function module into a Web Service and test the service with WS Navigator.

About The Author

7 Comments

  1. Avatar
    Kishore Babu
    December 16, 2009 at 5:28 am · Reply

    This is very interesting topic. Thanks to Steve.
    I have one question on the related topic, I need your help in resolving this issue.
    I have developed a webservice in Java and the Exposed WSDL is used by Cosumners to access this webservice. later we decided to move this Webservice from JAVA development to ABAP. The WSDL generated in ABAP is matching with the JAVA though there is no chnage in the input and output parameters.
    In such scenarios, how i do i support the existing consumers? Please suggest me.

  2. Avatar
    mihaela
    June 11, 2010 at 6:41 am · Reply

    Salut Steve! Thanks for this topic! I solved my problem:) Now , I have a problem when I want to test the webservice. The message is SOA management is J2EE host or port not specified; define them under “System Settings” . I don’t know where I can set this, but I solved in another way. I install a tool soapUI and it work fine for testing webservice:)
    Thanks!

  3. […] a two part blog explaining how to turn any ABAP function into a web service.  (Find Part 1 here.  Find Part 2 here.)  But, what happens when you change the function module interface as my friend in the above […]

  4. Avatar
    SiggB
    August 8, 2012 at 2:39 am · Reply

    I created a web service from an ABAP remote-enabled function module in a namespace with a slash (/), e.g. /SBTEST/SB_MyTestWS. The ABAP code also contains elements/objects prefixed with the name space.
    The resulting WSDL shows a replacement of the slash by a combination of underscore+dash (e.g. _-SBTEST-_WSFunct1).
    When I call the web service using SoapUI it would not give back any data.
    WebServices without the / work fine.

  5. Avatar
    Claire
    August 22, 2012 at 11:28 am · Reply

    Thanks for the topic. I want to know how to close web service session programmly?

  6. […] have created web service from function module in sap. How to do it  very well described in http://www.dataxstream.com/2009/10/turn-any-sap-remote-enabled-function-module-into-a-web-service-%E… […]

  7. Avatar
    super mario games
    February 25, 2015 at 1:35 am · Reply

    Thankfulness to my father who informed me about this
    weblog, this webpage is actually amazing.

Leave a reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.