Skip to Content
0

Store PDF as GOS attachment

May 04 at 12:13 PM

41

avatar image
Former Member

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.

10 |10000 characters needed characters left 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 ...

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

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

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.

Share
10 |10000 characters needed characters left characters exceeded