Hi Experts,
I have written a static method in order to execute standard search 'OrgQuerySearch' for retrieving an OrgHeader-Entity via the OBJID of the Orgunit. When testing this method via TA SE80, everything works fine. However, when executing this method during the Save of a business transaction, the OrgHeader-Entity that is returned is incomplete as no attributes are included and the relation OrgHeaderOrgUnit is missing.
I debugged this scenario and found that during the execution of method CL_CRM_GENERIC_IL_NEW->READ the exception 'cx_crm_genil_general_error' is thrown, preventing the missing attributes and relations to be read from the GenIL:
* check if this is a re-entry
IF me->data_container IS BOUND.
RAISE EXCEPTION TYPE cx_crm_genil_general_error
EXPORTING
textid = cx_crm_genil_general_error=>illegal_reentry.
ENDIF.
Does anyone know why this is happening and what to do about this?
Thanks!
Jens
Coding is as follows (component set 'OMIL' and 'BT' are loaded in the class constructor):
--- Coding starts ----
data: lr_bol_core type ref to cl_crm_bol_core,
lr_qs type ref to cl_crm_bol_query_service,
lr_result type ref to if_bol_entity_col,
lr_entity type ref to cl_crm_bol_entity,
lr_entity_col type ref to if_bol_entity_col.
* Get search service objects and execute search to find proper BOL object
lr_bol_core = cl_crm_bol_core=>get_instance( ).
lr_qs = cl_crm_bol_query_service=>get_instance( 'OrgQuerySearch' ).
lr_qs->set_property( iv_attr_name = 'OBJID' iv_value = '50037264).
lr_result = lr_qs->get_query_result( ).
lr_entity = lr_result->get_first( ).
lr_entity_col ?= lr_entity->get_related_entities( iv_relation_name = 'OrgHeaderOrgunitR' ).
rr_entity = lr_entity_col->get_first( ).
if not rr_entity is bound.
* What to do??? It seems that when calling this search from a business transaction the relations
* of OrgHeader are not properly filled and therefore, rr_entity is not bound.
endif.
--- Coding ends ---