• ABAP FORM打印转PDF/pdf 预览


    function ZSTXBC_SSFCOMP_PDF_PREVIEW.
    *"--------------------------------------------------------------------
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_OTF) TYPE  TSFOTF
    *"  EXCEPTIONS
    *"      CONVERT_OTF_TO_PDF_ERROR
    *"      CNTL_ERROR
    *"--------------------------------------------------------------------
    data: l_dummy type standard table of tline.
    
      clear: pdf_data, pdf_size.
    
    * convert otf to pdf
      call function 'CONVERT_OTF'
           exporting
                format                = 'PDF'
           importing
                bin_filesize          = pdf_size
                bin_file              = pdf_data
           tables
                otf                   = i_otf[]
                lines                 = l_dummy
           exceptions
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                others                = 4.
    
      if sy-subrc <> 0.
        raise convert_otf_to_pdf_error.
      endif.
    
      call screen 0300 starting at 1 1.
    
    endfunction.
    

    *&+++转换成PDF
            LT_OTF[] = LS_OTFDATA-OTFDATA[].
            CALL FUNCTION 'CONVERT_OTF'
              EXPORTING
                FORMAT                'PDF'
                MAX_LINEWIDTH         132
    *           ARCHIVE_INDEX         = ' '
    *           COPYNUMBER            = 0
    *           ASCII_BIDI_VIS2LOG    = ' '
    *           PDF_DELETE_OTFTAB     = ' '
    *           PDF_USERNAME          = ' ' "don't exist
    *           PDF_PREVIEW           = ' ' "don't exist
    *           USE_CASCADING         = ' ' "don't exist
              IMPORTING
                BIN_FILESIZE          = L_BIN_FILESIZE
    *           BIN_FILE              =
              TABLES
                OTF                   = LT_OTF
                LINES                 = LT_LINES "t_pdf_tab
              EXCEPTIONS
                ERR_MAX_LINEWIDTH     1
                ERR_FORMAT            2
                ERR_CONV_NOT_POSSIBLE 3
                ERR_BAD_OTF           4
                OTHERS                5.

    *&PDF 预览
            CALL FUNCTION 'ZSTXBC_SSFCOMP_PDF_PREVIEW'
              EXPORTING
                I_OTF                    = LT_OTF[]
              EXCEPTIONS
                CONVERT_OTF_TO_PDF_ERROR 1
                CNTL_ERROR               2
                OTHERS                   3.

    *&*********************************************************

     

     

  • 相关阅读:
    图解 Kubernetes
    如何构建可伸缩的Web应用?
    2020年软件开发趋势
    3种基础的 REST 安全机制
    为什么你应该使用 Kubernetes(k8s)
    Elasticsearch:是什么?你为什么需要他?
    你在使用什么 Redis 客户端工具?
    ZooKeeper 并不适合做注册中心
    Jmeter(三)_配置元件
    Jmeter(二)_基础元件
  • 原文地址:https://www.cnblogs.com/rainysblog/p/6279488.html
Copyright © 2020-2023  润新知