Technical Articles
Generating QR codes using goqr.me 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 goqr.me 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 goqr.me 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.
I feel that you should have encoded the URL to your git repository in a QR code. ๐
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
Hi,
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.
Abdul.
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