Skip to Content
Author's profile photo Michael Keller

screenshot with embedded text data


Not so long ago I discovered the “GET_SCREENSHOT” method of class “CL_GUI_FRONTEND_SERVICES”. The method creates an image of your current SAP GUI window in the “Portable Network Graphics” format (shortly called “PNG”).

My first thought was: “Great, useful for support teams.” Second thought was: “Support teams would need more information such as transaction code or report name.” Third thought was: “Would it be really necessary to have these information in an extra (text) file?” I did a little research and found a workable solution in the PNG format itself.

This blog is about my implementation to demonstrate the mentioned solution. Please use it as starting point for your own research and share your ideas and thoughts about if you want.    

Required ressources

  • SAP Netweaver stack (I used SAP Netweaver Trial 7.40 on MaxDB)
  • W3C PNG specification (second edition, all mentioned chapter in this blogs belongs to this document)
  • TweakPNG (freeware for examining and modifying PNG image files)
  • ASCII/Hex-Converter (I used an online converter)
  • IrfanView (freeware image viewer)

Basic idea

The method “GET_SCREENSHOT” will be used to create a PNG image of the current SAP GUI window. PNG images consist of different chunks (cf. chapter 5.3). Each chunk has a chunk type to specify its function (cf. chapter 4.7.2). The chunk type “tEXt” is used to store text strings (cf. chapter Keywords can be used to identify the content of the text string. Here are some useful keywords (cf.

  • Title: short title or caption
  • Author: name of creator
  • Description: more details than in title
  • Creation Time: time of original image creation
  • Comment: miscellaneous comment

A Keyword and his associated text string are called chunk data. Now we have all fundamentals for implementing our own solution.

Source code of demo report

You can download the demo from GitHub.


For our example we us “Title” as keyword and “Hello World!” as text string.

Step Description
1 We get a screenshot of our current SAP GUI window.

We combine chunk type, keyword and our text string.

Result: “tEXtTitle Hello World!”


We convert it to hex and place the “Zero Byte” delimiter between keyword and text string (in hex it’s “00”).

Result: “744558745469746C650048656C6C6F20576F726C6421”

  • “74455874” corresponds to “tEXt”,
  • “5469746C65” corresponds to “Title”
  • “00” is a zero byte
  • “48656C6C6F20576F726C6421” corresponds to “Hello World!”

We get the length of the chunk data (that are keyword and text string).

Result: 18 bytes


We generate a CRC32 for chunk type and chunk data.

Result: “1373921944” (in hex it is “51E46298”)


We build the complete chunk. It consists of length, chunk type, chunk data and CRC32.

Result “00000012744558745469746C650048656C6C6F20576F726C642151E46298”

7 We place our tEXt-chunk before the IEND-chunk.
8 We download our enhanced screenshot to desktop.

After downloading the image to your desktop, you can use IrfanView for displaying.


Have a look at the function “View->Show HEX view” of IrfanView.


With TweakPNG you can have a look at the different chunks. You will find our tEXt-chunk “Title” with the corresponding text string “Hello World!”.


Idea for practical use

It’s just an idea and not a well proofed business case: Create your own generic object service to get a screenshot of the current SAP GUI window. Analyze the business context (given business object type and id, sy-structure, callstack and more – perhaps I will show that in another blog) and encode the gathered data into the PNG image as shown above. Download the image to the user’s desktop so he can mail it to his support team. Support team of course would need a tool to show the PNG image and decode all tEXt chunks in it. Even if the user puts no additional information in his mail there are some helpful business context information in the image. As I said before just an idea …

Assigned Tags

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

      Michael, thanks for a good idea!

      It would be great if it will be standard SAP GUI functionality 🙂 , in my case as a tester it useful to have an ability fast creation of such kind of "smart" screenshots when I describe an issue.


      Author's profile photo Michael Keller
      Michael Keller
      Blog Post Author

      Hi Alexey,

      thanks for your comment. The term "smart screenshot" is great, I like it 🙂

      There are so much possibilities to improve the collaboration of users within the system. If enough SCN members would be interested in and would find it useful for their daily work perhaps we can develop a basic solution for everyone. In this case please contact me.

      Kind regards


      Author's profile photo Sandra Rossi
      Sandra Rossi

      Maybe one possible usage is by tweaking the menu Help > Create support message, by implementing the classic BAdI SBCOS001 (note 388814 - Extending the feedback functions; at this time it was a user exit, later converted to a BAdI). I did not try.

      Author's profile photo Michael Keller
      Michael Keller
      Blog Post Author

      Thanks for the hint. I will check this. The topic of "smart screenshots" is a little bit old but if you combine a screenshots with OCR (SAP Leonardo Machine Learning Foundation) and you save the recognized text into the picture file, you have a "smart screenshot solution" for support/test people. Unfortunately I don't have the time to try that. But I may write a blog about it 🙂

      Author's profile photo Sandra Rossi
      Sandra Rossi

      For information, I just implemented this BAdI in S/4 1709 (ABAP 7.52) and it successfully takes a screenshot. Apart that, I didn't test anything else (like adding the screenshot automatically to the support message), so don't ask me! 😉