Posted: Sat Sep 15, 2007 9:18 pm Post subject: Convert spool to PDF format and download as PC file or Unix
Convert spool to PDF format and download as PC file or Unix dataset
Code:
report z.
data: w_ident like tsp01-rqident,
w_doctype like tsp01-rqdoctype,
w_bytecount type i.
data: itab_pdf like tline occurs 0 with header line.
parameter spoolnum like tsp01-rqident obligatory.
selection-screen begin of block a2 with frame.
parameters: to_pc radiobutton group a2 default 'X',
pcfile like rlgrap-filename lower case,
to_unix radiobutton group a2,
unixfile(255) lower case.
selection-screen end of block a2.
********************************
at selection-screen on block a2.
********************************
if to_pc = 'X' and pcfile is initial.
message e398(00) with 'Enter PC File Name.'.
elseif to_unix = 'X' and unixfile is initial.
message e398(00) with 'Enter Unix File Name.'.
endif.
*******************************
at selection-screen on spoolnum.
*******************************
select single rqident rqdoctype
into (w_ident, w_doctype)
from tsp01
where rqident = spoolnum.
if sy-subrc ne 0.
message e398(00) with 'Spool' spoolnum 'not found'.
endif.
************************************************
at selection-screen on value-request for pcfile.
************************************************
call function 'WS_FILENAME_GET'
exporting
mask = ',*.*,*.*.'
importing
filename = pcfile
exceptions
others = 1.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
************************************************************************
form write_pdf_spool_to_unix.
open dataset unixfile for output in binary mode.
if sy-subrc ne 0 .
message e398(00) with 'Cannot open unix file for output:' unixfile.
endif.
loop at itab_pdf.
transfer itab_pdf to unixfile.
if sy-subrc ne 0 .
message e398(00) with 'Cannot write to unix file:' unixfile.
endif.
endloop.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.