‎2007 Feb 13 5:26 AM
Hi all,
i am downloading spool data using the function module CONVERT_ABAPSPOOLJOB_2_PDF. But i am facing layout problem. e.g. RFBILA00(financial statement generation program) has written balancesheet data to the spool. This spool data has some 6 columns. but CONVERT_ABAPSPOOLJOB_2_PDF is writing only first 3 columns to the generated PDF file. i used 'GET_PRINT_PARAMETERS' function module also with values like layout as 'X_65_132' and 'X_90_120'. but no success. if anybody knows the answer, please let me know.
Thanks in advance,
Naveen
‎2007 Feb 13 5:42 AM
Hi Naveen,
Try this funcation module to convert output to pdf:
CONVERT_OTF.
OR
CONVERT_OTF_2_PDF
Reward points if helpful answer.
Ashvender
‎2007 Feb 13 5:47 AM
Hi
use convert_otf_2_pdf.
U can design ur own layouts using SFP transaction code.
Regards,
kumar
‎2007 Feb 13 6:05 AM
Hi,
see below code
data: ctrlparams type ssfctrlop.
data: fm_name type rs38l_fnam,
fname type string value 'c:\reportpdf.pdf',
bin_size type i,
joboutput type ssfcrescl,
it_result like table of itcoo,"JOBOUTPUT-OTFDATA
otf like table of itcoo,
doc like table of docs,
tlines like table of tline.
data: begin of struct occurs 0.
include structure spfli.
data: end of struct.
data: itab like table of struct with header line.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSIVA_SMARTFORMS'
FORMNAME = 'SF_TOTALS'
importing
fm_name = fm_name
.
if sy-subrc <> 0.
endif.
ctrlparams-getotf = 'X'.
call function fm_name
exporting
control_parameters = ctrlparams
importing
job_output_info = joboutput
tables
itab = itab.
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
*
*IF SY-SUBRC <> 0.
*
*ENDIF.
call function 'CONVERT_OTF_2_PDF'
importing
bin_filesize = bin_size
tables
otf = joboutput-otfdata[] "otf
\
doctab_archive = doc
lines = tlines
.
call function 'GUI_DOWNLOAD'
exporting
bin_filesize = bin_size
filename = 'C:\siva\test.pdf'
filetype = 'BIN'
tables
data_tab = tlines.
* Open PDF
data: program like soxpc-path.
call function 'SO_PROGNAME_GET_WITH_PATH'
exporting
doctype = 'PDF'
importing
pathname = program
exceptions
path_not_found = 1
program_not_found = 2
no_batch = 3
x_error = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*
call function 'WS_EXECUTE'
exporting
commandline = 'C:\siva\test.pdf'
program = program
exceptions
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
gui_refuse_execute = 5
others = 6.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
reward if useful
‎2007 Feb 13 6:43 AM
Hi all,
thanks for your replies. But function modules CONVERT_OTF_2_PDF or CONVERT_OTFSPOOLJOB_2_PDF will not work in my case as I am getting error like 'there is no OTF data'. my requirement is to download spool data written by a simple ABAP program. e.g.: 'RFBILA00' program is writing results in ALV list format to the spool. i have to download this information in PDF format.
Regards,
Naveen
‎2007 Feb 13 9:25 AM
Hi All,
i am following the below approach to download the information from spool.
program/spool output is an ALV List output data having 8 columns. but below approach is converting only first 5 columns in to PDF format. other 3 columns are getting truncated.
*"----
FUNCTION /ngl/download_spoolinfo_as_pdf.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(I_SPOOL_REQUEST) LIKE TSP01-RQIDENT
*" REFERENCE(I_FILENAME) LIKE RLGRAP-FILENAME
*" EXCEPTIONS
*" DOWNLOAD_ERROR
*"----
TABLES tsp01.
DATA: mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
mc_filename LIKE rlgrap-filename.
DATA: mstr_print_parms LIKE pri_params,
mc_valid(1) TYPE c,
mi_bytecount TYPE i.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
copies = '1'
cover_page = space
destination = 'locl'
expiration = '1'
immediately = space
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
line_size = 200
line_count = 65
layout = 'X_65_200'
layout = 'X_90_120'
sap_cover_page = 'X'
IMPORTING
out_parameters = mstr_print_parms
valid = mc_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool_request
no_dialog = 'X'
dst_device = mstr_print_parms-pdest
IMPORTING
pdf_bytecount = mi_bytecount
TABLES
pdf = mtab_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
IF sy-subrc EQ 0.
mc_filename = i_filename.
DATA: lv_filename TYPE string.
lv_filename = i_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = mi_bytecount
filename = lv_filename
filetype = 'BIN'
TABLES
data_tab = mtab_pdf
EXCEPTIONS
OTHERS = 22.
IF sy-subrc EQ 0.
WRITE:/ mc_filename, 'CONVERTED TO PDF AND DOWNLOADED'.
ELSE.
WRITE:/ 'PROBLEM WITH DOWNLOAD'.
RAISE download_error.
ENDIF.
ELSE.
WRITE:/ 'PROBLEM WITH PDF CONVERSION'.
RAISE download_error.
ENDIF.
ELSE.
WRITE:/ 'PROBLEM GETTING PRINT PARAMETERS'.
RAISE download_error.
ENDIF.
ENDFUNCTION.