ABAP OpenAPI UI v1 released!
As mentioned in my previous blog post, I worked out a way to get Swagger / OpenAPI documentation for any SAP Netweaver Gateway OData service (both OData V2 and OData V4 services are supported).
So how does it work?
Unfortunately it is not possible to extend the SAP Netweaver Gateway framework using BADI’s / User-exits on a global level to provide this functionality to all OData services at once at this point. (to make it work like for example a $metadata request)
So I created a separate transaction to list all activated OData services and provide the required functionality from within this transaction.
After installing the solution using abapGit the new transaction ZGW_OPENAPI will be available in the system.
This transaction provides following functionality:
- Determine OData version (V2 or V4)
- Filter activated services
- Display Swagger UI or OpenAPI JSON (e.g. for importing in an API management system)
After executing the report a list with services is displayed.
After clicking the service name, the BSP application containing the Swagger UI (or JSON) will be launched.
After that you’ll be able to browse through the documentation and even try out each available call.
Example for a get entityset (with a filter string):
What are the advantages of using this solution?
The main advantages / reasons for using this solution are:
- No more (or at least less) work on documenting OData services
- Interactive documentation which also acts as a testing tool
- More user-friendly that standard testing tools
- Useable by key users with minimal technical skills
- Service definitions (JSON) can be downloaded and imported in for example Azure API Management
Where to get this project?
If you experience any issues or want to contribute to the project please use the GitHub repository. Contributions are much appreciated!
Important notice: at the time of writing this solution was only tested on an S/4HANA 1809 system with embedded gateway (SAP_BASIS 753). Please leave a comment if you were able to get it working on lower levels (ABAP code used should be compatible with at least SAP_BASIS 740 Enhancement Pack 5) or on a SAP Gateway system.
As previously mentioned, the core of this project relies on two great open source projects:
- Swagger UI (for displaying the OpenAPI / Swagger documentation)
- OData-openapi (for converting OData metadata to OpenAPI / Swagger documentation)
- Without this I wouldn’t be able to share this solution
- Took over 95% of the repository rules and guidelines (these are just great by the way! In my opinion every open source ABAP project should apply these!)
- To validate that the development rules and guidelines are respected
Last but not least, I was allowed to use an S/4HANA 1809 development system for this personal project provided by TheValueChain NV (SAP Partner based in Belgium).