Hi,
I am facing a problem in populating a value in the BTRefProduct.
Here is the scenario. We are using CRM 7.0 and working with Service Requests (under Service Orders)
The requirement is to add a VIN field (vehicle identification number) under the reference object assignment block. This block has fields like IBIBAse, IBInstance, Component, Product etc....
the leading entity is BTADMINH. Upon searching for a product using F4 (product search using a popup), the resultant product ID is selected and it is displayed in the Product ID field. During this selection i need to display the VIN field with vin#.
The changes i did -
1) enhanced the component SRQM_INCIDENT_H
2) added the context node (model attribute of ProductVehGenIds) - this has VIN field
3) created a config using the existing one and added this field to reference objs assignment block (removed other IB related fields)
4) In the event handle EH_OnSelRefProduct am using get_related_entity - code is shown below.
*******************************************
lr_context_node = productvaluehelp_popup->get_context_node( iv_cnode_name = 'PRD' ).
lr_col_wrapper = lr_context_node->collection_wrapper.
lr_current ?= lr_col_wrapper->get_current( ).
IF lr_current IS BOUND.
check outbound plug
lv_outbound_plug = productvaluehelp_popup->get_fired_outbound_plug( ).
CHECK lv_outbound_plug = 'RETURNRESULT'.
lr_iobject_id ?= lr_current->get_property( iv_attr_name = 'PRODUCT_ID' ).
ASSIGN lr_iobject_id->* TO <lv_product_id>.
lr_product_guid ?= lr_current->get_property( iv_attr_name = 'PRODUCT_GUID' ).
ASSIGN lr_product_guid->* TO <lv_product_guid>.
lv_prd_guid = <lv_product_guid>.
"get the VIN using product guid
IF lv_prd_guid IS NOT INITIAL.
SELECT SINGLE vin INTO zvin
FROM isam_g_veh_ids
WHERE product_guid = lv_prd_guid.
ENDIF.
lr_ent = lr_ent->get_related_entity( iv_relation_name = 'BTHeaderBOSSet' ).
lr_ent = lr_ent->get_related_entity( iv_relation_name = gv_relation_refobjset ).
lr_ent = lr_ent->get_related_entity( iv_relation_name = 'BTRefObjectSingle' ).
IF lr_ent IS NOT BOUND.
lr_ent = lr_ent->create_related_entity( iv_relation_name = 'BTRefObjectSingle' ).
ENDIF.
lr_ent->set_property( iv_attr_name = 'PRODUCT_ID' iv_value = <lv_product_id> ).
lr_ent->set_property( iv_attr_name = 'GUID_OBJECT' iv_value = <lv_product_guid> ).
**changes i added****BEGIN***
lr_ent = lr_ent->create_related_entity( iv_relation_name = 'BTRefObjectSingle' ).
IF lr_ent IS BOUND.
lr_ent = lr_ent->get_related_entity( iv_relation_name = 'BTRefProduct' ).
IF lr_ent IS NOT BOUND.
lr_ent = lr_ent->create_related_entity( iv_relation_name = 'BTRefProduct' ).
ENDIF.
IF lr_ent IS BOUND.
lr_ent = lr_ent->get_related_entity( iv_relation_name = 'ProductVehGenIDs' ).
IF lr_ent IS NOT BOUND.
lr_ent = lr_ent->create_related_entity( iv_relation_name = 'ProductVehGenIDs' ).
ENDIF.
ENDIF.
ENDIF.
lr_ent->set_property( iv_attr_name = 'VIN' iv_value = zvin ).
ENDIF.
****************************************************
my question is -
in this event handler the entity btrefobjsingle is created and the attributes are assigned - thats when the product ID is displayed in the owner screen. But when i create entityBTRefProduct->ProductVehGenIDs and set_property of attribute VIN zvin, i dont see this value on the screen.
But in the method DO_PREPARE_OUTPU in debug mode - i have added the same code - for the BTRefProduct I see the complete information of Product (including VIN). NOt sure how i can use this method to set the value using the context node method - SET_VIN.
Any insights would be appreciated.
Thanks,
Shailaja
Edited by: Shailaja Gandam on Jan 14, 2012 7:06 AM