SAP上传图片并在物料主数据显示
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
SAP 上传图片并在物料主数据自概念屏幕显示步骤:
1.图片保留为BMP格式
2.事务码SE78
成功后文件名存在STXBITMAPS表中,
3.物料主数据屏幕
事务码:SE80
4.MODULE STATUS_9003 OUTPUT.代码:
MODULE STATUS_9003 OUTPUT.
DATA: w_lines TYPE i.
TYPES pict_line(256) TYPE c.
DATA :
container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit,
picture TYPE REF TO cl_gui_picture,
pict_tab TYPE TABLE OF pict_line.
*url(255) TYPE c.
DATA: graphic_url(255).
DATA: BEGIN OF graphic_table OCCURS 0,
line(255) TYPE x,
END OF graphic_table.
DATA: l_graphic_conv TYPE i.
DATA: l_graphic_offs TYPE i.
DATA: graphic_size TYPE i.
DATA: l_graphic_xstr TYPE xstring.
.
CALL METHOD cl_gui_cfw=>flush.
CREATE OBJECT:
container EXPORTING container_name = 'PICTURE_CONTAINER', picture EXPORTING parent = container.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp EXPORTING
p_object = 'GRAPHICS'
p_name = 'Z333' "导入的图片文件名。
p_id = 'BMAP'
p_btype = 'BCOL'
RECEIVING
p_bmp = l_graphic_xstr
* EXCEPTIONS
* NOT_FOUND = 1
* INTERNAL_ERROR = 2
* others = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
graphic_size = XSTRLEN( l_graphic_xstr ).
l_graphic_conv = graphic_size.
l_graphic_offs = 0.
WHILE l_graphic_conv > 255.
graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
APPEND graphic_table.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
ENDWHILE.
graphic_table-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
APPEND graphic_table.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGE'
subtype = 'X-UNKNOWN'
size = graphic_size
lifetime = 'T'
TABLES
data = graphic_table
CHANGING
url = url.
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = picture->display_mode_fit_center.
ENDMODULE.
5.屏幕格式:
定制操纵,名称:PICTURE_CONTAINER
6.物料主数据屏幕配置:
事务码:SPRO
7.物料主数据显示结果
事务码:MM03
8.程序中显示:
事务码:SE38
屏幕
执行程序,结果如下:
9.其他方式显示图片
将图片寄存在特定途径,通过SAP内置阅读器访问该途径并打开图片:物理途径:C:\Users\dadi\Desktop\Z333.bmp
事务码:SE38 程序名:SAPHTML_DEMO1
10.。