标签:bsp while string map 图片预览 sub object action end
1.se78 上传 或 预览图片
图片预览
2.程序代码
定义各变量
DATA: H_PICTURE TYPE REF TO CL_GUI_PICTURE, H_PIC_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER. DATA: GRAPHIC_URL(255) TYPE C, GRAPHIC_REFRESH TYPE CHAR1, G_RESULT TYPE I. DATA: BEGIN OF GRAPHIC_TABLE OCCURS 0, LINE(255) TYPE X, END OF GRAPHIC_TABLE. DATA: GRAPHIC_SIZE TYPE I. CONSTANTS: CNTL_TRUE TYPE I VALUE 1, CNTL_FALSE TYPE I VALUE 0.
pbo
DATA: L_GRAPHIC_XSTR TYPE XSTRING, L_GRAPHIC_CONV TYPE I, L_GRAPHIC_OFFS TYPE I. CALL METHOD CL_SSF_XSF_UTILITIES=>GET_BDS_GRAPHIC_AS_BMP EXPORTING P_OBJECT = ‘GRAPHICS‘ P_NAME = ‘ENJOY‘ "图片名称(SE78中维护) P_ID = ‘BMAP‘ P_BTYPE = BMON "(BMON = black&white, BCOL = colour) RECEIVING P_BMP = L_GRAPHIC_XSTR EXCEPTIONS NOT_FOUND = 1 OTHERS = 2. GRAPHIC_SIZE = XSTRLEN( L_GRAPHIC_XSTR ). CHECK GRAPHIC_SIZE > 0. 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‘ "#EC NOTEXT SUBTYPE = CNDP_SAP_TAB_UNKNOWN " ‘X-UNKNOWN‘ SIZE = GRAPHIC_SIZE LIFETIME = CNDP_LIFETIME_TRANSACTION "‘T‘ TABLES DATA = GRAPHIC_TABLE CHANGING URL = GRAPHIC_URL EXCEPTIONS DP_INVALID_PARAMETER = 1 DP_ERROR_PUT_TABLE = 2 DP_ERROR_GENERAL = 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. "创建图片容器 CREATE OBJECT H_PIC_CONTAINER EXPORTING CONTAINER_NAME = ‘CC_PIC‘. "“定制控制”控件名称 "创建图片实例 CREATE OBJECT H_PICTURE EXPORTING PARENT = H_PIC_CONTAINER. "显示图片 CALL METHOD H_PICTURE->LOAD_PICTURE_FROM_URL EXPORTING URL = GRAPHIC_URL IMPORTING RESULT = G_RESULT.
标签:bsp while string map 图片预览 sub object action end
原文地址:http://www.cnblogs.com/mingdashu/p/6824983.html