SAP好像并没有标准的事务码可以方便下载已上传至SAP服务器上的图片,通常的解决方法写一个专门下载这类图片的简单程序来处理。
REPORT Ydownload.
DATA : g_bytecount TYPE i,g_content TYPE STANDARD TABLE OFbapiconten 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 imagep_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'IMPORTINGfile_name = p_file.*F4 help search for image files
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_image.CALL FUNCTION 'SAPSCRIPT_SEARCH_GRAPHIC_BDS'EXPORTINGselection_screen = 'X'select_entry = 'X'selection_show = 'X'IMPORTINGe_name = p_imageTABLESt_selections = l_bitmapsEXCEPTIONSnothing_found = 1selection_canceled = 2internal_error = 3OTHERS = 4.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.START-OF-SELECTION.MOVE p_file TO g_file_name.
*Get graphics to BDSCALL FUNCTION 'SAPSCRIPT_GET_GRAPHIC_BDS'EXPORTINGi_object = 'GRAPHICS'i_name = p_imagei_id = 'BMAP'i_btype = 'BCOL'IMPORTINGe_bytecount = g_bytecountTABLEScontent = g_contentEXCEPTIONSnot_found = 1bds_get_failed = 2bds_no_content = 3OTHERS = 4.IF sy-subrc <> 0.MESSAGE i208(00) WITH 'Image does not exists.'(000).ENDIF.IF NOT g_content[] IS INITIAL.
*Convert to BITMAPCALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP'EXPORTINGold_format = 'BDS'new_format = 'BMP'bitmap_file_bytecount_in = g_bytecountIMPORTINGbitmap_file_bytecount = g_bitmap_file_bytecountTABLESbds_bitmap_file = g_contentbitmap_file = g_bitmap_fileEXCEPTIONSOTHERS = 1.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.
*Download to PCCALL FUNCTION 'GUI_DOWNLOAD'EXPORTINGbin_filesize = g_bitmap_file_bytecountfilename = g_file_namefiletype = 'BIN'TABLESdata_tab = g_bitmap_fileEXCEPTIONSfile_write_error = 1no_batch = 2gui_refuse_filetransfer = 3invalid_type = 4no_authority = 5unknown_error = 6header_not_allowed = 7separator_not_allowed = 8filesize_not_allowed = 9header_too_long = 10dp_error_create = 11dp_error_send = 12dp_error_write = 13unknown_dp_error = 14access_denied = 15dp_out_of_memory = 16disk_full = 17dp_timeout = 18file_not_found = 19dataprovider_exception = 20control_flush_error = 21OTHERS = 22.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.ENDIF.