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

Convert Smartform Output to PDF

Hi all,

I am trying to save Output of Smartform in PDF file format. for that purpose i am calling "CONVERT_OTF" FM from my driver program.

But it is giving me <b>Information "OTF end command // missing in OTF data"</b>

while executing FM "CONVERT_OTF". i debug it it is giving Sy-subrc = 2.

Please Help me in this context. I am also givin code of my driver program:

TABLES: vbrp.

DATA: fm_name TYPE rs38l_fnam,

it_invoice TYPE STANDARD TABLE OF vbrp,

it_invoice_wa TYPE vbrp,

it_inv TYPE STANDARD TABLE OF vbrp,

it_inv_wa TYPE vbrp,

invoice_no(25) TYPE c,

invoice_l(10) TYPE c,

invoice_h(10) TYPE c.

  • Converting Output to PDF Declaration **********

DATA: tab_otf_data TYPE ssfcrescl,

pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,

bin_filesize LIKE sood-objlen,

outop TYPE ssfcompop, " Output Parameters

cparam TYPE ssfctrlop, " Control Parameters

tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,

my_tabix TYPE sy-tabix,

file_size TYPE i.

SELECT-OPTIONS doc_no FOR vbrp-vbeln.

SELECT vbeln posnr fkimg vrkme meins netwr matnr

FROM vbrp INTO CORRESPONDING FIELDS

OF TABLE it_invoice

WHERE vbeln IN doc_no.

  • Inserting Unique Invoice Numbers for Displaying Individual Details in

  • Smart Form

LOOP AT it_invoice INTO it_invoice_wa.

AT NEW vbeln.

MOVE it_invoice_wa-vbeln TO it_inv_wa-vbeln.

APPEND it_inv_wa TO it_inv.

ENDAT.

ENDLOOP.

invoice_no = doc_no.

invoice_l = doc_no-low.

invoice_h = doc_no-high.

  • suppressing the Print dialog box *********************

*outop-tddest = 'locl'.

*cparam-no_dialog = 'X'.

*cparam-preview = space.

*cparam-getotf = 'X'.

START-OF-SELECTION.

  • Calling Smart Form *********************************

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSB_SMARTFORM_INVOICE'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = fm_name

.

CALL FUNCTION fm_name

EXPORTING

invoice_no_h = invoice_h

invoice_no_l = invoice_l

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • control_parameters = cparam

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • output_options = outop

  • user_settings = ''

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = tab_otf_data

  • JOB_OUTPUT_OPTIONS =

TABLES

it_invoice = it_invoice

it_inv = it_inv

.

*

***removing the initial and final markers from the OTF data*********

  • DELETE tab_otf_data-otfdata WHERE tdprintcom = '//'.

  • searching for the end-of-page in OTF table************

  • READ TABLE tab_otf_final WITH KEY tdprintcom = 'EP'.

  • my_tabix = sy-tabix + 1.

    • appending the modified OTF table to the final OTF table****

    *INSERT LINES OF tab_otf_data-otfdata INTO tab_otf_final INDEX my_tabix.

    tab_otf_final[] = tab_otf_data-otfdata[].

    CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

    format = 'PDF'

    max_linewidth = 132

    • ARCHIVE_INDEX = ' '

    • COPYNUMBER = 0

    • ASCII_BIDI_VIS2LOG = ' '

    IMPORTING

    bin_filesize = bin_filesize

    • BIN_FILE =

    TABLES

    otf = tab_otf_final

    lines = pdf_tab

    • EXCEPTIONS

    • ERR_MAX_LINEWIDTH = 1

    • ERR_FORMAT = 2

    • ERR_CONV_NOT_POSSIBLE = 3

    • ERR_BAD_OTF = 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.

    write :/ bin_filesize.

    *

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    • BIN_FILESIZE = bin_filesize

    filename = 'E:/Test.pdf'

    FILETYPE = 'ASC'

    IMPORTING

    FILELENGTH = file_size

    tables

    data_tab = pdf_tab

    • FIELDNAMES =

    .

    Help will be rewarded.

    Regards,

    Sachin

    Add a comment
    10|10000 characters needed characters exceeded

    Assigned Tags

    Related questions

    2 Answers

    • author's profile photo Former Member
      Former Member
      Posted on Oct 08, 2007 at 02:40 PM

      Hi,

      SmartForms Output to PDF

      There is a way to download smartform in PDF format.

      Please do the following:

      1. Print the smartform to the spool.

      2. Note the spool number.

      3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the

      noted spool number.

      Regards,

      Bhaskar

      Add a comment
      10|10000 characters needed characters exceeded

    • author's profile photo Former Member
      Former Member
      Posted on Oct 09, 2007 at 04:09 AM

      Hi all,

      Problem is solved using by using FM <b>CONVERT_OTF_2_PDF</b> and

      <b>guiobj</b> Object.

      thanx all.

      Regards,

      Sachin.

      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.