Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to display a large size image in a custom container?

0 Kudos

I am trying to display image from an external system. The images of small size like 50KB - 700KB are being displayed just fine, but when i try to display an image of large size like 3mb - 4mb the image does not show. is there any way to upload an image of larger size. below is my code:

MODULE get_images OUTPUT.

DATA: lv_pic_result TYPE i,
pic_data LIKE w3mime OCCURS 0,
pic_size TYPE i.

CLEAR: gv_file, pic_size, pic_data, lv_pic_result .

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_string
filetype = 'BIN'
IMPORTING
filelength = pic_size
TABLES
data_tab = pic_data
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 20
.

IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = gv_file
EXCEPTIONS
OTHERS = 1.




"free control object
IF gr_cc_pic IS NOT INITIAL.
gr_cc_pic->free( ).
FREE gr_cc_pic.
ENDIF.


CALL METHOD cl_gui_cfw=>flush.

"create custom container in dynpro 9003
IF gr_cc_pic IS INITIAL.
CREATE OBJECT gr_cc_pic
EXPORTING
container_name = 'IMAGES'
repid = sy-repid
dynnr = sy-dynnr.
ENDIF.

"create picture
IF gr_pic IS INITIAL.
CREATE OBJECT gr_pic
EXPORTING
parent = gr_cc_pic.
ENDIF.

gr_pic->load_picture_from_url(
EXPORTING
url = gv_file
IMPORTING
result = lv_pic_result
EXCEPTIONS
error = 1 ).

CALL METHOD gr_pic->set_3d_border(
EXPORTING
border = 5
EXCEPTIONS
error = 1 ).

gr_pic->set_display_mode(
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit
EXCEPTIONS
error = 1 ).

CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = gr_cc_pic.

CALL METHOD cl_gui_cfw=>flush.

ENDMODULE.

1 REPLY 1

mmcisme1
Active Contributor

Well this isn't really an answer more of a did you try... We made a container like that a while ago. We used cl_gui_html_viewer and cl_gui_custom_container. We were also using a classic dynpro.

Are you sure your large files are getting uploaded without an issue? I'm trying to remember if I had an issue with that. It's been awhile so that's why this is a comment.