Upload图片se78。 se78上传图片----图片必须是bmp格式的,一开始保存就需要保存成bmp,png重命名成bmp不可以,左上角小图标是选择文件上传
download图片Ydownload。
REPORT Ydownload.
DATA : g_bytecount TYPE i,
g_content TYPE STANDARD TABLE OF
bapiconten INITIAL SIZE 0,
g_bitmap_file_bytecount TYPE i,
g_file_name TYPE string,
BEGIN OF g_bitmap_file OCCURS 0,
line(255) TYPE x,
END OF g_bitmap_file,
l_bitmaps TYPE TABLE OF stxbitmaps WITH HEADER LINE,
lit_scrfields TYPE TABLE OF dynpread WITH HEADER LINE.
PARAMETER: p_image LIKE stxbitmaps-tdname, "需要下载的图片名称
* DEFAULT 'ENJOY', "name of the image
p_file LIKE ibipparms-path. "下载到PC的路径
* DEFAULT 'H:\My Documents\enjoy.bmp'.
" Download File path
*F4 help to get file path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
*F4 help search for image files
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_image.
CALL FUNCTION 'SAPSCRIPT_SEARCH_GRAPHIC_BDS'
EXPORTING
selection_screen = 'X'
select_entry = 'X'
selection_show = 'X'
IMPORTING
e_name = p_image
TABLES
t_selections = l_bitmaps
EXCEPTIONS
nothing_found = 1
selection_canceled = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
START-OF-SELECTION.
MOVE p_file TO g_file_name.
*Get graphics to BDS
CALL FUNCTION 'SAPSCRIPT_GET_GRAPHIC_BDS'
EXPORTING
i_object = 'GRAPHICS'
i_name = p_image
i_id = 'BMAP'
i_btype = 'BCOL'
IMPORTING
e_bytecount = g_bytecount
TABLES
content = g_content
EXCEPTIONS
not_found = 1
bds_get_failed = 2
bds_no_content = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i208(00) WITH 'Image does not exists.'(000).
ENDIF.
IF NOT g_content[] IS INITIAL.
*Convert to BITMAP
CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP'
EXPORTING
old_format = 'BDS'
new_format = 'BMP'
bitmap_file_bytecount_in = g_bytecount
IMPORTING
bitmap_file_bytecount = g_bitmap_file_bytecount
TABLES
bds_bitmap_file = g_content
bitmap_file = g_bitmap_file
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Download to PC
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = g_bitmap_file_bytecount
filename = g_file_name
filetype = 'BIN'
TABLES
data_tab = g_bitmap_file
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.