2005 Dec 14 8:21 AM
Is it possible to download a SAP Script output to PDF. If yes how can I do it.
Please help.
Regards
Binoo
2005 Dec 14 8:31 AM
Hi!
Proceed as follows:
1. Get SAP Script output in OTF-format:
...
options-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
options = options
...
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
otfdata = it_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
OTHERS = 5.
2. Then convert it to PDF:
DATA:
it_pdf LIKE tline OCCURS 100 WITH HEADER LINE,
v_len_in LIKE sood-objlen.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
IMPORTING
bin_filesize = v_len_in
TABLES
otf = it_otf
lines = it_pdf
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4
.
Now it_pdf contains binary data for PDF-document of SAP Script. You can download it to frontend (application server) or send as mail attachment accordingly.
Regards,
Maxim.
Is it possible to download a SAP Script output to PDF. If yes how can I do it.
Please help.
Regards
Binoo
2005 Dec 14 8:24 AM
Hi,
Look at the code....
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
************
Have a look at these FM also
CONVERT_OTFSPOOLJOB_2_PDF ==== converts a OTF spool to PDF (i.e. Sapscript document)
SX_OBJECT_CONVERT_OTF_PDF ==== Conversion From OTF to PDF (SAPScript conversion)
Thanks.
If this helps you reward with points.
2005 Dec 14 8:29 AM
Hai Deepak,
Can you please exlain a little more.
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
what is the type of i_otf,i_content_txt.
what is the data inside it and how is it populated.
what is c_otf ,c_pdf ,w_transfer_bin,i_content_bin used in the FM
Please reply.I will surely reward points
Binoo
2005 Dec 14 8:28 AM
2005 Dec 14 8:29 AM
2005 Dec 14 8:30 AM
2005 Dec 14 8:31 AM
Hi!
Proceed as follows:
1. Get SAP Script output in OTF-format:
...
options-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
options = options
...
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
otfdata = it_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
OTHERS = 5.
2. Then convert it to PDF:
DATA:
it_pdf LIKE tline OCCURS 100 WITH HEADER LINE,
v_len_in LIKE sood-objlen.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
IMPORTING
bin_filesize = v_len_in
TABLES
otf = it_otf
lines = it_pdf
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4
.
Now it_pdf contains binary data for PDF-document of SAP Script. You can download it to frontend (application server) or send as mail attachment accordingly.
Regards,
Maxim.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |