How to work on Image Display Image and store in Table
REPORT zrich_0001.
DATA: lr_mime_rep TYPE REF TO if_mr_api.
DATA: lv_filename TYPE string.
DATA: lv_path TYPE string.
DATA: lv_fullpath TYPE string.
DATA: lv_content TYPE xstring.
DATA: lv_length TYPE i.
DATA: lv_rc TYPE sy-subrc.
DATA: lv_url TYPE char255.
DATA: lo_docking TYPE REF TO cl_gui_docking_container.
DATA: lo_picture TYPE REF TO cl_gui_picture.
DATA: lt_file TYPE filetable.
DATA: ls_file LIKE LINE OF lt_file.
*DATA: lt_data TYPE STANDARD TABLE OF x255.
DATA: lt_data TYPE STANDARD TABLE OF x255.
PARAMETERS: p_path TYPE string
DEFAULT 'D:\SAP DIGI\ESignature.jpg'. "<<-- at="" controls="" create="" dynnr="sy-dynnr" exporting="" lo_docking="" mime="" object="" output.="" path="" repid="sy-repid" save="" selection-screen="" side="lo_docking-" to="">dock_at_left
extension = 200.
CREATE OBJECT lo_picture
EXPORTING
parent = lo_docking.
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 ).
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_length
* first_line = 0
* last_line = 0
IMPORTING
buffer = lv_content
TABLES
binary_tab = lt_data
EXCEPTIONS
failed = 1
OTHERS = 2.
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
).
REFRESH lt_data.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_content
TABLES
binary_tab = lt_data.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGE'
subtype = 'JPG'
TABLES
data = lt_data
CHANGING
url = lv_url.
lo_picture->load_picture_from_url_async( lv_url ).
WRITE: 'Hello'.-->
********************************ROHINI KUMAR*********************************
Please support my work : sap.rohini988@gmail.com LinkedIn Link : https://www.linkedin.com/in/rohini-kumar-14647a13a/
<-- at="" controls="" create="" dynnr="sy-dynnr" exporting="" lo_docking="" mime="" object="" output.="" path="" repid="sy-repid" save="" selection-screen="" side="lo_docking-" to="">
-->********************************************************************************
Comments
Post a Comment