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.
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/*$’ ).
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_documents–class = ls_documents–loio_class.
ls_binary_documents–objid = ls_documents–loio_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 sy–subrc IS INITIAL.
ls_body–content_bin = ls_contents–content.
ls_contents–content. => This would have the content in the attachment or CMBO object in the Binary so you can play around this.
Thanks.
Excellent work! I love your blogs 😉
Nuvvu Super anna....katti blog
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
good blog