In my first blog on SCN I want to show some tricky stuff to get the thumbnail image data and show up in a Dynpro.
In every ERP system is a document storage involved. But for this example I want to show how to get the image data out of a external storage. There are different description for it and maybe I mixed it up: content server, KPRO (knowledge provider)
SAP menu –> Logistics –> Project System –> Documents –> Document Management System –> Document:
- CV01N, … , CV04N
The bad thing for a external storage is that the ERP system doesn’t get the image data directly, if you call up an original, it just send the Link-address from the content server to the client (SAP Gui). There is no (image)data transfer between ERP and the client.
So the key is to get the link URL and show this thumbnail in a dynpro. I suppose that the customizing is set up correctly with a defined Thumbnail (small picture) WS-application.
Well there is a function CL_DMS_THUMBNAIL_DISPLAY=>GET_URL to catch the URL for the selected document number.
The next thing is to set up an custom container in a dynpro screen create the objects and show up the image data to it.
The thumbnail will be shown in the same height and width what the custom container has in your dynpro.
The complete code with additional pictures is available here: https://wiki.sdn.sap.com/wiki/x/kgB_Ag
–> code snip – begin
DATA: gv_url TYPE dms_url,
gs_doc TYPE bapi_doc_keys,
gr_thumbnail TYPE REF TO cl_gui_custom_container,
gr_picture TYPE REF TO cl_gui_picture.
CALL METHOD cl_dms_thumbnail_display=>get_url
EXPORTING i_doc = gs_doc
IMPORTING e_url = gv_url.
IF NOT gv_url IS INITIAL.
CREATE OBJECT gr_thumbnail
EXPORTING container_name = ‘CV_THUMBNAIL’.
CREATE OBJECT gr_picture
EXPORTING parent = gr_thumbnail.
CALL METHOD gr_picture->set_display_mode
EXPORTING display_mode = gr_picture->display_mode_fit_center.
gr_picture->load_picture_from_url_async( url = gv_url ).
–> code snip – end
My next quest is to show up such thumbnails into print forms (Adobe Interactive Forms, Smartforms, SAP Script) and put it out on printers. If you have useful hints please write it down in the comments or extend the wiki page. Thanks!