I need to build a report that can attach documents (images and files in .TIF format) to the MIRO transaction. My current implementation updates the database tables correctly, but the attachments don’t show up in the MIRO interface itself.
I’m working with business objects and business keys for the attachment process. Could someone review my approach and point out what might be wrong?
SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-100.
PARAMETERS: file_path TYPE localfile,
object_id TYPE swo_typeid,
bus_obj TYPE swo_objtyp.
SELECTION-SCREEN END OF BLOCK main.
DATA:
content_table TYPE STANDARD TABLE OF soli,
content_line TYPE soli,
header_table TYPE STANDARD TABLE OF soli,
folder_member TYPE sofmk,
note_ref TYPE borident,
business_obj TYPE borident,
object_key TYPE soodk,
content_wa TYPE soli,
folder_key TYPE soodk,
object_data TYPE sood1,
note_key TYPE borident-objkey,
vendor_num TYPE lifnr,
filepath TYPE string,
doc_name TYPE c LENGTH 100,
file_ext TYPE c LENGTH 4.
CLEAR: content_table[], header_table[].
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Temp\document.TIF'
filetype = 'BIN'
TABLES
data_tab = binary_data.
CALL FUNCTION 'SO_CONVERT_CONTENTS_BIN'
EXPORTING
it_contents_bin = content_table[]
IMPORTING
et_contents_bin = content_table[].
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region = 'B'
IMPORTING
folder_id = folder_key
EXCEPTIONS
communication_failure = 1
owner_not_exist = 2
system_failure = 3
x_error = 4
OTHERS = 5.