Skip to Content
Technical Articles

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).

Since this solution is based on two open source projects (Swagger UI and OData-openapi), I wanted to share my solution with the community as well.

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):

Result:

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?

The project can be found here on GitLab (and needs to be installed using abapGit) and is MIT licensed.

If you experience any issues or want to contribute to the project please use the GitLab 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.

Credits

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)

The abapGit and abaplint projects, which I used to setup the Gitlab repository.

abapGit:

  • 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!)

abaplint:

  • 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).

6 Comments
You must be Logged on to comment or reply to a post.
  • Thanks a lot for releasing it! Looking forward to start playing with it! Would be great to be able to get an invite to the slack group. giovanni.degani at gmail

    • Hi Giovanni,

      Let me know how it goes, I hope it works out of the box for your system!

      I sent you an invite, you should be able to access the Slack group.

      Best regards,

      Geert-Jan Klaps

  • Hello Geert-Jan Klaps ,

    First of all let me thank you for your amazing work!!!

    The tool is working fine in my system and I’m sure it will be very useful.

    I’ve already done some changes, mainly in the ALV displayed to also add the package and the Created/Changed information. Don’t know if you agree but if you like it I could try to make a PR.

    Like this, the tool the tool is also useful for some monitoring tasks ūüôā

    I would like to add some suggestions on the behavior also:

    When we launch the service, the system client used is always the client where the tool is running. If we have several clients in the Gateway, I have to manually change the URL by adding sap-client=XXX.

    It would be nice if the tool discovers the correct client by checking the System Alias from the customizing. In the case we have multi-origin, a popup should be launched to ask the user for the client to be executed.

    I will keep adding more ideas if they come up ūüôā

    Amazing job and THANK you for sharing this!!!

    You should be in the TechEd presenting this!!!!!

    Have a great week

    Sérgio Fraga

     

    • Hi S√©rgio,

      Thanks for this great feedback! Your additions seem great, so a PR is welcome for sure!

      Maybe create an issue tagged as new feature, with the new functionality you added and tag the issue in the PR. (so we can track what’s been changed)

      New ideas are always welcome, the ones you mentioned are for sure great! (just put them in an issue in the Gitlab repository so we can start integrating them)

      Best regards,

      Geert-Jan Klaps

  • Hey Geert-Jan,

     

    Thanks a lot for sharing this.

    I had to adjust 3 little things in class ZCL_GW_OPENAPI:

    1. Compile error as on our release  /iwbep/cl_v4_url_util  is not available (commented it out)
    2.  /iwbep/if_v4_request_info=>ty_s_base_info has no attribute  uri_request (commented it out)
    3. we have saml authentication in place so added¬† INSERT¬†VALUE¬†#(¬†name¬†=¬†‘saml2’¬†value¬†=¬†‘disabled’¬†)¬†into¬†table¬†lt_params.¬† in the LAUNCH_BSP to be able to use basic logon.

    This utility was a big help to be able to document my ODATA service !!

    Greetings Danny.