cancel
Showing results for 
Search instead for 
Did you mean: 

Exception while defining value attribute to Model Node

Former Member
0 Kudos

Hello Friends,

I have added value attribute to an existing context node in component BT121H_SLSC,  BTPARTNERSET context node. Now after adding the value attribute an exception is triggering as

"Source type \CLASS=CL_BSP_WD_MIXED_NODE is not compatible, for the purposes of assignment, with target type \CLASS=CL_CRM_BOL_ENTITY"

I have checked  source code of mentioned class, reference of CL_BSP_WD_MIXED_NODE class is coming after adding value attribute .

Exception is triggering at statement: lr_entity ?= current. => In current ref of CL_BSP_WD_MIXED_NODE class is coming while lr_entity is type ref to cl_crm_bol_entity.

 

I would really appriciate your reply on this as how can I avoid this exception? Do I need to redfine this method?

Appriciate your replies on same.

Regards,

CRM Dev

Accepted Solutions (1)

Accepted Solutions (1)

dharmakasi
Active Contributor
0 Kudos

Hi Dev,

First of what attribute you have added in existing context node? Is that not available in standard SAP?

When you define value attributes within the model attribute then the node becomes mixed instead of either value node or model node.

So you need to access the mixed node and then should access model attributes and value attributes separately.

Get your collection into a normal entity then assign the entity to mixed node

DATA: lr_mixed TYPE REF TO cl_bsp_wd_mixed_node ,

            current TYPE REF TO if_bol_bo_property_access,

             lr_current TYPE REF TO cl_crm_bol_entity.

     current ?= me->typed_context->entity name->collection_wrapper->get_current( ).
      lr_mixed ?= current
..
      lr_current ?= lr_mixed
->if_bsp_wd_ext_property_access~get_model_node( ).

Best Regards,

Dharmakasi.

Former Member
0 Kudos

Hello Dharmakasi,

I want to add one Partner Function on the Account Details screen. currently there is sold to party partner function is available by default on the Account Details screen. I want to replace the sold to Party partner function with another partner function field.

Then in this case, how to add the field for new partner function.

The new partner function is mapped with already existing extra partner function in system.

Could you please help me out.. in this case how should i add the new partner function.

dharmakasi
Active Contributor
0 Kudos

Hi Dev,

I am not clear with your requirement, but i am giving normal partner function explanation, it might helpful.

Always we will have only one partner function field in BTPartners context node, the value you are assigning to the partner function will vary based on type of partner function.

Suppose for example sold to party partner function will be assigned with 00000001 and ship to party will be assigned with 00000002.

You can fine the partner function id in SPRO->customer relationship management->Basic function->partner processing->Define partner functions

Whatever partner number you will enter across the partner function that value would be the assigned to the partner function. Its like partner function --> Partner number in BTPartners context node.

You can use the same partner function field for your own partner function as well by renaming the field and check the context node of sold to party attribute in your view.

Best Regards,
Dharmakasi.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Once you added the value attribute to the model node the node became a MIXED node  and teh GET_CURRENT() on this context node will return entity of type cl_bsp_wd_mixed_node.

Since this is standard component and mostly in all the method of IMPL class, CN class, like DO_PREPARE_OUTPUT, GET, SET, GET_I, GET_V etc are using standard code which has the entity of type cl_crm_bol_entity the assignment fails and exception occurs.

To fix this you will probably have to change in all places where cl_crm_bol_entity is used for that context node, which is extensive.

You might want to consider creating a whole new value context node with that value attribute in that view instead of adding that value attribute to the standard model context node, if at all you need that value attribute. What is the purpose of that value attribute?

~Anupam

devashish_bhattacharya
Active Participant
0 Kudos

Hi CRM Dev,

Enhance the code, and remove the type definition of lr_entity type ref to cl_crm_bol_entity with cl_ bsp_wd_mixed_node.

Now since you have changed this context node to be mixed node,the type definition should also go in the same way.

Regards,

Devashish