07-28-2008 9:12 PM
Hello All,
Please, I need to generate a PDF file from a spool number, I'm trying to use the function 'CONVERT_ABAPSPOOLJOB_2_PDF', but it isn't working properly.
Somebody has a example code?
I need to change the printer button command and change the command of printer menu, for generate a PDF file directly when the user click in printer button or acess printer menu (Ctrl+P)...
I need to know how to generate this PDF file.
For example, the user generate the report normaly and after that if it clicks on printer button o select printer command on menu, this report will be converted in a PDF file.
Somebody could help me please?
Or somebody has a example code?
Thank you in advance for your colaboration.
Fernando Pena.
07-28-2008 9:16 PM
Try the std. prog RSTXPDFT4 for generating pdf from spool.
Regards,
joy.
07-28-2008 9:18 PM
Yes, I treid that, but without sucessfuly...
I need to change printer commands...
Thank you...
07-28-2008 9:19 PM
steps.
1. you need to generate the spool. Programatically we can generate the spool.
'CONVERT_ABAPSPOOLJOB_2_PDF'
2. using the spool number you have to get the pdf using the stated functionmodule.
3. Download that pdf data using GUI_DOWNLOD and check
07-28-2008 9:23 PM
Thanks for the information...
How can I generate the spool programaticaly?
Thanks again...
Fernando
07-28-2008 9:33 PM
>
> Thanks for the information...
>
> How can I generate the spool programaticaly?
>
> Thanks again...
>
> Fernando
using GET_PRINT_PARAMETERS Get the print parameters, now using
options 1.
new-page print on prams.......
"call write statements or alv functions for display.
new-page print off.
option 2.
using submit option.
07-28-2008 9:24 PM
Hi,
More or less like this:
parameters:spool like sy-spono.
spool_number = spool.
DATA:REAL_TYPE LIKE SOODK-OBJTP.
DATA:BUFFER_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = spool_number
desired_type = 'RAW'
IMPORTING
REAL_TYPE = REAL_TYPE
TABLES
buffer = contents_bin
BUFFER_PDF = BUFFER_PDF
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
others = 8.
*clear contents_bin[].
if sy-subrc <> 0.
message e105 with 'RSPO_RETURN_SPOOLJOB'.
endif.
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = contents_bin
objcont_new = contents_bin
EXCEPTIONS
others = 0.
data:TRANSFER_BIN TYPE SX_BOOLEAN." occurs 0.
data:CONTENT_BIN TYPE SOLIX_TAB." occurs 0.
data:OBJHEAD TYPE SOLI_TAB.
data:LEN TYPE SO_OBJ_LEN.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
devtype = 'PRINTER'
CHANGING
TRANSFER_BIN = TRANSFER_BIN
CONTENT_TXT = contents_bin
CONTENT_BIN = contents_hex
OBJHEAD = OBJHEAD
LEN = len.
OPEN DATASET filename IN BINARY MODE FOR OUTPUT.
LOOP AT contents_bin.
TRANSFER contents_bin TO filename.
ENDLOOP.
CLOSE DATASET filename.
08-01-2008 6:28 PM
08-01-2008 7:26 PM
Hi,
you need to call WS_DOWNLOAD after calling 'CONVERT_ABAPSPOOLJOB_2_PDF'.
For e.g.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = 'C:/test_spool.pdf ' <<<<<<<<------Give file name here
FILETYPE = 'BIN'
TABLES
DATA_TAB = t_xi_pdf
Please Reward if you find the answer useful.
Thanks,
Kamesh Bathla
Edited by: Kamesh Bathla on Aug 1, 2008 8:27 PM