Code: Alles auswählen.
DATA: lv_dest TYPE sypri_pdest,
lv_spool_handle TYPE i,
lv_spoolid TYPE tsp01-rqident,
lt_bin TYPE TABLE OF rspolpbi.
DATA(lv_filesize) = xstrlen( iv_pdf ).
DATA(lv_pages) = get_number_of_pages( iv_pdf ).
lv_dest = p_dest.
CALL FUNCTION 'RSPO_SR_OPEN'
EXPORTING
dest = lv_dest
layout = 'G_RAW'
suffix1 = 'PDF'
suffix2 = sy-uname
immediate_print = abap_false
auto_delete = abap_true
doctype = 'BIN'
IMPORTING
handle = lv_spool_handle
spoolid = lv_spoolid
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
"Errorhandling
ENDIF.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = iv_pdf
TABLES
binary_tab = lt_bin.
CALL FUNCTION 'RSPO_SR_TABLE_WRITE_BINARY'
EXPORTING
handle = lv_spool_handle
total = lv_filesize
TABLES
lines = lt_bin
EXCEPTIONS
handle_not_valid = 1
operation_failed = 2
OTHERS = 3.
IF sy-subrc <> 0.
"Errorhandling
ENDIF.
lv_pages = 1. "Zu Testzwecken
CALL FUNCTION 'RSPO_SR_CLOSE'
EXPORTING
handle = lv_spool_handle
final = abap_true
EXCEPTIONS
handle_not_valid = 1
operation_failed = 2
OTHERS = 3.
IF sy-subrc <> 0.
"Errorhandling
ENDIF.
CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
EXPORTING
* COPIES = 0
device = lv_dest
* DIVISION = '*'
endpage = lv_pages
* PRIO = 0
* RECEIVER = '*'
* REQEST_TITLE = '*'
spool_request_id = lv_spoolid
startpage = 1
* TELELAN = '*'
* TELENUM = '*'
* POSNAME =
* ACTTIME =
EXCEPTIONS
archive_dest_invalid = 1
archive_dest_not_found = 2
archive_dest_no_right = 3
cannot_archive = 4
change_archdest_no_right = 5
change_copies_no_right = 6
change_dest_no_right = 7
change_devtype_no_right = 8
change_prio_no_right = 9
change_telenum_no_right = 10
change_title_no_right = 11
dest_invalid = 12
dest_not_found = 13
dest_no_right = 14
internal_problem = 15
invalid_fax_attribute = 16
invalid_parameters = 17
non_owner_no_right = 18
no_layout = 19
no_spool_request = 20
out_again_no_right = 21
spooler_problem = 22
in_process = 23
OTHERS = 24.
IF sy-subrc <> 0.
"Errorhandling
ENDIF.