No history yet

ABAP SOAP Provider

Creating a SOAP Service Provider

When you integrate with external systems in Python, you might reach for a library like Zeep to consume a SOAP service. In the SAP world, you often start by creating the service itself. We'll build a SOAP-based service provider from the inside out, starting with a piece of ABAP logic and exposing it to the world.

The foundation of many SAP web services is the Function Module. Think of a Function Module as a reusable procedure or function within the ABAP environment. To expose it externally, however, it needs a special property: it must be RFC-enabled . This flag marks the function as available for remote calls, making it the perfect candidate to become a web service endpoint.

FUNCTION Z_GET_CUSTOMER_DETAILS.
"----------------------------------------------------------------------
"*"Local Interface:
"  IMPORTING
"     VALUE(CUSTOMER_ID) TYPE  KUNNR
"  EXPORTING
"     VALUE(CUSTOMER_NAME) TYPE NAME1_GP
"     VALUE(CUSTOMER_CITY) TYPE ORT01_GP
"----------------------------------------------------------------------

  SELECT SINGLE name1, ort01
    FROM kna1
    INTO (CUSTOMER_NAME, CUSTOMER_CITY)
    WHERE kunnr = CUSTOMER_ID.

ENDFUNCTION.

This simple function takes a customer ID and returns their name and city. Because it's marked as RFC-enabled, SAP's internal framework knows it can be called from outside the system.

From Function to Web Service

Once you have an RFC-enabled Function Module, turning it into a SOAP web service is straightforward. SAP provides a wizard-driven process directly within the ABAP Workbench (Transaction Code SE80). You simply locate your Function Module, right-click, and select "Create Web Service."

Lesson image

The wizard guides you through a few configuration steps, such as naming the service and choosing a security profile. At the end of the process, SAP automatically generates all the necessary objects, including the service definition and the crucial WSDL file. This method is known as the inside-out development approach.

The inside-out approach starts with existing business logic (the ABAP function) and exposes it as a service. It's fast and ideal for exposing internal functions.

The alternative is the outside-in approach. In this scenario, you start with an external contract, a pre-existing WSDL file provided by a partner or a standards body. You would import this WSDL into SAP, and the system would generate placeholder ABAP classes and data structures. Your job would then be to fill in the business logic to fulfill the contract defined by the WSDL.

Understanding the WSDL

Whether generated or imported, the file is the universal language of SOAP web services. It's an XML document that acts as a formal contract. It defines exactly what operations the service offers, what data structures it expects as input, and what it will return as output. When the Web Service Creation Wizard finishes, it provides you with a URL where this WSDL can be accessed by consuming applications.

A key part of the WSDL generation process is mapping SAP's proprietary ABAP data types to the standardized XML Schema Definition (XSD) types. This translation is what allows non-SAP systems to understand the data structure.

ABAP Data TypeXSD EquivalentDescription
C (Char)xsd:stringFixed-length character string.
STRINGxsd:stringVariable-length character string.
I (Integer)xsd:int4-byte integer.
P (Packed)xsd:decimalPacked number for decimal calculations.
D (Date)xsd:dateDate field, format YYYYMMDD.
T (Time)xsd:timeTime field, format HHMMSS.

This mapping extends to complex types as well. An ABAP STRUCTURE becomes a complex XML element with multiple child elements, and an ABAP INTERNAL TABLE becomes a sequence of repeating complex elements. The wizard handles all this complexity automatically.

Now, let's test your understanding of these core concepts.

Quiz Questions 1/5

What property must an ABAP Function Module have to be exposed as a SOAP web service?

Quiz Questions 2/5

An integration partner provides you with a WSDL file and asks you to implement a service in SAP that conforms to it. What is this development approach called?

By following the inside-out approach, you can quickly expose powerful ABAP logic as a standardized SOAP service, ready for integration.