Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8608

New Partner in service request

$
0
0

Hi,

 

In a requirement we need to add a partner (from ECC ) in parties involved in service request. We have fetched the data from ECC and now that is available in CRM.  For adding the same in Service request i have created a context node in "SRQM_INCIDENT_H/IncidentHeaderEF"

Now in ON_NEW_FOCUS of this node i am creating a entity for that new partner, also a entity for BTPartnerAll.

 

 

 

method

 

on_new_focus.

data: lv_collection type ref to if_bol_bo_col,
entity
type ref to cl_crm_bol_entity.

data: lv_collection1 type ref to if_bol_bo_col,
entity1
type ref to cl_crm_bol_entity,
entity2
type ref to cl_crm_bol_entity,
entity3
type ref to cl_crm_bol_entity,
lv_partner_func
type string.

entity ?= focus_bo.
try.
lv_collection
= entity->get_related_entities(
iv_relation_name
= 'BTPartner_PFT_0005' ).                              "initially two entity with same type are availabe but different partner function


entity2 ?= lv_collection
->get_first( ).
entity3 ?= entity2
.
while entity2 is bound.
lv_partner_func
= entity2->get_property_as_string( iv_attr_name = 'PARTNER_FCT' ).
if lv_partner_func = 'Y0000055'.
exit.
endif.
entity2 ?= lv_collection
->get_next( ).
endwhile.

if lv_partner_func ne 'Y0000055'. " entity->is_changeable( ) = abap_true.
try.
entity
= entity->create_related_entity( iv_relation_name = 'BTPartner_PFT_0005' ).
entity ?= entity3
.                                                                                             " copying the all fields in new entity and will chage details now
cl_crm_uiu_bt_partner
=>set_partner2( EXPORTING ir_current = ENTITY
iv_new_value
= '2000190' ).
ENTITY
->SET_PROPERTY( IV_aTTR_NAME = 'PARTNER_FCT'
IV_VALUE
= 'Y0000055' ) .
catch cx_crm_genil_model_error cx_crm_genil_duplicate_rel.
* should never happen
endtry.
lv_collection
->add( entity ).

" now adding same entity to BTpartnerall also


entity1 ?= entity
->get_parent( ).
lv_collection1
= entity1->get_related_entities(
iv_relation_name
= 'BTPartnerAll' ).
entity1
= entity1->create_related_entity(
iv_relation_name
= 'BTPartnerAll' ).
entity1 ?= entity
.
lv_collection1
->add( entity1 ).

endif.
catch cx_crm_genil_model_error.
* should never happen
exit.
catch cx_sy_ref_is_initial.
endtry.
me
->set_collection( lv_collection ).

endmethod

 

 

i last i can see these entities in Do_prepare_output too, but in UI there is no new entity is created but only the existing one is changed.

 

 

please suggets what else i should do.

 

 

Regards,

Amrit


Viewing all articles
Browse latest Browse all 8608

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>