Hi everybody,
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.
Best regards
Marcin Cholewczuk
Hi,
I tried your code in ECC 6.0 system and the method GET_SCREENSHOT doe snot exist in this class.
Which version you are using ?
Regards,
Sandeep
Hi,
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.
Best regards
Marcin Cholewczuk
Hi Marcin,
I don't use 7.02, but could you paste the mime type and, say, the first 50 bytes in hexadecimal of the stream data, so that to try to identify it?
Thanks
BR
Sandra
Hi Sandra,
Sure, mime is image/png and first 50B is
89504E470D0A1A0A0000000D4948445200000408000002880802000001059C6F390000200049444154789CEC9D79601445D6
I've stored these data in file and they look ok - I can see screen shoot from my SE38.
Best regards
Marcin Cholewczuk
Thanks Marcin,
Okay. In fact, the Picture control can only display BMP, GIF, JPG. You can display it correctly using the HTML viewer (see for example demo program RSDEMO_HTML_VIEWER)
BR
Sandra
Hi Sandra,
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.
Best regards
Marcin Choleczuk
Hi Marcin,
Thank you for the feedback. By the way, could you tell us more about what does GET_SCREENSHOT? (I guess what it does, but it is surprising that you execute it from inside the PBO, why not the PAI, or was it just not important in your scenario?)
Thanks ![]()
Sandra
Hi Sandra,
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.
Best regards
Marcin Cholewczuk
Hi Sandra,Marcin,
I want also to use this new method.
Do you know if image type can be customized, because i want to use jgp instead of png or do you know some function for easy conversion ?
Hi Roland, you may use IGS (install it if not there). Class CL_IGS_IMAGE_CONVERTER allows to convert. There is SAP library about IGS. And forum for other questions.
Sandra
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
Hai,
In which Class does the method Get_Support exist?
Best regards,
rama
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?
Best regards,
rama