Store Image in A Table Upload A Image
Store Image in A Table Upload A Image
cl_gui_frontend_services=>file_open_dialog(
CHANGING
file_table = lt_file " Table Holding Selected Files
rc = lv_rc ). " Return Code, Number of Files or -1 If
Error Occurred
READ TABLE lt_file INTO ls_file INDEX 1.
IF sy-subrc = 0.
lv_filename = ls_file-filename.
ENDIF.
cl_gui_frontend_services=>gui_upload(
EXPORTING
filename = lv_filename " Name of file
filetype = 'BIN'
IMPORTING
filelength = lv_length " File length
CHANGING
data_tab = lt_data " Transfer table for file contents
EXCEPTIONS
OTHERS = 19 ).
lr_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).
lr_mime_rep->put(
EXPORTING
i_url = p_path
i_content = lv_content
EXCEPTIONS
parameter_missing = 1
error_occured = 2
cancelled = 3
permission_failure = 4
data_inconsistency = 5
new_loio_already_exists = 6
is_folder = 7
when you are ready to show the image in a picture control on a screen.
You can do something like this. This uses a docking container so that
you don't have to create a screen, but it works the same way with a
customer container.
REPORT zrich_0001.
PARAMETERS: p_check.
AT SELECTION-SCREEN OUTPUT.
* Create controls
CREATE OBJECT lo_docking
EXPORTING
repid = lv_repid
dynnr = sy-dynnr
side = lo_docking->dock_at_left
extension = 200.
lr_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).
lr_mime_rep->get(
EXPORTING
i_url = p_path
IMPORTING
e_content = lv_content
EXCEPTIONS
not_found = 3 ).
lo_picture->load_picture_from_url_async( lv_url ).