Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 18, 2017 at 07:16 AM

    Hello!

    I face the same problem. Have you solved it?

    Best Regards!

    Rui

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 01, 2017 at 10:40 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded