on 08-31-2010 11:09 AM
Dear Experts;
I used FM RSPO_OUTPUT_SPOOL_REQUEST to print spool request. And the device type is a local pdf printer. By default, the download file name will be the spool id. How can I change the download file name? Thanks!
Convert 'CutePrinter' to qualify the format.
CALL FUNCTION 'CONVERSION_EXIT_SPDEV_INPUT'
EXPORTING
input = 'CutePrinter'
IMPORTING
output = lv_device.
Downloading as pdf by printer
CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
EXPORTING
device = lv_device
spool_request_id = pa_spool
EXCEPTIONS
archive_dest_invalid = 1
archive_dest_not_found = 2
archive_dest_no_right = 3
cannot_archive = 4
change_archdest_no_right = 5
change_copies_no_right = 6
change_dest_no_right = 7
change_devtype_no_right = 8
change_prio_no_right = 9
change_telenum_no_right = 10
change_title_no_right = 11
dest_invalid = 12
dest_not_found = 13
dest_no_right = 14
internal_problem = 15
invalid_fax_attribute = 16
invalid_parameters = 17
non_owner_no_right = 18
no_layout = 19
no_spool_request = 20
out_again_no_right = 21
spooler_problem = 22
OTHERS = 23
.
SELECT SINGLE * FROM tsp01 into rq WHERE rqident = p_spool .
* To get attributes of spool request
CALL FUNCTION 'RSPO_GET_ATTRIBUTES_SPOOLJOB'
EXPORTING
rqident = p_spool "Spool Request Number
IMPORTING
rq = rq "Consists the Spool Document Type Details
TABLES
attributes = dummy
EXCEPTIONS
no_such_job = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*Convert spool request into PDF, dependent on document type
IF rq-rqdoctype = 'OTF' OR rq-rqdoctype = 'SMART'. "Doc Type is of Sap Script or Smart form
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool "Spool Request Number
no_dialog = 'X'
pdf_destination = 'X'
no_background = 'X'
IMPORTING
pdf_bytecount = bin_size
bin_file = pdf_xstring "This fm will convert the spool data into
TABLES
pdf = it_pdf . "PDF Format in this importing string
ELSEIF rq-rqdoctype = 'LIST'. "Doc Type of List
* Convert spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool "Spool Request Number
no_dialog = ' '
dst_device = 'LOCL'
pdf_destination = 'X'
no_background = 'X'
IMPORTING
pdf_bytecount = bin_size
bin_file = pdf_xstring "This fm will convert the spool data into
"PDF Format in this importing string
TABLES
pdf = it_pdf.
ENDIF.
* Downloading file to p_file loation in PDF foramt
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_size
filename = w_filename "Custom File name
filetype = 'BIN'
TABLES
data_tab = it_pdf
Prabhudas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.