Neptune DXP REST API Factory

The need for automation

When you are looking to RESTify SAP objects via the Neptune DXP API connector you are limited to referencing ABAP Classes, BAPIs, or Function Modules. Furthermore, you are expected to define a wrapper ABAP class as the data provider that feeds the generated REST APIs. These tasks can prove to be repetitive and arduous considering the volume of SAP objects in existence as well as bespoke implementations that you may have accumulated over time.

Taking SAP integration to the next level

The introduction of the Neptune DXP API Factory is a step change in your ability to RESTify your SAP artefacts. It automates the Neptune DXP API connector’s generation mechanism for the data provider class, and it significantly expands the scope of SAP objects eligible to be exposed as a REST API, which now includes:

  • ABAP Classes

  • ABAP Business APIs (BAPIs)

  • ABAP List Viewer (ALV) or Report programs

  • ABAP Functions modules (without the need to be RFC enabled)

  • SQL Queries

  • SAP HANA Core Data Service Views (CDS)

  • ABAP Data Dictionary elements, for example, tables, views, data elements, search helps

  • Program Searches

Accelerated API generation

The API Factory takes away the pain of manual configurations and mapping tasks automating them into a comprehensive framework addressing a wide range of SAP objects:

restapi factory

The user’s experience when interacting with the API Factory implements a wizard to facilitate the generation of the REST API. The wizard simplifies the process of implementing the necessary interface mechanism to that wrap the ABAP artefact around an ABAP runtime interface class, which allows the Neptune DXP SAP connector to utilise it to generate the REST API mapping. The use of the wizard acts as an accelerator to shortcut the development time. However, you can configure the API Factory and perform the mapping steps manually for complete flexibility to your use case.

Maximising reusability

ABAP List Viewer (ALV) or Report programs are an excellent source of derivative information that can be subject to data selection, filtering and sorting which SAP has largely embedded these capabilities by default. Upon closer inspection one can see the direct correspondence, at a metadata level, between ALVs and REST APIs:

  • ALV selection parameters can correspond to REST API filter parameters.

  • ALV sorting criteria can correspond to REST API sorting query parameters.

  • The columnar structure of an ALV list can correspond to a REST API body contents schema.

  • ALV list results can correspond to a REST API response body contents.

The Neptune DXP API Factory takes advantage of these similarities and allows you to generate a REST API by simply providing the ALV report name. For example, a generated REST API Operation from an ALV report supports query parameters to allow group, filtering and sorting mimicking the functions provided by the ALV’s selection screen and resulting list. The outcome is an endpoint specific to the ALV report accessible as a REST API including all the metadata that describe the ALV (parameters, body schemas, etc.) and the resulting dataset.

As a result, all existing SAP and bespoke ALVs or ABAP reports can be re-cast as REST APIs. Furthermore, as ALVs can be made editable we could also use them to master data (assuming the ALV insert/update code correctly implements the necessary underlying SAP code, locking and dependencies).

Increased flexibility

APIs are often used to fetch large data sets to the client. Most implementations result in the execution of an SQL query to select data to present in a formatted response. However, to achieve this you must embed the SQL logic inside an SAP function module first before being able to wrap it around a Neptune DXP REST API. The API Factory can automate this process by only requiring the underlying SQL query as the basis for generating an ABAP data provider class. This significantly enhances your options for generating targeted API endpoint serving data for bespoke queries.

Automatic API documentation

An inevitable drawback of the API Factory is that elements of the API still reference SAP object names which tend to have idiosyncratic names not easily recognisable to a non SAP expert. The API Factory mitigates by automatically extracting all associated language-specific documentation, authored for the SAP object at all levels (for example, BAPI, table or field level) and places it in the API specification. To some extent this disambiguates the meaning of SAP object names and whilst it is an imperfect solution the outcome is a REST mechanism accessing an object with full documentation and the ability to test it via Neptune DXP’s Swagger interface.

ABAP microservices

Given the ability to implement a REST APIs in SAP wrapping standard or custom code or SQL queries you now have the option to go beyond wrapping existing SAP objects. You could use the API factory to start implementing ABAP code exposed via an API adopting the principles of a microservice mode of operation. By further abstracting SAP’s business functions an ABAP data provider class can be conceptualised as a compartmentalised service akin to a microservice.