Skip to Content
avatar image
Former Member

Store PDF as GOS attachment

Hello,

I want to store a PDF file from the archive server as a GOS attachment. I get the PDF data with "ARCHIVOBJECT_GET_TABLE" and its stored in tables type tbl1024 and type DOCS. My question is, how to convert it to type SOLI so i can store it with "SO_OBJECT_INSERT". I tried everything, but when i tried to open the attachment, i got an error, saying the file is corrupted.

Add comment
10|10000 characters needed characters exceeded

  • Please add some of your Code so we can actually see what Conversion you have already done (if any).

    Furthermore : Google'ing "SAP convert PDF to SOLIX" results in a lot of Information to get you started ...

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    May 08 at 09:17 AM

    Solved.

    Here is the code if someone need it:

       CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
         EXPORTING
           input_length = in_len
    *      FIRST_LINE   = 0
    *      LAST_LINE    = 0
         IMPORTING
           buffer       = lv_xstring
         TABLES
           binary_tab   = lt_binarchivobject
         EXCEPTIONS
           failed       = 1
           OTHERS       = 2.
       IF sy-subrc <> 0.
    "error
       ENDIF.
    
    
       CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
         EXPORTING
           buffer          = lv_xstring
    *      append_to_table = 'X'
         IMPORTING
           output_length   = lv_solix_length
         TABLES
           binary_tab      = lt_solixtab.
    
    
       DATA: wa_soli TYPE soli,
             wa_solix TYPE solix,
             lt_mappe TYPE STANDARD TABLE OF soli.
    
    
       FIELD-SYMBOLS: <ptr_text> TYPE soli,
                      <ptr_x>    TYPE any,
                      <ptr_hex>  TYPE solix,
                      <table>.
    
    
       REFRESH lt_mappe.
       LOOP AT lt_solixtab INTO wa_solix.
         CLEAR wa_soli.
         ASSIGN wa_soli TO <ptr_hex> CASTING.
         MOVE wa_solix TO <ptr_hex>.
         APPEND wa_soli TO lt_mappe.
       ENDLOOP.
    

    Add comment
    10|10000 characters needed characters exceeded