I've noticed this function lately and wanted to test it. I wrote report like below, but nothing is displayed. Data are read (at least I'm getting something in this xstring), url is being generated, container and picture objects are created, and url is loaded without error. So what is wrong here?
REPORT ZTEST11. data: lv_mime TYPE string, lv_data TYPE xstring. DATA: BEGIN OF graphic_table OCCURS 0, line(255) TYPE x, END OF graphic_table. DATA: graphic_size TYPE i. DATA: graphic_url(255). DATA: l_graphic_conv TYPE i, l_graphic_offs TYPE i. DATA: lo_picture TYPE REF TO cl_gui_picture, lo_container TYPE REF TO cl_gui_docking_container. data lv_result type i. PARAMETERS tmp. AT SELECTION-SCREEN OUTPUT. IF lo_container IS NOT BOUND. CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_SCREENSHOT IMPORTING MIME_TYPE_STR = lv_mime IMAGE = lv_data. graphic_size = XSTRLEN( lv_data ). CHECK graphic_size > 0. l_graphic_conv = graphic_size. l_graphic_offs = 0. WHILE l_graphic_conv > 255. graphic_table-line = lv_data+l_graphic_offs(255). APPEND graphic_table. l_graphic_offs = l_graphic_offs + 255. l_graphic_conv = l_graphic_conv - 255. ENDWHILE. graphic_table-line = lv_data+l_graphic_offs(l_graphic_conv). APPEND graphic_table. CALL FUNCTION 'DP_CREATE_URL' EXPORTING TYPE = 'image' SUBTYPE = 'png' TABLES DATA = graphic_table CHANGING URL = graphic_url. CREATE OBJECT LO_CONTAINER EXPORTING EXTENSION = 600. CREATE OBJECT LO_PICTURE EXPORTING PARENT = LO_CONTAINER. CALL METHOD LO_PICTURE->LOAD_PICTURE_FROM_URL EXPORTING URL = graphic_url. ENDIF.
I'm using Netweaver 7.2 This is something that came with EHP2.
I've replaced this get_screenshot with below code and it's working fine, so maybe this function is returning data in some strange format?
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp EXPORTING p_object = 'GRAPHICS' p_name = 'ENJOY' p_id = 'BMAP' p_btype = 'BMON' RECEIVING p_bmp = lv_data EXCEPTIONS not_found = 1 OTHERS = 2.
I saw it somewhere, but I guess I was too cleaver and was hoping that maybe somehow it will work After your sugestion I've changed and instead of picture I've used html like below and now it works. Thank you very much for your help.
CALL METHOD LO_HTML->LOAD_DATA EXPORTING TYPE = 'image' SUBTYPE = 'png' IMPORTING ASSIGNED_URL = graphic_url CHANGING DATA_TABLE = graphic_table."graphic_table. CALL METHOD LO_HTML->SHOW_URL EXPORTING URL = graphic_url.
As name suggest it's doing a screenshot of what is curently visible in presentation layer (active window).
Why I do it in AT SELECTION SCREEN OUTPUT? Because I wanted to test it without creation of new screen in screen painter - it's quicker that way and possible to paste whole solution here without additional marks regarding created screen.
Thanks a lot for the info.
Method GET_SUPPORT works really well.
I use it in combination with method CL_GUI_HTML_VIEWER=>SHOW_URL_IN_BROWSER to display in IE and
method cl_gui_frontend_services=>gui_download for saving a into file.
Idea is to use this in a next step as attachment in mail to key user or ASM guys in case of problems.
This will help incident solver because screenshot can give detailed information about user problem.
Please let me have my first points here if helpful.
Edited by: Roland Wenzel on May 3, 2011 4:26 PM
Hallo Mr. Marcin,
As you said, the Get_Screenshot method is doing a screenshot of what is present in the active window, but the method get_bds_graphic_as_bmp is actually loading a graphic from the Server and not the one present in the current window right?
I am workingon ECC 6.0 and hence dont have the method Get_Screenshot...Any clue on how to get the Screenshot of the current window?