SAP 将smartforms的报表转成PDF

SAP将smartforms的报表转成PDF
方法一:
通过调用系统程序:RSTXPDFT4将SAPscript (OTF)或 ABAP 清单假脱机作业转换到 PDF
  选择画面条件
     假脱机请求    ⇒ smartforms的脱机打印号
     PDF文件名    ⇒ 需要进行保存的pdf文件及路径  
 
举例如下:
*调用SAP转PDF的程序
SUBMIT RSTXPDFT4 VIA SELECTION-SCREEN
                 WITH SPOOLNO = LW_SP00LIDS         选择画面上的脱机打印机号
                 AND  RETURN. 
 
 
方法二:
获取SMARTFORMS的函数ID:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = 'ZXXX'      *此处为smartform名字
  IMPORTING
    fm_name            = fm_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2
    OTHERS             = 3.
 
执行SMARTFORMS
<span style="color: black;">CALL FUNCTION fm_name
  EXPORTING
    control_parameters = cparam    </span>
<span style="color: black;">*   HTH                = HTH             </span><span style="color: black;">此处传入参数</span><span style="color: black;">
    output_options     = outop
    user_settings      = space
  IMPORTING
    job_output_info    = tab_otf_data
  EXCEPTIONS
    formatting_error   = 1
    internal_error     = 2
    send_error         = 3
    user_canceled      = 4
    OTHERS             = 5.</span>
 
<span style="color: black;">tab_otf_final[] = tab_otf_data-otfdata[].</span>
 
通过函数:CONVERT_OTF  将smartforms转换为PDF
<span style="color: black;">************ converting OTF data into pdf data**************************
CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format                  = 'PDF'
    max_linewidth           = 132
*   ARCHIVE_INDEX           = ' '
*   COPYNUMBER              = 0
*   ASCII_BIDI_VIS2LOG      = ' '
  IMPORTING
    bin_filesize            = bin_filesize
  TABLES
    otf                     = tab_otf_final
    lines                   = pdf_tab
  EXCEPTIONS
    err_max_linewidth       = 1
    err_format              = 2
    err_conv_not_possible   = 3
    err_bad_otf             = 4
    OTHERS                  = 5.</span>
 
PDF文件下载

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    bin_filesize            = bin_filesize
    filename                = 'D:\TEST.PDF'
    filetype                = 'BIN'
  IMPORTING
    filelength              = file_size
  TABLES
    data_tab                = pdf_tab
*   FIELDNAMES              =
  EXCEPTIONS
    file_write_error        = 1
    no_batch                = 2
    gui_refuse_filetransfer = 3
    invalid_type            = 4
    no_authority            = 5
    unknown_error           = 6
    header_not_allowed      = 7
    separator_not_allowed   = 8
    filesize_not_allowed    = 9
    header_too_long         = 10
    dp_error_create         = 11
    dp_error_send           = 12
    dp_error_write          = 13
    unknown_dp_error        = 14
    access_denied           = 15
    dp_out_of_memory        = 16
    disk_full               = 17
    dp_timeout              = 18
    file_not_found          = 19
    dataprovider_exception  = 20
    control_flush_error     = 21
    OTHERS                  = 22.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值