Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

This document explains how screen shot of SAP GUI screen can be taken and sends it as mail attachment by ABAP program.


Requirement: Taking screenshot of GUI screen like shown below and send it as mail attachments through ABAP.(Note I have enhanced std demo program GRAPHICS_GUI_CE_DEMO to demonstrate screen shot feature ).

Approach

  •    Use front end GUI service class to take screenshot – Method GET_SCREENSHOT of CL_GUI_FRONTEND_SERVICES. 

           When you called this method, system will take screenshot of active screen and return screenshot data intern of

          hexadecimal values (xstring).


   As shown in above code, screenshot data is imported by image parameter.


  • Convert xstring data into binary data to send it as attachment – Use method XSTRING_TO_SOLIX  of class CL_BCS_CONVERT

      LT_DOC_CONTENT contains binary data which will be used later to send as attachment in mail.

  •     Send screenshot as mail attachment – Use class CL_BCS to send mail with attachment.

          a) Create persistent object of type CL_BCS for a mail send request

        

            b) Create Mail document to include body, attachment etc. Mail document type CL_DOCUMENT_BCS

          

        

          Above code – Mail subject as ‘Project Status Info’. Mail body can be in I_TEXT parameter. For this example I not used

          any mail content.


          c) Add screenshot as an attachment  to mail document . screenshot can be PNG, BMP,GIF,JPG etc. Note whatever the 

                 screenshot data taken in previous step 1 and 2 attached as document here

          

             Binary content of screenshot data LT_DOC_CONTENT which prepared in step1 and step2

             passed to I_ATT_CONTENT_HEX.


          d) Attach mail document object to send request.

             

           e)   Attach sender and recipient address. Add sender, TO, CC, BC address to send request.

                 

            f)      Send Mail – Call send method to send mail with attachment

                   


Result :


When user click on screenshot button then system takes screen shot and send it as email attachment.







          



20 Comments
Labels in this area