cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with get related entity of mixed node context node

MikeB
Contributor
0 Kudos

Hi,

In one of the tasks I have been required to output the data, which comes both from Product BOL-entity (model node) and from regular function (value node). In order to do that I defined a context node (CN) in component controller and in desired view and binded them. This CN is a mixed node, since it's based on model and value nodes at the same time.

I succeeded to fill-in this CN with the data, but I faced out with the problem at the step of data retrieving from the context node. After some debug I found out, that I get an casting exception in GET_attr_name( ) method (default wizard's implementation), when I'm trying to cast variable of CL_BSP_WD_MIXED_NODE to CL_CRM_BOL_ENTITY, in order to execute get_related_entity( ).

My question is how can I solve/avoid this problem and achieve the access to related entity of mixed node?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mike,

  The context node that you are using is a mixed node, so from this node you need to get model node so that you can cast the entity into CL_CRM_BOL_ENTITY.

Here's the sample code:

DATA:

   lr_mixed TYPE REF TO cl_bsp_wd_mixed_node,

   lr_entity TYPE REF TO cl_crm_bol_entity,

   lr_child TYPE REF TO cl_crm_bol_entity.

lr_mixed = me->typed_context->node_name->collection_wrapper->get_current( ).

lr_entity ?= lr_mixed->if_bsp_wd_ext_property_access~get_model_node( ).

lr_child ?= lr_entity->get_related_entities( ).

Answers (3)

Answers (3)

MikeB
Contributor
0 Kudos

The question was resolved.

Hope, soon I'll can publish a detailed post about this task.

Former Member
0 Kudos

Hello mike,

                   As mixed node and model node are of different classes so you can not type cast between those two. As praveen suggested first get the model node from mixed node by using IF_BSP_WD_EXT_PROPERTY_ACCESS~GET_MODEL_NODE of cl_bsp_wd_mixed_node class and assign it to cl_crm_bol_entity . Then execute the get_related_entity/enties according to your requirement. Hope this will solve your problem.

Regards,

Santosh

praveen_kumar194
Active Contributor
0 Kudos

use IF_BSP_WD_EXT_PROPERTY_ACCESS~GET_MODEL_NODE method of mixed node class and take that entity into cl_crm_bol_entity and execute get related entity method.

i hope i understand this in correct way.

MikeB
Contributor
0 Kudos

Thanks, I'll try this way to reach desired entity.