cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using CONVERT_OTF to write PDF file to the fileshare

Former Member
0 Kudos

Hi All,

I am using 'CONVERT_OTF' function module to convert the OTF data to PDF.

Later I am using 'OPEN DATASET' IN BINARY MODE to open the file in the file share and write the PDF data to it.

The sample code goes like:

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = lv_filesize

TABLES

otf = lt_otfdata[]

lines = lt_lines[]

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5

.

IF sy-subrc <> 0.

MESSAGE i387 WITH text-028 sy-subrc.

ENDIF.

OPEN DATASET <file> FOR OUTPUT IN BINARY MODE .

*Write data to output file share.

LOOP AT lt_lines INTO wa_lines.

TRANSFER wa_lines TO lv_filename.

ENDLOOP.

*Close the file

CLOSE DATASET lv_filename.

When I try to open the file generated in the file share, I get an error 'Adobe Reader cannot open the file because it may not be a supported file type or the file may have been corrupted or damaged'.

When I download the file using 'GUI_DOWNLOAD' on my desktop, it works fine.

Please let me know if I am missing something in my code.

Thanks in advance,

RAVI

Edited by: Maruvada Ravi Kishore on Apr 7, 2009 10:56 AM

Edited by: Maruvada Ravi Kishore on Apr 7, 2009 10:57 AM

Edited by: Maruvada Ravi Kishore on Apr 7, 2009 11:01 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi ,

in loop do as follow:

data :adg_buffer type string.

  • Transfer the 132-long strings to 255-long strings

LOOP AT lt_lines INTO wa_lines.

TRANSLATE wa_lines USING ' ~'.

CONCATENATE GD_BUFFER wa_lines INTO GD_BUFFER.

ENDLOOP.

TRANSLATE GD_BUFFER USING '~ '.

transfer GD_BUFFER to lv_filename.

hope this solves your problem.

thanks,

anupama.

Former Member
0 Kudos

Hi Anupama,

I have coded the below lines as suggested.

data : gd_buffer type string.

  • Transfer the 132-long strings to 255-long strings

LOOP AT lt_lines INTO wa_lines.

TRANSLATE wa_lines USING ' ~'.

CONCATENATE GD_BUFFER wa_lines INTO GD_BUFFER.

ENDLOOP.

TRANSLATE GD_BUFFER USING '~ '.

TRANSFER GD_BUFFER to lv_filename.

But I still get the same error 'Adobe Reader cannot open the file because it may not be a supported file type or the file may have been corrupted or damaged'.

Thanks,

RAVI

Former Member
0 Kudos

hi ravi,

try to use other options with

OPEN DATASET <file> FOR OUTPUT IN BINARY MODE encoding UTF-8 WITH BYTE-ORDER MARK.

or try with other options as well.

thanks,

anupama

former_member205763
Active Contributor
0 Kudos

Can u tell how lv_filename