Skip to Content
Author's profile photo Ratna Rajesh .P

Reading the actuall content from the Content Managment (CMBO)

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 http://help.sap.com/saphelp_crm70/helpdata/en/46/3ede33fddf2f91e10000000a1553f6/content.htm

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.

/wp-content/uploads/2014/03/1_416052.png

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.

/wp-content/uploads/2014/03/2_416053.png

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.

/wp-content/uploads/2014/03/3_416078.png

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/*$’  ).

  CHECK lr_data IS NOT INITIAL.

  ASSIGN lr_data->* TO <fs_ref>.

  CHECK <fs_ref> IS ASSIGNED.

  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.

Thanks.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Daniel Kehne
      Daniel Kehne

      Excellent work! I love your blogs 😉

      Author's profile photo adarsha Yellenki
      adarsha Yellenki

      Nuvvu Super anna....katti blog

      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Former Member
      Former Member

      good blog