Hello Prashant,
It was hard but I found!
Debugging the Standard I could see that the business partner is searched this way when connection object is confirmed...
With the connection object (ConnectionObject) the Standard finds the premise
lr_prop = lr_bo = lr_bo->get_related_entity( 'PremiseRel' ). "#EC NOTEXT
CHECK lr_bo IS BOUND.
name = lr_bo->get_name( ).
With the premise is raised the event -> premiseconfirmed
lr_event_service->raise( lr_event ).
From Premise the standard gets the PoD's
* determine related PoD's
CALL METHOD lr_premise->get_related_entities
EXPORTING
iv_relation_name = 'PointOfDeliveryRel' "#EC NOTEXT
RECEIVING
rv_result = lr_col.
From the PoD's it gets the contracts
IF lr_col IS BOUND.
lr_pod ?= lr_col->get_first( ).
WHILE lr_pod IS BOUND.
lr_contracts ?= cl_crm_iu_order_agent=>get_items_by_ref_entity( source = lr_pod only_valid_contracts = abap_true ).
IF lr_collection IS BOUND.
lr_collection->add_collection( lr_contracts ).
ELSE.
CREATE OBJECT lr_collection
TYPE
cl_crm_bol_bo_col.
lr_collection->add_collection( lr_contracts ).
ENDIF.
lr_pod ?= lr_col->get_next( ).
ENDWHILE.
ENDIF.
And from the contract it gets the account and the bp number
IF lr_collection IS BOUND.
lr_contract ?= lr_collection->get_first( ).
WHILE lr_contract IS BOUND.
TRY.
CALL METHOD lr_contract->get_related_entity
EXPORTING
iv_relation_name = 'IsuOrderItemAccount' "#EC NOTEXT
RECEIVING
rv_result = lr_account.
CATCH cx_crm_genil_model_error. "#EC NO_HANDLER
ENDTRY.
IF lr_account IS BOUND.
CALL METHOD lr_account->if_bol_bo_property_access~get_property_as_value
EXPORTING
iv_attr_name = 'BP_NUMBER'
IMPORTING
ev_result = lv_account. "#EC NOTEXT
If you do this, it will solve your problem!
With my best regards,
Caíque