cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing different context node within the same component.

Former Member
0 Kudos

Hi

Guys,

I created my own context node with some value fields. I need to populate the values in the context depending upon the values in the other context. There is no link between the 2 context nodes except they are part of the same component.

How do i read the values from the context node.

Did the following:

Enhanced

Comp :BT126H_APPT

View:BT126H_APPT/ApptDetails

Created Context node ZDESCRIPTIONS with 2 vakue fields

ZEVENT_ID_DESC

ZLOCATION_DESC

Need to populate 2 fields based on values in the context node BTACTIVITYH.

How do i do this.

Thanks

Aman

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can access using Relations.

If not possible access the context node from the Custom Controller like this. You can implement this code in the Context node class methods.

lr_cuco ?= me->owner->get_custom_controller( controller_id = 'NAME' ).
lr_current ?= lr_cuco->typed_context->btactivityh->collection_wrapper->get_current( ).

Regards,

Masood Imrani S.

nicolas_busson
Active Contributor
0 Kudos

Hello,

All your context nodes can be accessed from your controller. So why don't you implement your logic in method DO_PREPARE_OUTPUT?

Kind regards,

Nicolas Busson.

PS: if you really need to access NODE_A values from NODE_B, then implement the following:

1) Add public attribute "CONTROLLER" of type "REF TO CL_BSP_WD_VIEW_CONTROLLER" to context node class of NODE_B

2) Adapt method "CREATE_NODE_B" of your context class in order to get the following:


...
NODE_B ?= model.
NODE_B->controller ?= owner.
CLEAR model.
...

3) As a result you will be able to access values of NODE_A from NODE_B via me->controller->typed_context->NODE_A->...

former_member202474
Contributor
0 Kudos

Hi Amandeep,

I feel the best and easiest way to populate the 2 fields is using do_prepare_output method. You can do the following code to achive this.

data : lr_entity type ref to cl_crm_bol_entity,

lr_enity1 tyep ref to cl_bsp_value_node.

lr_entity?= me->typed_context->node_a->collection_wrapper->get_current( ).

use the get propert value method of lr_entity and get the values based on which you can populate the values of node b.

lr_entity1 ?= me->typed_context->node_b->collection_wrapper-current( ).

use set method of lr_entity1 to populate the values.

Hope this helps.

Regards,

Ruby.