SOAP WebService From ABAP FM

Alex Gordienko
Nov 27, 2020 · 5 min read

SAP ABAP is a high-level programming language created by the German software company SAP SE. ABAP is widely used for programming in a variety of systems based on SAP NetWeaver Application Server including SAP Business Warehouse (BW). SAP BW is software for corporate data warehouses (DWH), it is one of the most popular solutions across Europe.

SAP Business Warehouse Logo

A significant part of SAP BW supports daily work time is usually spend in planning, starting, and analyzing process chains. Process chains are used for organizing data manipulation processes like extraction, transformation, and loading (ETL). It is very important to monitor process chain execution continuously because many business decisions depend on the reports from data warehouses.

In this article, I will describe the process of creation and deployment of SOAP web services based on ABAP function modules (FM) running inside the SAP BW instance. Next time, I will show how to consume information from your SOAP web service and show it in the frontend. You could use this approach to monitor process chain execution from anywhere. It could help to prevent wrong management decisions and incorrect data analysis by proactive monitoring of failures in ETL processes within the BW system.

Firstly, you should create FM which will work as a backend for the SOAP web service. It is possible to create FM from Eclipse (with ADT add-on) or through the SAP Logon using T-Code SE80. We will use important process chains from a new table. Let’s create it with the name ZBW_CHAIN and insert a new row into it with process chain ZCHAIN_TEST. (For my own future needs, I added the second column REF_CHAIN which we do not need for this article.)

Important process chains in ZBW_CHAIN table

We want to monitor the status, date, and time of the last process chain runs. This information could be gathered from the SAP BW system table RSPCLOGCHAIN. You can use SQL INNER JOIN to select log data from that table filtered only by important process chains stored in ZBW_CHAIN. FM will receive one of the two allowed commands from the network (/start or /status) and return a message with information about each command execution. This is an example of ABAP code for FM (please, do not forget to change the type of your new FM to RFC-enabled in preferences):

You could use T-Code SE37 for testing new FM in your BW-system. If it works without any errors, then probably you did all mentioned above correctly.

Secondly, you should create a web service via standard SAP NetWeaver functionality. While in SE37, go to the menu Utilities, choose More Utilities-> Create Web Service-> From the Functional Module:

Menu item for web service creation

Choose any name for a new web service, i.e. ZSDI_CHAINS, and enter the name of the recently created functional module (ZSDI_GETSTATUS_RFC):

Creation of web service for functional module

It is the right time for choosing an endpoint for your brand-new web service. Without an endpoint, web service is not reachable from the network. Use T-Code SOAMANAGER, choose Web Service Configuration:

T-Code SOAMANAGER view

Find your web service by name in the opened window and click its name in the Search Result list:

Searching service by name

On the Configurations tab push the Create Service button and follow the instructions. You will be asked for authorization type for the new endpoint, I chose Basic authorization by user and password (you must have an account with efficient permissions for RFC-calls in your SAP BW system for using this option):

Creation of new endpoint

After the creation of a new endpoint (which was named processChains in my case) you should see something like this:

List of endpoints for web service

Now your SOAP-service is online and available for requests from the network. For testing it, you could use software like SoapUI. To add a new SOAP-service as a project in SoapUI, you need to get a WSDL-file. Circled icon from earlier image brings you to service description where the link to WSDL-file could be found. Copy it from “WSDL URL for Binding”. If it’s empty, use buttons located there to generate a new one:

WSDL Generation for web service

Now use the SOAP button in SoapUI for the creation of a new project. Paste the link to WSDL-file into the Initial WSDL field and press OK:

WSDL-files provides information about all methods that SOAP-service has, and helps identify all input and output parameters for them. You could see processChain method on the left which you created before in the SAP system. Click twice on Request 1 (1) and add user/password with Basic authorization type (3) on the Auth tab (2) at the bottom of this window:

Now try to call web service by pressing the green button (or press Alt+Enter on the keyboard). You will see an answer from ABAP FM. Try one of the allowed commands (/start or /status) between <I_COMMAND> and </I_COMMAND> tags in the request.

Web service based on ABAP FM is now alive and providing information about process chain execution from within the SAP BW system!

SOAP request and response in SoapUI

CodeX

Everything connected with Tech & Code. Follow to join our 500K+ monthly readers