Skip to main content

SAP CRM: Read attachments of order

Submitted by Stefan Barsuhn on

Attachments of a CRM order object cannot be retrieved via relation. You need to perform a separate BOL query.

  • Component set: CM
  • Search object: CMBOLinkQuery (CL_CRM_CM_GENIL_COMP=>GC_QUERY_BO_LINK)
  • Fill:
    • INSTID = Order GUID (for item attachment, use item GUID)
    • TYPEID = Order object type (e.g. BUS2000116 for Service Order, BUS2000140 for order item)
    • CATID = BO

In case you want to retrieve the content (binary) of the attachment, after you've retrieved the CMBODocumentRefRel relation, proceed as follows:

" get content
  DATA(lv_doc_key) = lr_attachment->get_property_as_string( 'DOC_KEY' ).

  cl_crm_cm_genil_comp=>gr_cm_control->get_content( EXPORTING iv_key     = lv_doc_key
                                                    IMPORTING ev_content = data(lv_content) ).

 see also CL_ICCMP_CM_CMLIST_IMPL=>EH_ONLINK

Tags