Generally we store the attachments in CRM in the CMBO object which in turn stores the infomration in Content managment Server.

More infomration of Content managment is here

But you may actually need to read the actuall content may be to attach it as a mail or display it etc..

May be this steps would help you.


1) For Exmaple you might have attachment which are generally stored in Content managment server (CMBO object at GENIL Level),

2) Every CMBO object would have the following relation with the following information.


3) We have a very usefull class which will work with this content management  CL_HRTMC_DOCUMENT_UTILS ,with very usefull method,just a glance.


4) You can use the sample code below for getting the infomation from the CMBO via this class.

data :  

    lr_cmbo                       TYPE REF TO cl_crm_bol_entity,
    lt_documents               TYPE STANDARD TABLE OF crmt_cmic_doc_attr,
    ls_documents              TYPE crmt_cmic_doc_attr,
    lr_data                         TYPE REF TO data,
    lr_crm_utility                TYPE REF TO cl_hrtmc_document_utils,
    lt_binary_documents   TYPE sdokobjects,
    ls_binary_documents   TYPE sdokobject,
    lt_contents                   TYPE hrtmc_t_document_content,
    ls_contents                  TYPE hrtmc_s_document_content.

   lr_cmbo = lr_entity_col->get_first( ).

  CHECK lr_cmbo IS BOUND.

  lr_data = lr_cmbo->get_properties_by_bpath( ‘./CMBODocumentRefRel/*$’  ).


  ASSIGN lr_data->* TO <fs_ref>.


  lt_documents[] = <fs_ref>.

  CREATE OBJECT lr_crm_utility .

  LOOP AT lt_documents
          INTO ls_documents.

    CLEAR ls_binary_documents.
    REFRESH lt_binary_documents[].
    ls_binary_documentsclass = ls_documentsloio_class.
    ls_binary_documentsobjid = ls_documentsloio_objid.
    APPEND ls_binary_documents TO lt_binary_documents[].

    REFRESH lt_contents[].
    lr_crm_utility->get_content_of_documents( EXPORTING it_documents = lt_binary_documents[]
                                              IMPORTING et_contents  = lt_contents ).

    READ TABLE lt_contents[]
                INTO ls_contents
                INDEX 1.
    CHECK sysubrc IS INITIAL.

    ls_bodycontent_bin   = ls_contentscontent.

ls_contentscontent. => This would have the content in the attachment or CMBO object in the Binary so you can play around this.


To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Nawal Kishore

    Hi Rajesh,

    Very excellent document.

    But i am trying to implement above code. I am getting error   lr_data = lr_cmbo->get_properties_by_bpath( ‘./CMBODocumentRefRel/*$’  ) in this line.

    Error : Relation ‘BTAdminh’ is not supported by source object ‘CMBODocumentRefRel‘.

    Please let me know how i can overcome with this issue.

    Thanks in advance,

    Nawal Kishore


Leave a Reply