02-20-2010 8:41 AM
Dear Experts,
I have a requirement to convert SAP script output to PDF format and save the same to local sytem as well get print immediately as soon as user executes VL03N by choosing output type
I have developed a Script and converted the the output to PDF using FM 'CONVERT_OTF'.
using method cl_gui_frontend_services=>file_save_dialog for TAKING THE DOWNLOAD FILE PATH AS USER INPUT
using FM 'GUI_DOWNLOAD' for DOWNLOADING THE PDF DATA to local system.
with this I am able to save the document to local system with PDF format where as I am not getting hard copy print from the printer.
can any one tell me if I need to add anything else to get Save and Print the document immediately as soon as user chooses the path to save
Thanks in Advance
Venkat
02-20-2010 8:50 AM
You can do this by
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = 'AcroRd32.exe'
parameter = '/p /h C: est.pdf' .
or look into the class CL_GUI_PDFVIEWER and method PRINT
a®
02-20-2010 8:58 AM
02-20-2010 9:12 AM
Venkatesh,
The FM "GUI_DOWNLOAD" is just used to download and save the script. For printing the script you can use the following FM "OPEN_FORM" as
CALL FUNCTION 'OPEN_FORM'
EXPORTING FORM = SPACE
LANGUAGE = SY-LANGU
DEVICE = 'PRINTER'
DIALOG = 'X'
OPTIONS = SPACE
APPLICATION = 'TX'
ARCHIVE_INDEX = SPACE
ARCHIVE_PARAMS = SPACE
IMPORTING LANGUAGE =
RESULT =
NEW_ARCHIVE_PARAMS =
EXCEPTIONS CANCELED =
DEVICE =
FORM =
OPTIONS =
UNCLOSED =
If it doesn't work there might be a printer issue in your case.
Regards,
Pavan.
02-20-2010 10:15 AM
I have already used FMs as shown in the below order
OPEN_FORM
call function 'OPEN_FORM'
exporting
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
device = 'PRINTER'
dialog = 'X'
form = p_formname
language = SY-LANGU
options = struct
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
codepage = 11
others = 12
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " OPEN_FORM_NAST
START_FORM
WRITE_FORM
END_FORM
CLOSE_FORM
CONVERT_OTF
call method cl_gui_frontend_services=>file_save_dialog
GUI_DOWNLOAD
you mean I have to again call FM 'OPEN_FORM' to print is it?
02-20-2010 10:20 AM
My above mentioned 2 threads are for printing pdf from desktop
I think this will help you out.
a®
02-20-2010 10:35 AM
If you had already used it it should work. Try using it again, also check the printer settings or else there might be a printer issue.
let meknow if it wont work.
Regards,
Pavan.
02-27-2010 1:29 AM
It should save the document in PDF format and as well as it should print the document but this will save the document but not print the problem is not soved to get this instead I have given user a different option to print with this user agreed.
thanks for all your answers