cancel
Showing results for 
Search instead for 
Did you mean: 

use 'convert_otf', but the output table of lines is empty, why?

Former Member
0 Kudos

Hello experts,

I am trying to use the function 'convert_otf' to convert smartforms into pdf. But the output table of lines is empty´.

*   Convert OTF into PDF
CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format                = 'PDF'
*    max_linewidth         = 132
  IMPORTING
    bin_filesize          = lv_bytes
    bin_file              = bin_file
  TABLES
    otf                   = gt_otfdata
    lines                 = gt_pdfdata
  EXCEPTIONS
    err_max_linewidth     = 1
    err_format            = 2
    err_conv_not_possible = 3
    OTHERS                = 4.

Before calling this function the parameter value are like following:

LV_BYTES: 0
BIN_FILE: 
GT_OTFDATA: Standard Table[15x2(144)
GT_PDFDATA: Standard Table[0x2(268)]

After this function is called, the parameter value are like this:

LV_BYTES: 1774
BIN_FILE:  255044462D312E330D0A2...
GT_OTFDATA: Standard Table[15x2(144)
GT_PDFDATA: Standard Table[0x2(268)]

It looks that there is output for table lines. For download this pdf I have to get a table of pdf data.

What could be the reason for this?

Thank you.

Rujing

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

if u r using Convert_otf then the pdf output is returned to u either as binary string (parameter BIN_FILE) or as a character table (parameter Lines), so comment BIN_FILE and u'll get data in gt_pdfdata

кu03B1ятu03B9к

Former Member
0 Kudos

Katrik,

Thank you very much.

What you've said is exactly the cause.

Rujing.

Answers (2)

Answers (2)

Former Member
0 Kudos

See if the below code I did some time back is helpful :

  • call the FM to return the Smartform function module

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZOL_WATER_PLANT_WEEKLY'

IMPORTING

fm_name = lf_formname

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

  • pass data to the smartform

IF sy-subrc = 0.

ls_ctrlop-getotf = 'X'.

ls_ctrlop-no_dialog = 'X'.

ls_compop-tddest = 'LP01'.

  • ls_compop-tdnoprev = 'X'.

CALL FUNCTION lf_formname

EXPORTING

control_parameters = ls_ctrlop

output_options = ls_compop

user_settings = ' '

gf_date_fr = lf_date_fr

gf_date_to = lf_date_to

gf_datum = lf_datum

IMPORTING

job_output_info = ls_return

TABLES

gt_finaldata = gt_finaldata

gt_event = gt_fin_evnt

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.

ELSE.

LOOP AT ls_return-otfdata INTO wa_otf.

APPEND wa_otf TO int_otf.

ENDLOOP.

CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'

EXPORTING

format_src = 'OTF'

format_dst = 'PDF'

devtype = 'PDF1'

CHANGING

transfer_bin = int_bin

content_txt = int_otf

content_bin = int_pdfx

objhead = int_header

len = wf_len

EXCEPTIONS

err_conv_failed = 1

OTHERS = 2.

Mathews

Former Member
0 Kudos

Hi,

How are you filling the OTF table?

I use this function with the result of a smartform function and the PDF table is filled.

In this case, you have to call the smartforms with the parameter control_parameters-getotf = 'X' and the function returns the OTF data into the table job_output_info-otfdata.