总所周知,SE78可以用来上传BMP 和TIF格式的图片,但是SAP能不能上传GIF JPG等其他格式的图片呢?
答案是肯定的,通过TCODE: OAER,在选择屏幕上填入要该图片的相关属性 CLASS NAME, CLASS TYPE, OBJECT KEY,完了之后直接F8
这就创建了一个分组,以后可以在该分组下上传图片了,双击左下角子屏幕中的Create对应tab中的screen,然后弹出一个对话框,让你选择要上传的本地的图片文件路径,支持任何格式。
那么如何通过代码显示这些图片呢?
原理和显示SE78图片差不了很多。且看实例:
屏幕流:
PROCESS BEFORE OUTPUT.
MODULE STATUS_9100.
*
PROCESS AFTER INPUT.
MODULE exit_prog.
MODULE USER_COMMAND_9100.
主程序代码:
DATA: ok_code TYPE sy-ucomm.
START-OF-SELECTION.
CALL SCREEN 9100.
*&---------------------------------------------------------------------*
*& Module EXIT_PROG INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit_prog INPUT.
LEAVE PROGRAM.
ENDMODULE. " EXIT_PROG INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_9100 INPUT.
ENDMODULE. " USER_COMMAND_9100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_9100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9100 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
TYPES: pict_line(256) TYPE c,
ty_uri_tab TYPE STANDARD TABLE OF bapiuri.
DATA: container TYPE REF TO cl_gui_custom_container,
picture TYPE REF TO cl_gui_picture,
lt_uris TYPE ty_uri_tab,
lw_uri TYPE bapiuri,
url TYPE bds_uri.
CALL METHOD cl_gui_cfw=>flush.
CREATE OBJECT container
EXPORTING
container_name = 'PICTURE_CONTAINER'.
CREATE OBJECT picture
EXPORTING
parent = container.
CALL FUNCTION 'BDS_BUSINESSDOCUMENT_GET_URL'
EXPORTING
classname = 'PICTURES'
classtype = 'OT'
object_key = 'EATING'
TABLES
uris = lt_uris.
LOOP AT lt_uris INTO lw_uri.
SEARCH lw_uri FOR 'CHIFAN.GIF'.
IF sy-subrc = 0.
url = lw_uri-uri.
ENDIF.
ENDLOOP.
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = picture->display_mode_normal_center.
ENDMODULE. " STATUS_9100 OUTPUT
标签:picture,uri,9100,BMP,MODULE,INPUT,TIF,TYPE,图片 From: https://blog.51cto.com/u_15903986/5916084