cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to print pdf document which is contained in a XString format

Former Member
0 Likes
7,008

How to print pdf document which is contained in XSTRING format ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

Hi,

I achieved this using some RSPO_SR_... function modules. Here is my code:

DATA: l_dest TYPE sypri_pdest,
l_spool_handle TYPE i,
l_spoolid TYPE tsp01-rqident.

l_dest = 'WIN'.
CALL FUNCTION 'RSPO_SR_OPEN'
EXPORTING
dest = l_dest
layout = 'G_RAW'
* name = sponame
suffix1 = 'BIN'
suffix2 = sy-uname
immediate_print = 'X'
auto_delete = 'X'
doctype = 'BIN'
IMPORTING
handle = l_spool_handle
spoolid = l_spoolid
EXCEPTIONS
OTHERS = 1.

DATA: raw_buffer TYPE TABLE OF rspolpbi.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = x_content
TABLES
binary_tab = raw_buffer.

CALL FUNCTION 'RSPO_SR_TABLE_WRITE_BINARY'
EXPORTING
handle = l_spool_handle
* CODEPAGE =
total = x_size
TABLES
lines = raw_buffer
EXCEPTIONS
handle_not_valid = 1
operation_failed = 2
OTHERS = 3.

CALL FUNCTION 'RSPO_SR_CLOSE'
EXPORTING
handle = l_spool_handle
* PAGES = 1
final = 'X'
EXCEPTIONS
handle_not_valid = 1
operation_failed = 2
OTHERS = 3.

where X_CONTENT is the XSTRING varaible where I have my PDF in binary and X_SIZE is type I with the size (in bytes) of the PDF.

Hope it helps.

rui_wang3
Explorer
0 Likes

Hello!

I face the same problem. Have you solved it?

Best Regards!

Rui