cancel
Showing results for 
Search instead for 
Did you mean: 

smartform to pdf, some characters are corrupt

Former Member
0 Kudos

hi, i have a smartform. i can get the otf table representing the form. then i provide otf table to fm CONVERT_OTF and get pdf lines and finally i call WS_DOWNLOAD. following is my code:

call function 'CONVERT_OTF'
  EXPORTING
    FORMAT                = 'PDF'
  IMPORTING
    BIN_FILESIZE          = FILE_LEN
    bin_file              = pdf_file
  TABLES
    OTF                   = my_output_info-OTFDATA
    LINES                 = pdf_lines
  EXCEPTIONS
    ERR_MAX_LINEWIDTH     = 1
    ERR_FORMAT            = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS                = 4.

call function 'WS_DOWNLOAD'
  exporting
    bin_filesize = file_len
    filename      = 'mysmartform.pdf'
    filetype      = 'BIN'
*  importing
  tables
    data_tab = pdf_lines.

however, turkish characters are corrupt. how can i fix this?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hello friends, my problem is solved. i have installed foxit reader to display pdfs, and turkish characters now appear as expected. it was the 3rd party software which disfunctioned.

Former Member
0 Kudos

try using gui_download as ws_download is outdated.

regards,

srinivas

<b>*reward for useful answers*</b>

former_member196280
Active Contributor
0 Kudos

Try using the below function module

CALL FUNCTION 'CONVERT_OTF_2_PDF_ARCHIVELINK'

IMPORTING

PDF_BYTECOUNT = FILE_LEN

TABLES

OTF = my_output_info-OTFDATA

PDF = pdf_lines

EXCEPTIONS

PDF_CONVERSION_ERROR = 1

OTF_EMPTY = 2

OTF_CORRUPTED = 3

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

<b>ALSO use GUI_DOWNLOAD as WS_DOWNLOAD is Obsolete</b>

call method cl_gui_frontend_services=>gui_download

exporting

bin_filesize = file_len

filename = 'mysmartform.pdf'

filetype = 'BIN'

changing

data_tab = pdf_lines

exceptions

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

others = 22

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

Close the thread once your question is answered.

Regards,

SaiRam

Former Member
0 Kudos

thanks for the reply. i have tried the code Sai Ram Reddy Neelapu provided, it needs a few alterations for it to be syntactically correct, however i havent succeeded in correcting it. i have my_output_info-OFTDATA which is the table of lines of type ITCOO. itcoo has two fields in it, namely TDPRINTCOM (char length 2) and TDPRINTPAR (char length 70). On the other hand, fm 'CONVERT_OTF_2_PDF_ARCHIVELINK' asks for formal parameter OTFRAW which is an internal table having the structure TDOTFLO. this structure is declared as type RAW of length 72. the inner representation is of type X of length 72.

i need to make the conversion if i am to use fm CONVERT_OTF_2_PDF_ARCHIVELINK, or maybe there is a way of obtaining a valid value for the formal parameter OFTRAW of the fm? i assume if non-unicode chars are used then a character is one byte? and then in total 72 chars is 72 bytes, and type X of length 72 also sums up to 72 bytes? if so, then there is a hope of a conversion i guess. i tried to map the data of ITCOO (chars) to bytes but i failed. i still need help. thanks in advance.