In this blog I will share Installed Base (IBase) concept briefly and the FM’s commonly used.
Installed base management enables the representation of objects installed at a customer's site or an organization (such as devices, machines, and software) for which a service is offered. In business processes, an installed base can be referred to as a general unit or as an individual element (component).
The Purpose of Installed bases are to structure and represent installed objects. Each object belongs to an object family. An installed base consists of general data, a structure and components. One can install as many components as they require for each installed base and you can create subordinate components for each of these components. In this way, you create an installed base structure with as many nodes as you want. Partners are assigned to installed objects.
The Function group: IB_CRM_API gives the CRM API’s for IBase.
1)CRM_IBASE_GET_DETAIL: Gives the IBase details
2) CRM_IBASE_GET_PARTNER: Gives the Partner information of the IBase.
3) CRM_IBASE_COMP_GET_DETAIL: Gives the Component details.
4) CRM_IBASE_COMP_GET_PARTNER: Gives the Partner information of the Component.
5) CALL FUNCTION 'CRM_IBASE_COMP_GET_HIERARCHY'
EXPORTING
i_comp = ls_comp
i_level_down_all = 'X'
i_level_up_all = 'X'
IMPORTING
e_struc_ibase_tab = lt_fields
EXCEPTIONS
not_specified = 1
doesnt_exist = 2
no_authority = 3
OTHERS = 4.
For a Component pass the import parameter i_level_down_all = 'X' to get all the Subcomponents(Child). For a Subcomponent pass the import parameter i_level_up_all = 'X' to get its component(Parent).
Alternatively, using BOL Programming above details can be fetched.
data: lr_ib_entity TYPE REF TO cl_crm_bol_entity,
lv_partner_ib TYPE string,
lv_partner_num TYPE string,
lv_part_fct TYPE string,
lr_bol_col TYPE REF TO if_bol_entity_col,
lr_comp_col TYPE REF TO if_bol_entity_col,
lr_subcomp_col TYPE REF TO if_bol_entity_col,
lv_partner_guid TYPE crmt_object_guid,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_comp_entity TYPE REF TO cl_crm_bol_entity,
lr_subcomp_entity TYPE REF TO cl_crm_bol_entity.
For instance lr_ib_entity is at IBHeader level, has IBase details.
A)We will retrieve Business Partner details for the IBase from the below code.
*** HeaderPartnerSet
lr_entity = lr_ib_entity->get_related_entity( iv_relation_name = 'HeaderPartnerSet' ).
*** IBPartnerAll
check lr_entity is bound.
lr_bol_col = lr_entity->get_related_entities( iv_relation_name = 'IBPartnerAll' ).
CHECK lr_bol_col IS BOUND.
lr_entity ?= lr_bol_col->get_first( ).
check lr_entity is bound.
lv_partner_ib = lr_entity->get_property_as_string( 'PARTNER_NUMBER' ).
lr_entity = lr_entity->get_related_entity( iv_relation_name = 'BusinessPartner' ).
check lr_entity is bound.
lv_partner_guid = lr_entity->get_property_as_string( 'BP_GUID' ).
B)Get all the Components of a given ibase and Partner details.
**component collection
lr_comp_col = lr_ib_entity->get_related_entities( iv_relation_name = cl_crm_ibase_il_constant=>firstlevelrelation ).
if lr_comp_col is bound.
lr_comp_entity ?= lr_comp_col->get_first( ).
** lr_comp_entity has component details.
**** iterate through all the Components.
while lr_comp_entity is bound.
***** ComponentPartnerSet
lr_entity = lr_comp_entity->get_related_entity( iv_relation_name = 'ComponentPartnerSet' ).
**** IBPartnerAll
if lr_entity is not bound.
exit.
endif.
lr_bol_col = lr_entity->get_related_entities( iv_relation_name = 'IBPartnerAll' ).
CHECK lr_bol_col IS BOUND.
lr_entity ?= lr_bol_col->get_first( ).
***** iterate through all the Partners in a Component.
while lr_entity is bound.
lv_partner_num = lr_entity->get_property_as_string( 'PARTNER_NUMBER' ).
lv_part_fct = lr_entity->get_property_as_string( 'PARTNER_FCT' ).
lr_entity = lr_entity->get_related_entity( iv_relation_name = 'BusinessPartner' ).
check lr_entity is bound.
lv_partner_guid = lr_entity->get_property_as_string( 'BP_GUID' ).
lr_entity ?= lr_bol_col->get_next( ).
Endwhile.” iterate through all the Partners in a Component end.
lr_comp_entity ?= lr_comp_col->get_next( ).
Endwhile.” iterate through all the Components end.
Endif.
C)Get all the Subcomponents of a given Component and Partner details.
**Subcomponent collection
lr_subcomp_col = lr_subcomp_entity->get_related_entities( iv_relation_name = cl_crm_ibase_il_constant=> sublevelrelation ).
if lr_subcomp_col is bound.
lr_subcomp_entity ?= lr_subcomp_col->get_first( ).
** lr_subcomp_entity has component details.
**** iterate through all the Subcomponents.
while lr_subcomp_entity is bound.
***** ComponentPartnerSet
lr_entity = lr_subcomp_entity->get_related_entity( iv_relation_name = 'ComponentPartnerSet' ).
**** IBPartnerAll
if lr_entity is not bound.
exit.
endif.
lr_bol_col = lr_entity->get_related_entities( iv_relation_name = 'IBPartnerAll' ).
CHECK lr_bol_col IS BOUND.
lr_entity ?= lr_bol_col->get_first( ).
***** iterate through all the Partners in a Subcomponent.
while lr_entity is bound.
lv_partner_num = lr_entity->get_property_as_string( 'PARTNER_NUMBER' ).
lv_part_fct = lr_entity->get_property_as_string( 'PARTNER_FCT' ).
lr_entity = lr_entity->get_related_entity( iv_relation_name = 'BusinessPartner' ).
check lr_entity is bound.
lv_partner_guid = lr_entity->get_property_as_string( 'BP_GUID' ).
lr_entity ?= lr_bol_col->get_next( ).
Endwhile.” iterate through all the Partners in a Subcomponent end.
lr_subcomp_entity ?= lr_subcomp_col->get_next( ).
Endwhile.” iterate through all the Subcomponents end.
Endif.
Thanks
Ram Vellanki