Skip to Content
author's profile photo
Former Member

How to Convert Smartform to Spool

Hi All,

I want to Convert "Smartform ->Spool ->PDF"

I know converting Spool-->PDF but i don't know how Smartform to be converted to spool.

Can anyone send me an example program for the whole process i.e, "Smartform ->Spool ->PDF"

Regards,

Adithya M.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 07:17 PM

    Hi Adithya,

    It's very easy. Just go through this....Copy this code and change form name to ur form name, call the function module generated by your smartform and provide the parameters as shown below. That's it you'll get a PDF in the directory specified in 'GUI_DOWNLOAD'. <b>Donot forget to give points</b>

    (only code specific to PDF conversion is given.you should populate your own data and trigger smartform)

    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

    i_tline TYPE TABLE OF tline WITH HEADER LINE,

    • Work Area declarations

    w_ctrlop TYPE ssfctrlop,

    w_compop TYPE ssfcompop,

    w_return TYPE ssfcrescl,

    • Variables declarations

    v_form_name TYPE rs38l_fnam,

    v_len_in LIKE sood-objlen,

    v_len_out LIKE sood-objlen,

    binfilesize TYPE i.

    *Get Smartform functionmodule name

    call function 'SSF_FUNCTION_MODULE_NAME'

    exporting

    formname = 'ZZZ_TEST2'

    importing

    fm_name = v_form_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.

    *Set control parameters and output optons

    w_ctrlop-getotf = 'X'.

    w_ctrlop-no_dialog = 'X'.

    w_compop-tdnoprev = 'X'.

    *Call smartform

    CALL FUNCTION v_form_name

    EXPORTING

    control_parameters = w_ctrlop

    output_options = w_compop

    user_settings = 'X'

    IMPORTING

    job_output_info = w_return

    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.

    i_otf[] = w_return-otfdata[].

    *Convert OTF to PDF

    CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

    format = 'PDF'

    max_linewidth = 132

    IMPORTING

    bin_filesize = v_len_in

    TABLES

    otf = i_otf

    lines = i_tline

    EXCEPTIONS

    err_max_linewidth = 1

    err_format = 2

    err_conv_not_possible = 3

    OTHERS = 4.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    *Download PDF File

    call function 'GUI_DOWNLOAD'

    exporting

    bin_filesize = binfilesize

    filename = 'D:/test.pdf' "Give yor own path here

    filetype = 'BIN'

    tables

    data_tab = i_tline.

    regards,

    Ravi Valluri.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 20, 2007 at 05:52 PM

    You will automatically get the spool if you run the smartform driver in background mode.

    Then you can submit the report RSTXPDFT4 to convert the spool to pdf.

    The function module CONVERT_OTFSPOOLJOB_2_PDF helps.

    Regards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 21, 2007 at 03:31 AM

    Check this....

    Rough idea

    **Set printer parameters

    control_param-no_dialog = 'X'.

    control_param-preview = ''.

    control_param-getotf = 'X'.

    output_opt-tddest = 'LOCL'.

    output_opt-tdimmed = ''.

    output_opt-tdnewid = ''.

    output_opt-tdnoprint = ''.

    output_opt-tdnoprev = 'X'.

        • Get smartform name

        call function 'SSF_FUNCTION_MODULE_NAME'

        EXPORTING

        formname = formname

        variant = ' '

        direct_call = ' '

        IMPORTING

        fm_name = 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.

        Call smartform

        call function fm_name

        EXPORTING

        control_parameters = control_param

        output_options = output_opt

        user_settings = ' '

        wa_head = wa_head

        IMPORTING

        job_output_info = job_info

        TABLES

        int_detail = int_detail

        EXCEPTIONS

        formatting_error = 1

        internal_error = 2

        send_error = 3

        user_canceled = 4

        others = 5.

        Note pass the job info file you got from above function module

        data: int_docs type standard table of docs,

        int_line type standard table of tline.

        call function 'CONVERT_OTF_2_PDF'

        IMPORTING

        bin_filesize = filesize

        TABLES

        otf = job_info-otfdata

        doctab_archive = int_docs

        lines = int_line

        EXCEPTIONS

        err_conv_not_possible = 1

        err_otf_mc_noendmarker = 2

        others = 3.

        USE below function module

        all method cl_gui_frontend_services=>gui_download

        exporting

        bin_filesize = filesize

        filename = filename

        filetype = 'BIN'

        changing

        data_tab = int_line

        Regards,

        SaiRam

        Add comment
        10|10000 characters needed characters exceeded