2009 Oct 20 12:21 PM
Hi,
I'm using this code which I found in a previous thread to convert an ABAP spool to a pdf file.
The spool is created successfully as if I run my report in debug it outputs the spool to the screen and displays correctly.
When I run it as a background job the generated pdf has (roughly) the last third of each line truncated.
Any help appreciated.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
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.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
2009 Oct 21 8:29 AM
When you run in background, you specify a device for the spool output.
Does this device have a line length shorter than your output.
This would account for the difference from running in foreground/debug and running in backgound.
Hi,
I'm using this code which I found in a previous thread to convert an ABAP spool to a pdf file.
The spool is created successfully as if I run my report in debug it outputs the spool to the screen and displays correctly.
When I run it as a background job the generated pdf has (roughly) the last third of each line truncated.
Any help appreciated.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
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.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
2009 Oct 21 8:29 AM
When you run in background, you specify a device for the spool output.
Does this device have a line length shorter than your output.
This would account for the difference from running in foreground/debug and running in backgound.
2009 Oct 21 8:55 AM
Hi,
The device is set to 'LOCL' and the line length is being cut off at 112 chars.
Seems like a strange limit to have?
Rb
2009 Oct 21 9:25 AM
I've been doing some testing here, have you got a line-size parameter on your REPORT command in the ABAP. Have you set this large enough ?
Other than that, I would try using a defined printer rather than LOCL, as this uses your default windows printer and I'm not sure how that would be handled in a background job.
2009 Oct 21 9:33 AM
Thinking about it, you can use LOCL on the background job, but check the properties to ensure a format being used is one with sufficient column width.
2009 Oct 21 9:59 AM
It's happening on the write:/ statement.
The data in p_form-linda is correct but when I check what is written to the spool with write:/ it's been truncated.
This is before I try to convert to PDF.
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
write:/ p_form-linda.
endloop.
new-page .
commit work.
new-page print off.I've used the GET_PRINT_PARAMETERS before the code above to try and force a line size but still nothing....
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority = space
copies = '1'
line_size = '255'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
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 mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
endif.