2014 Apr 15 2:32 AM
Hi Experts,
I am converting smartforms into pdf and try to send to application server but file is corrupted and cannot open.
The code is as follows
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = W_bin_filesize
BIN_FILE = l_pdf_xstring
TABLES
otf = T_OTF
lines = T_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF W_bin_filesize > 0.
OPEN DATASET p_filein FOR OUTPUT IN BINARY MODE.
transfer l_pdf_xstring to p_filein.
close dataset p_fielin.
endif.
Please advise how to get the correct file.
Thanks in advance.
Warm regards
Chandra
Hi Experts,
I am converting smartforms into pdf and try to send to application server but file is corrupted and cannot open.
The code is as follows
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = W_bin_filesize
BIN_FILE = l_pdf_xstring
TABLES
otf = T_OTF
lines = T_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF W_bin_filesize > 0.
OPEN DATASET p_filein FOR OUTPUT IN BINARY MODE.
transfer l_pdf_xstring to p_filein.
close dataset p_fielin.
endif.
Please advise how to get the correct file.
Thanks in advance.
Warm regards
Chandra
2014 Apr 15 3:25 AM
hi Chandra
You should use the internal table T_PDF_TAB not I_PDF_XSTRING.
loop at T_PDF_TAB.
transfer T_PDF_TAB-field to p_filein.
endloop.
regards,
Archer
2014 Apr 15 5:25 AM
Hi Archer,
Thanks for the quick update. Again error in opening the PDF file and message displayed the file is corrupted.
Please advise.
Warm regards
Chandra
2014 Apr 15 7:37 AM
Try this function SX_OBJECT_CONVERT_OTF_PDF, and you will get the PDF data in Binary Content in Changing parameter Content_bin.
BTW, you can sure T_OTF have data, right?
regards,
Archer
2014 Apr 15 3:48 AM
2014 Apr 15 5:26 AM
Hi Wen,
I looked at the note but no joy!.
Please advise.
Warm regards
Chandra
2014 Apr 15 12:09 PM
Hello
You need to call Fucntion module convert_otf.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
bin_filesize = lv_bin_filesize
bin_file = lv_pdf
TABLES
otf = ls_otfdata-otfdata[]
lines = lv_bin_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
After calling this FM call FM 'SX_OBJECT_CONVERT_OTF_PDF' which will convert into pdf file.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = 'OTF'
format_dst = 'PDF'
DEVTYPE = 'PRINTER'
CHANGING
transfer_bin = t_transfer
content_txt = it_otf_data
content_bin = it_objhx
objhead = it_objhead
len = psize
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2 .
Please try with this.
2014 Apr 16 2:10 AM
Hi Neha,
Thanks for your response. Now getting the contents in binary format. The it_objhx which is of type solix_tab needs to be transferred to server. But this must be converted into internal table and loop through to transfer to server.
Could you please advise how this it_objhx contents can be put into internal table.
Thanks in advance.
Warm regards
Chandra
2014 Apr 18 6:56 AM
Hi Chandra
You need to call fucntion module 'SO_SOLIXTAB_TO_SOLITAB' to convert the contents.
CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'
EXPORTING
ip_solixtab = it_objhx
IMPORTING
EP_SOLITAB = lt_objcont .
Send lt_objcont to the swerver.
This will work for you.
Best Regards,
Neha