Skip to main content
Attaches a file to any SAP business object through API_CV_ATTACHMENT_SRV. Display name “SAP Upload Attachment”. Off by default. Typical use is attaching the invoice PDF and the source email to the document the agent just created, so a reviewer opening it in SAP sees what it was raised from — but nothing about the tool is invoice-specific.

Authentication and enablement

Requires a workspace SAP integration and platform file storage. base_url and authorization are injected. Enable the tool and bind the integration.

Inputs

Name the object with business_object_type and object_key. There is no shorthand: the tool composes no keys and defaults no object type, because a tool that guesses either one silently attaches the file to the wrong document. object_key is SAP’s LinkedSAPObjectKey, sent exactly as given — fixed-width parts, no separators, each zero-padded to its SAP width: A supplier invoice’s own attachments hang off BUS2081. Count the characters before sending: SAP answers a key that matches no document with an empty list, not an error, so a key short by one digit reads as “this document has no attachments”.

Content type

An .eml stored as application/pdf opens as a broken PDF in SAP, so the content type follows the file’s own extension rather than being assumed. Pass mime_type explicitly when the extension is missing or wrong — message/rfc822 for an email.

Outputs

{tool_name, business_object_type, object_key, attachment, sap_messages[], completed_at}. sap_messages carries whatever SAP said in its sap-message header. On a refusal those messages are appended to the error text too, so the reason — an unsupported content type, a key that no longer resolves to a document — reaches the agent rather than only the HTTP status.

Limits and errors

  • The invoice must exist. Attach before deletion: once a document is deleted SAP refuses every attachment call on it with “Invoice is deleted. Attachment handling is disabled.”
  • Reading a single attachment’s metadata without its content is not implemented by SAP (501); use sap_list_attachments and then sap_get_attachment.