Skip to Content

smartforms output in pdf format

can we do directly coding in smartforms to display its output in pdf format.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 29, 2013 at 01:23 AM

    No you can't, It has to be deal with outside of the SMARTFORMS.

    There are several steps.

    Before everything, your needs the following variables:

    DATA:ls_control_param TYPE ssfctrlop.

    DATA:ls_composer_param TYPE ssfcompop.

    DATA:ls_job_output_info TYPE ssfcrescl.

    DATA:lt_job_output_info TYPE TABLE OF ssfcrescl WITH HEADER LINE.

    DATA: lt_pdf TYPE STANDARD TABLE OF tline.

    DATA: lt_docs TYPE STANDARD TABLE OF docs.

    DATA: l_file_size TYPE i.

    1) SSF_FUNCTION_MODULE_NAME

    To get the smartforms' function model

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    formname = p_frm

    IMPORTING

    fm_name = fm_name

    EXCEPTIONS

    no_form = 1

    no_function_module = 2

    OTHERS = 3.

    OPTIONAL STEP:

    open the connection for pool

    control_parameters-no_dialog = 'X'.

    control_parameters-preview = 'X'.

    control_parameters-getotf = 'X'.

    control_parameters-no_open = 'X'.

    control_parameters-no_close = 'X'.

    CALL FUNCTION 'SSF_OPEN'

    EXPORTING

    control_parameters = control_parameters

    " mail_appl_obj = appl_object_id

    " mail_recipient = recipient_id

    " mail_sender = sender_id

    EXCEPTIONS

    formatting_error = 1

    internal_error = 2

    send_error = 3

    user_canceled = 4

    OTHERS = 5.

    2) call the function model via the first step.

    CALL FUNCTION fm_name

    EXPORTING

    control_parameters = control_parameters

    * output_options = ls_composer_param

    * user_settings = ''

    otry = ''

    IMPORTING

    * DOCUMENT_OUTPUT_INFO =

    job_output_info = ls_job_output_info

    TABLES

    gt_likp = gt_likp[]

    gt_lips = gt_lips[]

    EXCEPTIONS

    formatting_error = 1

    internal_error = 2

    send_error = 3

    user_canceled = 4.

    OPTIONAL STEP:


    CALL FUNCTION 'SSF_CLOSE'

    IMPORTING

    job_output_info = ls_job_output_info

    EXCEPTIONS

    formatting_error = 1

    internal_error = 2

    send_error = 3

    OTHERS = 4.

    3) Get filename

    CALL METHOD cl_gui_frontend_services=>file_open_dialog

    EXPORTING

    default_extension = 'PDF'

    default_filename = '*.PDF'

    file_filter = 'PDF Files (*.PDF)'

    multiselection = ' '

    CHANGING

    file_table = l_it_filetable

    rc = l_result.


    4) Convert to pdf

    CALL FUNCTION 'CONVERT_OTF_2_PDF'

    EXPORTING

    use_otf_mc_cmd = 'X'

    IMPORTING

    bin_filesize = l_file_size

    TABLES

    otf = ls_job_output_info-otfdata[]

    doctab_archive = lt_docs[])

    lines = lt_pdf[]

    EXCEPTIONS

    err_conv_not_possible = 1"PDF文件的具体内容(估计是二进制流)

    err_otf_mc_noendmarker = 2

    OTHERS = 3.

    5) save file

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    bin_filesize = l_file_size

    filename = filename

    filetype = c_bin

    TABLES

    data_tab = lt_pdf.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 29, 2013 at 05:49 AM

    When the function call for a smartform is over the OTF format is retrieved which is converted to PDF.Smartform is either displayed or Display suppressed but the OTF flag is passed so that the data is obtained in parameter job_output_info.

    The execution of the smartforms needs to be completed for the OTF,if there is any other way of obtaining the OTF at the end of smartform call ,then it may be possible..

    Adobe forms are another way of displaying the output as PDF option.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 31, 2013 at 01:01 PM

    Hi Ranjeet,

    Please Refer below screen screen shots it will generate your pdf output.

    you can simply download it.

    Please enter the below mentioned code ( PDF!) in the command field.

    You can download it as a pdf with in few step steps, here no need of doing code for PDF format.

    with Regards,

    Thangam.P


    pastedImage_0.png (11.1 kB)
    pastedImage_1.png (43.0 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.