Skip to Content
author's profile photo Former Member
Former Member

Smart form to PDF without a spool?

Hi

is it possible to convert the smartform output to a PDF document without creating a spool? if yes please let me know how to do it. IF any code is available that will be helpful.

~Suresh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 21, 2007 at 02:47 AM

    You can get the result of generated smartform in the OTF parameters.

    Than you can convert tha data to which can be used to send the mail from SO_SEND_OBJCET_API1.

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 02:48 AM

    Hi!

    All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:

    s_control_parameters-no_dialog = 'X'.

    s_control_parameters-getotf = 'X'.

    CALL FUNCTION v_func_name "call your smartform

    EXPORTING

    output_options = s_output_options

    control_parameters = s_control_parameters

    IMPORTING

    job_output_info = s_job_output_info

    call function 'CONVERT_OTF_2_PDF'

    tables

    otf = s_job_output_info-otfdata

    lines = t_pdf

    Hope this helps!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 04:17 AM

    Hi

    data:

    fm_name TYPE RS38L_FNAM, "Smart Forms: FM Name

    sf_name TYPE TDSFNAME

    value 'YOUR_FORM_NAME', "Smart Forms: Form Name

    P_OUTPUT_OPTIONS TYPE SSFCOMPOP,

    P_JOB_OUTPUT_INFO TYPE SSFCRESCL,

    P_CONTROL_PARAMETERS TYPE SSFCTRLOP,

    P_LANGUAGE TYPE SFLANGU value 'E',

    P_E_DEVTYPE TYPE RSPOPTYPE.

    data:

    P_BIN_FILESIZE TYPE I,

    P_BIN_FILE TYPE XSTRING,

    P_OTF type table of ITCOO,

    P_DOCS type table of DOCS,

    P_LINES type table of TLINE,

    name type string,

    path type string,

    fullpath type string,

    filter type string,

    guiobj type ref to cl_gui_frontend_services,

    uact type i,

    filename(128).

    *"----


    GET SMARTFORM FUNCTION MODULE NAME ---

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    FORMNAME = sf_name

    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 FUNCTION 'SSF_GET_DEVICE_TYPE'

    EXPORTING

    I_LANGUAGE = P_LANGUAGE

    I_APPLICATION = 'SAPDEFAULT'

    IMPORTING

    E_DEVTYPE = P_E_DEVTYPE.

    P_OUTPUT_OPTIONS-XSFCMODE = 'X'.

    P_OUTPUT_OPTIONS-XSF = SPACE.

    P_OUTPUT_OPTIONS-XDFCMODE = 'X'.

    P_OUTPUT_OPTIONS-XDF = SPACE.

    P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.

    P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

    P_CONTROL_PARAMETERS-GETOTF = 'X'.

    *

    ****...................................PRINTING.........................

    CALL FUNCTION fm_name

    EXPORTING

    CONTROL_PARAMETERS = P_CONTROL_PARAMETERS

    OUTPUT_OPTIONS = P_OUTPUT_OPTIONS

    • (....) <--- your form import parameters

    IMPORTING

    JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO.

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.

    <b>****...................................CONVERT TO PDF...............

    CALL FUNCTION 'CONVERT_OTF_2_PDF'

    IMPORTING

    BIN_FILESIZE = P_BIN_FILESIZE

    TABLES

    OTF = P_OTF

    DOCTAB_ARCHIVE = P_DOCS

    LINES = P_LINES

    EXCEPTIONS

    ERR_CONV_NOT_POSSIBLE = 1

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

    concatenate 'xxxx' '.pdf' into name.</b>

    ****..................................REQUEST FILE NAME.................

    create object guiobj.

    call method guiobj->file_save_dialog

    EXPORTING

    default_extension = 'pdf'

    default_file_name = name

    file_filter = filter

    CHANGING

    filename = name

    path = path

    fullpath = fullpath

    user_action = uact.

    if uact = guiobj->action_cancel.

    exit.

    endif.

    move fullpath to filename.

    ****..................................DOWNLOAD AS FILE................

    CALL FUNCTION 'WS_DOWNLOAD'

    EXPORTING

    BIN_FILESIZE = P_BIN_FILESIZE

    FILENAME = filename

    FILETYPE = 'BIN'

    TABLES

    DATA_TAB = P_LINES

    EXCEPTIONS

    FILE_OPEN_ERROR = 1

    FILE_WRITE_ERROR = 2

    INVALID_FILESIZE = 3

    INVALID_TYPE = 4

    NO_BATCH = 5

    UNKNOWN_ERROR = 6

    INVALID_TABLE_WIDTH = 7

    GUI_REFUSE_FILETRANSFER = 8

    CUSTOMER_ERROR = 9

    NO_AUTHORITY = 10

    OTHERS = 11.

    .

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    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.