cancel
Showing results for 
Search instead for 
Did you mean: 

Component Controller

Former Member
0 Kudos

Hello All,

In the context of a component controller I have a attribute for the Order number

My view context for the view "Operations" has no corresponding attribute mapped to the Order number of the context of the component controller.

How can I read the Attribute in the component controller. Is it possible..to get the attribute value for the Order number from the context of the component controller directly..?!?!

Warm Regards,

Smita

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes you can. Introduce a <b>get_order_number</b> method in the component controller, inside which you will read the component controller's context and return the order number. You will access that in your view as

<b>order_no = wd_comp_controller->get_order_no( ).</b>

Also introduce a setter method so that you can do a binding when the value changes. So you can call wd_comp_controller->set_order_no( ).

However, doing a mapping to the view is the neater and easier way to do it. But if you do not want that, this will work too. Award points if it solves your issue.

Regards,

Nithya

Former Member
0 Kudos

Hey Nithya...

Again this is a standard component.. so I am not allowed to make changes to the standard one..!!

Is there any other way out..!!

Warm Regards,

Smita

Former Member
0 Kudos

Then this is not possible. I doubt if there is a way out.

Regards

Nithya

Former Member
0 Kudos

Hey guys,

I found a way out..!!!..Lemme share it with you guys..!!

This is the code snippet..!!!

DATA: L_COMPONENT_CONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER,

L_COMP TYPE REF TO IF_WD_COMPONENT,

L_CONTEXT TYPE REF TO IF_WD_CONTEXT,

L_NODE TYPE REF TO IF_WD_CONTEXT_NODE,

L_CHILD_NODE TYPE REF TO IF_WD_CONTEXT_NODE,

ELEM_OP TYPE REF TO IF_WD_CONTEXT_ELEMENT,

ITEM_AUFNR TYPE STRING.

L_COMPONENT_CONTROLLER = WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

L_COMP = L_COMPONENT_CONTROLLER->WD_GET_API( ).

L_CONTEXT = L_COMP->GET_CONTEXT( ).

L_NODE = L_CONTEXT->ROOT_NODE->GET_CHILD_NODE( 'ORDERDATA_COMPLETE' ).

L_CHILD_NODE = L_NODE->GET_CHILD_NODE( 'HEADER' ).

ELEM_OP = L_CHILD_NODE->GET_ELEMENT( INDEX = 1 ).

ELEM_OP->GET_ATTRIBUTE( EXPORTING NAME = 'AUFNR' IMPORTING VALUE = ITEM_AUFNR ).

Warm Regards,

Smita

Former Member
0 Kudos

The above code helped me..!!

Hope it helps u too..!!!

- Smita

Former Member
0 Kudos

Hi,

Excellent work. infact i was trying this yesterday but could not. keep sharing this good work

cheers

Former Member
0 Kudos

Yeah..!!..definitaly...!!...Thanks Vinod...!!

Warm Regards,

Smita

Former Member
0 Kudos

Good to know this...Had the same doubt earlier but didn't work on it..Thank you for sharing .

Suresh

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

in the context of the view,

drag the node with your attribute from the right side (component controller)

to the context icon on the left side (view context)

the data binding will be done automatically

grtz,

Koen