Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms to PDF file

Former Member
0 Kudos

hi experts,

How can I convert smartforms into PDF?

Regards,

Marc

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Here you go

How to convert smartform output to PDF and mailing them

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-001...

Also these threads should help you

PO as SMART Form and mail as PDF

Regards,

Ravi

Note - Please mark all the helpful answers

3 REPLIES 3

Former Member
0 Kudos

Here you go

How to convert smartform output to PDF and mailing them

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-001...

Also these threads should help you

PO as SMART Form and mail as PDF

Regards,

Ravi

Note - Please mark all the helpful answers

raja_thangamani
Active Contributor
0 Kudos

Here is the sample code..

CALL FUNCTION fm_name        " '/1BCDWB/SF00000035' - FM Generated by Smartform
  EXPORTING
    control_parameters = control_parameters
    output_options     = output_options
    s_header           = st_header
  IMPORTING
    job_output_info = output_data
  TABLES
    it_overdue = ITAB[]
  EXCEPTIONS
    formatting_error = 1
    internal_error   = 2
    send_error       = 3
    user_canceled    = 4
    OTHERS           = 5.
 
* now convert the final document (OTF format) into PDF 
format
CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format = 'DOC'
  IMPORTING
    bin_filesize = v_pdf_len
  TABLES
    otf   = output_data-otfdata
    lines = pdf_table
  EXCEPTIONS
    err_max_linewidth     = 1
    err_format            = 2
    err_conv_not_possible = 3
    err_bad_otf           = 4
    OTHERS                = 5.
 
** Downloading the PDF file to the local Server
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME = L_FILENAME
    FILETYPE = C_BIN_FILETYPE
  TABLES
    DATA_TAB = lt_pdf_nuc_data
  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.
 
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards,

Raja T

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this.Here I have explained how to convert the smartform to PDF.

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-001...