Objective:
To display animated images in SAP screens.
Upload Animated GIF Image in SMWO like this
Code:
DATA: docking TYPE REF TO cl_gui_docking_container,
v_or_html_viewer TYPE REF TO cl_gui_html_viewer,
it_query_table TYPE TABLE OF w3query,
it_html_table TYPE TABLE OF w3html,
it_pic_data TYPE TABLE OF w3mime,
return_code TYPE w3param-ret_code,
content_type TYPE w3param-cont_type,
content_length TYPE w3param-cont_len,
wa_query_table TYPE w3query,
wa_html_table TYPE w3html,
wa_pic_data TYPE w3mime,
pic_size TYPE i,
url(256) TYPE c ,
g_fram(1255).
PARAMETERS: p_dummy TYPE c .
AT SELECTION-SCREEN OUTPUT.
PERFORM show_pic.
START-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form show_pic
*&---------------------------------------------------------------------*
FORM show_pic.
DATA: repid LIKE sy-repid.
repid = sy-repid.
IF docking IS INITIAL .
CREATE OBJECT docking
EXPORTING
repid = repid
dynnr = sy-dynnr
side = cl_gui_docking_container=>dock_at_right
extension = '800'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT v_or_html_viewer EXPORTING parent = docking.
CHECK sy-subrc = 0.
REFRESH it_query_table.
wa_query_table-name = '_OBJECT_ID'.
wa_query_table-value = 'YIMAGEGIF'.
APPEND wa_query_table TO it_query_table.
CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = it_query_table
html = it_html_table
mime = it_pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGES'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = it_pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.
* Load the picture by using the url generated by the data provider.
IF sy-subrc = 0.
CALL METHOD v_or_html_viewer->show_url
EXPORTING
url = url.
ENDIF.
ENDIF .
ENDFORM. "show_pic
Output: