Creating, Configuring and Testing a Web Service
Based on a Function Module
Applies to:
SAP EC6 6.0/7.0. For more information, visit the Web Services homepage.
Summary
The article describes how to create a web service from function module.
Author: Ghaz Khan
Company: Larsen & Toubro Infotech Limited
Created on: 10 September 2015
Table of Contents
Concepts ........................................................................................................................................................
..... 3
Web
Service .................................................................................................................................................... 3
Creating Function
Group .................................................................................................................................... 3
Transaction
SE80 ............................................................................................................................................ 3
Creating Function
module ................................................................................................................................... 5
Transaction
SE37 ............................................................................................................................................ 5
Code ...............................................................................................................................................................
.8
Create Web Service of Function
Module ............................................................................................................ 9
Executing Web Service from Web Service
Navigator ...................................................................................... 14
Transaction SOAMANAGER ........................................................................................................................
14
Summary ........................................................................................................................................................
... 24
Related
Content ................................................................................................................................................ 24
Disclaimer and Liability
Notice .......................................................................................................................... 25 Creating, Configuring
and Testing a Web Service Based on a Function Module
Concepts
Web Service
A Web service is a software system designed to support interoperable machine-to-machine interaction
over a network. Web services are frequently just Web APIs that can be accessed over a network, such as
the Internet, and executed on a remote system hosting the requested services.
Or
Web service can be defined as any service/functionality available over the internet and related transport
protocols which uses a standardized XML messaging system (i.e. SOAP) is not tied to any operating
system or programming language.
Creating Function Group
Transaction SE80
Select the Function Group in the Drop down box on left side plane in the Object Navigator Screen
and then enter the Function Group name to be created in the input box below the drop down box and then
press ENTER and click on Yes button on the pop up window for creating Function Group
You will get pop up asking for entering short text for Function group, provide a meaningful short text and
then SAVE. Creating, Configuring and Testing a Web Service Based on a Function Module SAP COMMUNITY NETWORK
SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 4
While saving it will ask the package under you want to save, you can provide $TMP (for Local Object) or
the any package name as per your requirement. Then click on SAVE.
You will get a message saying Function Group has been created as per below screen shot Creating,
Configuring and Testing a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX [Link] | BOC - [Link] 2009 SAP AG 5
Creating Function module
Transaction SE37
Enter the Function Module name to be created and click on Create
Enter the Function group name and Short text for function module in the pop up window as per below
screen and click on SAVE, then you will get a pop up saying Function module name is reserved for
SAP, click on Continue. Creating, Configuring and Testing a Web Service Based on a Function Module SAP
COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 6
Then it will take you to Function Builder screen as in below screen shot and enter meaningful values
And a very important thing is to make the function module Remote-Enabled Module.
Define the Import parameters for Function module Creating, Configuring and Testing a Web Service Based on a
Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 7
Define the Export parameters for Function module
Define the tables for Function module
One of the important things to be done is commenting and maintaining header information for the
function module which gives information about the function module Creating, Configuring and Testing a Web
Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC [Link] 2009 SAP AG 8
Code
For the example mentioned in document (.i.e. creating a sales order ) you can use this code or else the
code will change as per your requirement Creating, Configuring and Testing a Web Service Based on a Function Module
SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 9
Create Web Service of Function Module
Go to utilities -> More Utilities -> Create Web Service -> From the Function Module
Enter Name and Short text for Service definition and the click on Continue Creating, Configuring and Testing
a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC [Link] 2009 SAP AG 10
Check the Check box for Mapping so that the import and export parameters of Function Module are
mapped with that of the Web Service to be created. Creating, Configuring and Testing a Web Service Based on a
Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 11
Check the Deploment check box for the service to be avaliable in SOAMANAGER for further processing
Creating, Configuring and Testing a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] |
BPX - [Link] | BOC - [Link] 2009 SAP AG 12
Here you can select where you want to save the object , In this case I am saving it as local object- $TMP
Creating, Configuring and Testing a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] |
BPX - [Link] | BOC - [Link] 2009 SAP AG 13
Click on Completed to completed the process of Web Service creation
Then you will a message that web service has been created. Creating, Configuring and Testing a Web Service
Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009
SAP AG 14
Executing Web Service from Web Service Navigator
Transaction SOAMANAGER
Click on the tab Application and Scenario Communication
Creating, Configuring and
Testing a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] |
BOC - [Link] 2009 SAP AG 15
Then click on Single Service Administration you will get the below screen where you can enter the
service definition name in the Search Pattern. In our case the name will be
ZV_ARK_CREATE_SO_NEW
The click on GO.
You will get the service in the search Results column. Select the service and then click on Apply
Selection
You can see as per the below screen shots, the service = 0/ Endpoints = 0 for the web service definition
selected by us Creating, Configuring and Testing a Web Service Based on a Function Module SAP COMMUNITY NETWORK
SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 16
Now click on Configurations tab and then click on Create Service
You will get a pop up asking for service name, description and binding name for it. Enter the values
and click on Apply Settings
Then you return to the below mentioned screen where you need to save Creating, Configuring and Testing a Web
Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC [Link] 2009 SAP AG 17
Then you can see a entry in Configurations tab. The state of service should be Active.
Now click on Overview tab you can see the service =1/ Endpoint=1
If you click on the Open WSDL document for selected binding you can see the WSDL of the Web
service in XML format Creating, Configuring and Testing a Web Service Based on a Function Module SAP COMMUNITY
NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 18
In order to execute the web service through web service navigator click on Open Web Service
navigator for selected binding it will take you to above screen
Then click on Display selected Binding's WSDL URL link to get the WSDL URL. You will get a URL
displayed on the right and side of the screen Creating, Configuring and Testing a Web Service Based on a Function
Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 19
Copy paste the link in the Web service Navigator screen in the input box below Enter the WSDL
URL of the Web service: and click on Next. Creating, Configuring and Testing a Web Service Based on a Function
Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 20
It will take u to login screen you need to use the same login as used for SAP logon
On this screen, Click on Test Creating, Configuring and Testing a Web Service Based on a Function Module SAP
COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 21
The click on the ZvCreateSalesorderEsPoc ([Link] parameters)
Enter the values for creating sales order Creating, Configuring and Testing a Web Service Based on a Function Module
SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 22
After entering the mandatory values for creating sales order, click on Send . Creating, Configuring and Testing
a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC [Link] 2009 SAP AG 23
Then you will a the output in the same format
Creating, Configuring and Testing a Web Service Based on a Function
Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC - [Link] 2009 SAP AG 24
Summary
Web Service can be used in Adobe Flex or any other web-based application to access / communicate
with SAP data. ABAP web services can be created when you have custom requirements. There are also
standard web services provided by SAP which comes as a part of Enhancement Packages. These
standard web service represent standard SAP functionalities like APO ATP check, SO
create/change/delete, PO create/change/delete and many more. When more than one web service
combined to meet new requirements encapsulating enterprise functionality and exposing it as a reusable
business service then that is called as an Enterprise Service .
Related Content
[Link]
[Link]
[Link]
[Link]
65855639End?rid=/webcontent/uuid/f07d8153-7edd-2910-aeac-fb940ff1ff71
[Link]
65855639End?rid=/webcontent/uuid/e044d87c-ebab-2a10-6482-cd4ff5fa4828 Creating, Configuring and Testing
a Web Service Based on a Function Module SAP COMMUNITY NETWORK SDN - [Link] | BPX - [Link] | BOC [Link] 2009 SAP AG 25
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this
document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this
technical article or code sample, including any liability resulting from incompatibility between the content within
this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP
responsible or liable with respect to the content of this document.