Fork me on GitHub

SAP Adobe Form 教程五 图片

前文:

SAP Adobe Form 教程一 简单示例

SAP Adobe Form 教程二 表

SAP Adobe Form 教程三 日期,时间,floating field

SAP Adobe Form 教程四 动态隐藏和显示字段

 

原文标题:SAP Adobe Interactive Form Tutorial. Part V. Images, Graphics and Logo in Adobe Forms

本文链接:https://www.cnblogs.com/hhelibeb/p/15512978.html

前提:需要通过SE78上传图片。

 

上传完成后,请检查确认图片已经在系统中存在,

 

 

创建interface。

事务代码SFP,

 

 在interface中添加一个IV_LOGO参数,类型为XSTRING,

 

 

创建form,

 

拖放参数IV_LOGO到Context,

 

 

在Context的YRAM_ADOBE_FORM5右击,并且选择create->graphic.

 

 

下一步很重要:把Graphic type从Graphic Reference改为Graphic content。

 

 

 

输入字段名IV_LOGO,选择MIME TYPE为‘IMAGE/BMP’.

 

保存,并前往Layout的Data View标签页。拖放Graphic到layout。

 

可以根据需要拉伸或压缩图片。可能需要删除图片标题,即默认图像字段文本。

 

出于演示目的,我在图片下方添加了另一个文本元素。

检查、保存和激活。

带有图形和表单界面的Layout已经完成。 注意到了吗,我们的Layout中有两个元素。图片字段和图形内容。 相当于变量名和实际内容。

调用adobe form的驱动程序,

  1 *&---------------------------------------------------------------------*
  2 *======================================================================*
  3 * YRAM_ADOBE_FORM_PROGRAM5 *
  4 *======================================================================*
  5 * Project : SAP Adobe Forms Tutorial *
  6 * Author : Ramanjula Naidu DARURU (www.SAPYard.com) *
  7 * Description : Printing a logo in the adobe form *
  8 *======================================================================*
  9 REPORT yram_adobe_form_program5.
 10 
 11 *======================================================================*
 12 * Selection Screen
 13 *======================================================================*
 14 PARAMETERS : p_logo TYPE rstxt-tdname.
 15 *======================================================================*
 16 * Data Objects
 17 *======================================================================*
 18 
 19 DATA: gv_fm_name TYPE rs38l_fnam, " FM Name
 20 gs_fp_docparams TYPE sfpdocparams,
 21 gs_fp_outputparams TYPE sfpoutputparams,
 22 gv_name TYPE tdobname,
 23 gv_logo TYPE xstring ,
 24 gv_bmp TYPE xstring.
 25 *======================================================================*
 26 * Constants
 27 *======================================================================*
 28 CONSTANTS : gc_btype TYPE tdbtype VALUE 'BCOL',
 29 gc_id TYPE tdidgr VALUE 'BMAP',
 30 gc_object TYPE tdobjectgr VALUE 'GRAPHICS',
 31 gv_form_name TYPE fpname VALUE 'YRAM_ADOBE_FORM5'.
 32 
 33 *======================================================================*
 34 * START of Calling the Form
 35 *======================================================================*
 36 *&---------------------------------------------------------------------*
 37 **&&~~ Form Processing: Call Form - Open
 38 *
 39 CALL FUNCTION 'FP_JOB_OPEN'
 40 CHANGING
 41 ie_outputparams = gs_fp_outputparams
 42 EXCEPTIONS
 43 cancel = 1
 44 usage_error = 2
 45 system_error = 3
 46 internal_error = 4
 47 OTHERS = 5.
 48 IF sy-subrc <> 0.
 49 " Suitable Error Handling
 50 ENDIF.
 51 *&---------------------------------------------------------------------*
 52 **&&~~ Get the Function module name based on Form Name
 53 *
 54 CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
 55 EXPORTING
 56 i_name = gv_form_name
 57 IMPORTING
 58 e_funcname = gv_fm_name.
 59 IF sy-subrc <> 0.
 60 " Suitable Error Handling
 61 ENDIF.
 62 
 63 *  Passing the logo name
 64 gv_name = p_logo.
 65 
 66 *  Get the image/logo graphic information
 67 CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
 68 EXPORTING
 69 p_object = gc_object " GRAPHICS
 70 p_name = gv_name " Name of the Logo
 71 p_id = gc_id " BMAP
 72 p_btype = gc_btype " BCOL for color, 'BMON' for Black & White
 73 RECEIVING
 74 p_bmp = gv_bmp
 75 EXCEPTIONS
 76 not_found = 1
 77 internal_error = 2
 78 OTHERS = 3.
 79 
 80 gv_logo = gv_bmp.
 81 
 82 *&---------------------------------------------------------------------*
 83 **&&~~ Take the FM name by execuing the form - by using Pattern-
 84 **&&~~ call that FM and replace the FM Name by gv_fm_name
 85 **&&~~ Call the Generated FM
 86 CALL FUNCTION gv_fm_name
 87 EXPORTING
 88 /1bcdwb/docparams = gs_fp_docparams
 89 * iv_name = p_name
 90 * iv_flag = p_flag
 91 iv_logo = gv_logo
 92 EXCEPTIONS
 93 usage_error = 1
 94 system_error = 2
 95 internal_error = 3
 96 OTHERS = 4.
 97 IF sy-subrc <> 0.
 98 * Implement suitable error handling here
 99 ENDIF.
100 *&---------------------------------------------------------------------*
101 
102 *&---------------------------------------------------------------------*
103 *&---- Close the spool job
104 CALL FUNCTION 'FP_JOB_CLOSE'
105 EXCEPTIONS
106 usage_error = 1
107 system_error = 2
108 internal_error = 3
109 OTHERS = 4.
110 IF sy-subrc <> 0.
111 * <error handling>
112 ENDIF.

 

参考阅读:如何上载PNG图片到SAP系统内

posted @ 2021-11-05 14:29  氢氦  阅读(1693)  评论(0编辑  收藏  举报