2018 May 04 1:13 PM
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.
2018 May 08 10: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.
2018 May 04 1:29 PM
2018 May 08 10: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.
2024 Feb 12 9:21 AM
Thanks for the information, it works correctly. I attach this code that works and can be improved.
Attach PDF file to FB01, from a BASE64 STRING.