Skip to Content
Technical Articles
Author's profile photo Geert-Jan Klaps

Generating QR codes using API

Within standard SAP we don’t really have a built-in solution for easily generating QR codes. I got asked this question a lot of times now, so I decided to create a small ABAP API to easily generate a QR code and use it within SAP.

After a looking around for available API’s, I came across the free publicly available service. So I decided to implement this API service in an ABAP class so it could easily be reused in any development requirement.

Currently the ABAP API supports:

  • Setting QR code data
  • Setting QR code image format (e.g. png, svg, jpg, … )
  • Setting QR code size (keeping in mind the limitations described in the API documentation)
  • Https (default) or http connection to API (https might require some setup in STRUST)

The QR Code image is retrieved in binary format and the mime type is available as well.

A sample / demo application is available in the project, which looks like:

Resulting in the following preview:

The API can very easily be installed using abapGit and is available at theย Gitlab repository. The idea is to further extend the ABAP API with additional functions available in the API in the future and to extend the functionality to reading QR codes as well.

But for now, this should lessen the development effort for implementing QR codes into SAP, which was the whole reason for sharing this blog post with the community. As always I’m open to suggestions, remarks and contributions to this small project.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Matthew Billingham
      Matthew Billingham

      I feel that you should have encoded the URL to your git repository in a QR code. ๐Ÿ™‚

      Author's profile photo Geert-Jan Klaps
      Geert-Jan Klaps
      Blog Post Author

      Hi Matthew,

      Not such a bad idea, will do an update tonight. Currently the screenshots are taken from an internal document I created for the API ๐Ÿ™‚

      Best regards,

      Geert-Jan Klaps

      Author's profile photo Abdul Samad Mohammed
      Abdul Samad Mohammed


      I tried implementing the code. Gives me error while trying to receive the http response "Failed to receive response from API".ย 

      But Interesting thing and looking forward to see more updates to the blog.


      Author's profile photo Geert-Jan Klaps
      Geert-Jan Klaps
      Blog Post Author

      Hi Abdul,

      You should have a look at your STRUST configuration or even in SM59, the system needs to be able to connect to the external website. (can even be configuration on OS level if the system is not allowed to connect to the internet for example)

      Best regards,

      Geert-Jan Klaps