Code: Alles auswählen.
DATA: BEGIN OF lt_pdf OCCURS 0,
t(134),
END OF lt_pdf.
data DTAB type table of DOCS.
data lv_len type i.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = lv_len
TABLES
OTF = OTF_output-OTFDATA[]
DOCTAB_ARCHIVE = DTAB
LINES = lt_pdf[]
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
data pdf_xstring type xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
INPUT_LENGTH = lv_len
IMPORTING
BUFFER = pdf_xstring
TABLES
BINARY_TAB = lt_pdf[]
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
* -------- convert document -------------------------------
data pdf_content TYPE table of solix.
pdf_content = cl_document_bcs=>xstring_to_solix( pdf_xstring ).
* TEST TEST
data fnam type RLGRAP-FILENAME value 'c:\temp\000.pdf'.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = lv_len
FILENAME = fnam
FILETYPE = 'BIN'
TABLES
DATA_TAB = pdf_content[]
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Code: Alles auswählen.
DATA: t_buffer2 LIKE l_t_buff_3.
DATA: l_t_pdf_tab TYPE TABLE OF tline.
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB_RAW'
EXPORTING
rqident = '10022'
TABLES
buffer = l_t_buff_3
EXCEPTIONS
no_such_job = 1
not_abap_list = 2
job_contains_no_data = 3
selection_empty = 4
no_permission = 5
can_not_access = 6
read_error = 7
OTHERS = 8.
LOOP AT l_t_buff_3 ASSIGNING <spoolrow> WHERE line CS '\\'.
IF NOT <spoolrow>-line+31 IS INITIAL.
CONTINUE.
ELSE.
to_idx = sy-tabix.
REFRESH t_otf.
APPEND LINES OF l_t_buff_3 FROM from_idx TO to_idx TO t_buffer2.
CALL FUNCTION 'RSPO_OUTPUT_DEVICEDATA'
EXPORTING
** PAGES = 1
rqtitle = sy-tabix
device = 'LOCL'
* size = '120'
datatype = 'RAW'
immediately = 'X'
** LOCATION = 'db'
IMPORTING
rqid = l_v_spono
TABLES
device_data = t_buffer2
EXCEPTIONS
device_unknown = 1
device_type_unknown = 2
canceled_by_user = 3
internal_error = 4
device_type_bad = 5
size_mismatch = 6
OTHERS = 7.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_v_spono
IMPORTING
pdf_bytecount = l_v_bin_filesize
TABLES
pdf = l_t_pdf_tab
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.
*
*
Endloop.