Skip to Content
avatar image
Former Member

Smartforms - formatting error

Hi guru's

                While execting smartform from driver program its working properly.

but  while calling smartform from webdynpro by using fucction module name  its turns to formattiing error in sy-subrc.

Is any settings need to do?

Regards,

Meena

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jun 06, 2012 at 07:46 PM

    May be this helps you:

    Call the Smartform FM to get the output of the form.

    Convert the form output in PDF form. Use FM 'CONVERT_TO_OTF'.

    Bind this PDF data to context element.

    On WD view layout, set the interactive form UI element.

    Bind this UI element with the context element to which PDF source was mapped.

    Save and activate.

    Example Code:

    method displaypdf .

    data : l_x(1) value 'X'.

    data: lv_text type char3,

    lv_syucomm type char1,

    ls_pdf type xstring,

    lv_fm_name type rs38l_fnam,

    lv_control_parameters type ssfctrlop,

    lv_output_options type ssfcompop,

    lv_ssf_output type ssfcrescl,

    lt_otfdata type table of itcoo.

    data:

    node_input1 type ref to if_wd_context_node,

    elem_input1 type ref to

    if_wd_context_element,

    stru_input1 type

    ig_componentcontroller=>element_zinput.

    * navigate from <CONTEXT> to <INPUT1> via lead selection

    node_input1 = wd_context->get_child_node( name

    ig_componentcontroller=>wdctx_zinput ).

    * get element via lead selection

    elem_input1 = node_input1->get_element( ).

    * get all declared attributes

    elem_input1->get_static_attributes(

    importing

    static_attributes = stru_input1 ).

    call function 'SSF_FUNCTION_MODULE_NAME'

    exporting

    formname = 'ZSMARTFORM_NAME'

    importing

    fm_name = lv_fm_name

    exceptions

    no_form = 1

    no_function_module = 2

    others = 3

    .

    if sy-subrc <> 0.

    * Error MESSAGE

    endif.

    * Set relevant control parameters

    lv_control_parameters-getotf = l_x. "OTF output

    lv_control_parameters-no_dialog = l_x. "No print dialog

    lv_control_parameters-preview = space. "No preview

    * Set relevant output options

    lv_output_options-tdnewid = l_x. "Print parameters,

    lv_output_options-tddelete = space. "Print parameters,

    call function lv_fm_name

    exporting

    * ARCHIVE_INDEX * ARCHIVE_INDEX_TAB *

    ARCHIVE_PARAMETERS control_parameters = lv_control_parameters

    * MAIL_APPL_OBJ * MAIL_RECIPIENT * MAIL_SENDER

    output_options = lv_output_options

    user_settings = space

    pernr = stru_input1-zpernr

    reinr = stru_input1-zreinr

    pdvrs = stru_input1-zpdvrs

    importing

    * DOCUMENT_OUTPUT_INFO job_output_info = lv_ssf_output

    * JOB_OUTPUT_OPTIONS 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.

    refresh lt_otfdata.

    lt_otfdata[] = lv_ssf_output-otfdata[].

    call function 'SSFCOMP_PDF_PREVIEW'

    exporting

    i_otf = lt_otfdata

    exceptions

    convert_otf_to_pdf_error = 1

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

    data: l_dummy type standard table of tline,

    pdf_data type xstring,

    pdf_size type i.

    clear: pdf_data, pdf_size.

    * convert otf to pdf

    call function 'CONVERT_OTF'

    exporting

    format = 'PDF'

    importing

    bin_filesize = pdf_size

    bin_file = pdf_data

    tables

    otf = lt_otfdata[]

    lines = l_dummy

    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.

    data:

    node_pdf type ref to if_wd_context_node,

    elem_pdf type ref to

    if_wd_context_element,

    stru_pdf type

    if_componentcontroller=>element_pdf ,

    item_source like stru_pdf-source.

    * navigate from <CONTEXT> to <PDF> via lead selection

    node_pdf = wd_context->get_child_node( name if_componentcontroller=>wdctx_pdf ).

    * get element via lead selection

    elem_pdf = node_pdf->get_element( ).

    * set single attribute

    elem_pdf->set_attribute(

    exporting

    name = `SOURCE`

    value = pdf_data ).

    endmethod.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 07, 2012 at 04:36 AM

    Hi,

    Check whether the below link helps.

    http://scn.sap.com/docs/DOC-25759

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 20, 2012 at 06:46 AM

    Hi Meena,

        There is setting we need to do in SU01.

          Try to maintain default output device for the user who is running that WD.

    Thanks,

    Vengadesh R

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 20, 2012 at 02:42 PM

    Hi Meena,

    "its turns to formattiing error in sy-subrc."

    It's not clear where in your code the error occurs. Could you please post the code that returns a non-zero sy-subrc value and also let us know what is the value of sy-subrc?

    Also, please take a look at the document Opening a Smartform in Web Dynpro ABAP.

    Cheers,

    Amy

    Add comment
    10|10000 characters needed characters exceeded