Adding attachments in MIRO transaction: Help needed

Hey everyone! I’m trying to figure out how to add attachments in the MIRO transaction. I need to include both an image and a file (both .TIF format) in my report.

My code updates the table, but it’s not showing up in MIRO. I’m pretty sure I’m missing something, but I can’t figure out what. Here’s a simplified version of what I’m working with:

DATA: lt_content TYPE TABLE OF soli,
      ls_fol_id  TYPE soodk.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename = 'C:\Docs\sample.TIF'
    filetype = 'BIN'
  TABLES
    data_tab = lt_content.

CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
  EXPORTING
    region    = 'B'
  IMPORTING
    folder_id = ls_fol_id.

" More code here to process the attachment

I know I need to pass the business object and key, but I’m not sure how to do it correctly. Any help would be awesome! Thanks in advance!

I’ve dealt with similar issues when adding attachments to MIRO transactions. From my experience, you’re on the right track with using GUI_UPLOAD and SO_FOLDER_ROOT_ID_GET, but there are a few more steps needed.

After getting the folder ID, you’ll need to create a document info record (DIR) and link it to your MIRO document. Here’s a rough outline of what you might add:

  1. Create a DIR using SO_DOCUMENT_INSERT_API1
  2. Link the DIR to your MIRO document with BAPI_ACC_DOCUMENT_ATTACH_ADD
  3. Commit the changes with BAPI_TRANSACTION_COMMIT

Make sure you’re passing the correct object type (probably ‘BKPF’ for MIRO) and the document number as the key. Also, double-check that your authorization object settings allow for attachment creation.

If you’re still having trouble after trying these steps, it might be worth checking your system’s configuration for attachment handling. Sometimes, there are specific settings that need to be enabled for certain transaction types.