Hi Sara,
what i understand is in your second screen user has search and select the business partner and they save that business partner then they will go to first screen which is email inbox then they open any one of the emails right..?
in this case
when ever user save the business partner the changes will save to the component level you can observe in ICCMP_BTPARTNER/PartnerTable place a break point into this do_prepare_out method of this view.
coming to the ur requirement what ever user selected bp you need to get into CRMCMP_CCS_EML component right.
for this
first you have to get the source id of that mail ( ex : EXT40000000000193 ).
2) get the history manager instance ( cl_crm_ic_tx_history_manager ) and pass the source id over there
3) link the source id to the linked transaction calling get_linked_transaction method
4) get the bp number by traversing relations.
example code:
DATA lr_coco TYPE REF TO cl_crmcmp_c_bspwdcompone1_impl.
DATA lo_source1 TYPE REF TO cl_crm_bol_entity.
lr_coco ?= comp_controller.
lo_source1 ?= lr_coco->typed_context->currenticborwrapper->collection_wrapper->get_current( ).
CHECK lo_source1 IS NOT INITIAL.
* Get the linked reference documents (one or more!) from the Business Context Manager.
lr_buscontext = cl_crm_ic_tx_history_manager=>get_business_cntxt_mgr( ).
lr_linked_coll = lr_buscontext->get_linked_transactions( lo_source1 ).
IF sy-subrc = 0.
lr_existing ?= lr_linked_coll->get_first( ).
WHILE lr_existing IS BOUND.
TRY.
IF lr_existing->get_name( ) EQ 'BTAdminH'.
lr_btadminh ?= lr_existing.
ELSE.
lr_btadminh ?= lr_existing->get_related_entity( 'BTOrderHeader' ). "#EC NOTEXT
ENDIF.
lr_btprtnerset ?= lr_btadminh->get_related_entity(iv_realtion_name = = 'BTHeaderPartnerSet' ).
CHECK lr_btpartnerset IS BOUND.
lr_btpartnerall ?= lr_btpartnerset->get_related_entities( iv_relation_name = 'BTPartnerAll' ).
CHECK lr_btpartnerall IS BOUND.
then get the bt partner number over there you will get business partner number by using get_property_as_value or string method 'PARTNER_NO' .
try this you will business partner number..
Thanks & Regards,
Srinivas.