如何用PDF预览smartform-[SSFCOMP_PDF_PREVIEW]

可以通过函数 SSFCOMP_PDF_PREVIEW以pdf格式预览smartforms输出结果。

<img class="alignnone size-full wp-image-6027" src="http://www.baidusap.com/wp-content/uploads/2018-06-27_11-12-13.jpg" alt="" width="810" height="424" srcset="http://www.baidusap.com/wp-content/uploads/2018-06-27_11-12-13.jpg 810w, http://www.baidusap.com/wp-content/uploads/2018-06-27_11-12-13-740x387.jpg 740w, http://www.baidusap.com/wp-content/uploads/2018-06-27_11-12-13-768x402.jpg 768w" sizes="(max-width: 810px) 100vw, 810px" />

例子代码:

REPORT ztest_pdf_output.

*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: gv_formname TYPE tdsfname VALUE 'HRRCF_CS_APPLICANT',
      gv_fm_name  TYPE rs38l_fnam.
DATA: gwa_ssfcompop TYPE ssfcompop,
      gwa_control   TYPE ssfctrlop.
DATA: gv_devtype    TYPE rspoptype.
DATA: gv_job_output TYPE ssfcrescl.
DATA: gt_lines      TYPE TABLE OF tline.
DATA: gv_size       TYPE i.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*Get the function module name using form name
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = gv_formname
    IMPORTING
      fm_name            = gv_fm_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 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.

*Get Device Type
  CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
    EXPORTING
      i_language             = sy-langu
    IMPORTING
      e_devtype              = gv_devtype
    EXCEPTIONS
      no_language            = 1
      language_not_installed = 2
      no_devtype_found       = 3
      system_error           = 4
      OTHERS                 = 5.

  gwa_ssfcompop-tdprinter = gv_devtype.
*Suppress print dialog
  gwa_control-no_dialog = 'X'.
  gwa_control-getotf = 'X'.

*Trigger the smartform
  CALL FUNCTION gv_fm_name
    EXPORTING
      control_parameters = gwa_control
      output_options     = gwa_ssfcompop
    IMPORTING
      job_output_info    = gv_job_output
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
    EXPORTING
      i_otf                    = gv_job_output-otfdata
    EXCEPTIONS
      convert_otf_to_pdf_error = 1
      cntl_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.

运行结果:

&amp;lt;img class="alignnone size-full wp-image-6028" src="http://www.baidusap.com/wp-content/uploads/2018-06-27_11-13-47.jpg" alt="" width="767" height="629" srcset="http://www.baidusap.com/wp-content/uploads/2018-06-27_11-13-47.jpg 767w, http://www.baidusap.com/wp-content/uploads/2018-06-27_11-13-47-740x607.jpg 740w" sizes="(max-width: 767px) 100vw, 767px" /&amp;gt;

以上。

转载于:https://www.cnblogs.com/datie/p/11429175.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值