cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Interface Node :

Former Member
0 Kudos

Dear Experts!!,

Good Evening..

I am facing an issue with interface node when i tried to read the values of the same node of first comp in second.

If i assign some values to interface node thorugh any methods of component controller , i am able to read the node values in used component ( component -2), but which is not happing when i assign value to the same node in any action method of any view.

kindly let me know how to read the node (interface) values which is assigned in an action of comp - 1 in comp -2 where comp -1 is used as comp usage .

Thanks and Regards,

Kranthikumar Palle.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

1. Please check if the Node you are referring to is mapped to the component controller.

2. Alternatively from your view you can get reference to the context node of the component controller

And then assign the values you need.

3. You must also check if this node is mapped to the interface component context.

4. Please also check if you refreshed the second component so that the interface is updated.

Best of luck. This is not anq easy task.

Regards

Yuval

Answers (1)

Answers (1)

Former Member
0 Kudos

i am not sure what your problem is.

There are no restrictions to read a interface node data. You have to go back and review your situation once again.

You have a source node in comp-1, you make this as interface node.

You have a component comp-2 and you use comp-1 as used component and do a context mapping for the node Source_node.So in this case you have a node in comp-2 Source-node which is mapped to comp_1 usage.

You can read this data of the source_node from component 2 after this.

Let me know if these are done correctly in your case and if it is still not working, write in details what is not working with example of your context structure and how to read the data.

Former Member
0 Kudos

1) I created a webdynpro component A with a node ( node 1 which is interface node)

2) In view no1 i am assiging some values to the local node of the view which is mapped from component controller .

3) i created one more component B and declared comp A as compoentn usage.

4) in comp controller of B with the help fo controller usage i am mapping NODE 1 of comp A into Comp B

5) in DOINIT i am reading the values of the node which is mapped from Comp 1 as explianed in Step 4.

but Values are not reflecting in this scenario.

when i default some vlaues to the attribute of node1 of comp 1 or when i bind values to the same node through any method of comp controller , i am able to read the same in comp 2 with the same procedure.

so i guess i havent missed any thing.

kindly let me know the solution.

Edited by: kranthi9121 on Mar 25, 2011 5:45 AM

Edited by: kranthi9121 on Mar 25, 2011 5:46 AM

abhimanyu_lagishetti7
Active Contributor
0 Kudos

are you sure the values are assigned to the node by the time you read?

put a break point at value setting code and read, i am sure value setting is happening somewhere after your read.

Abhi

Madhu2004
Active Contributor
0 Kudos

As explained in point no 2 which one are you doing:

1) created a local node(N1) in the view and mapping the component controller node(N2) on N1 node of the view

or

2) Created node N1 in component controller and mapping the same in view, so that it will have same name.

If you are using the first approach you cannot get the values in COMP2.

If you are using the second approach, then try by creating the component usage and then read the node.

Regards,

Madhu

Former Member
0 Kudos

hi,

i am sure that before navigating to second component itself i am assigning the values to the node which is mapped from comp controller.

and i also tried by assigining the values by reading the reference of the comp controller context node .

in both cases , issue is same . mean to say not resolved.

Former Member
0 Kudos

hi madhu

i am using secodn approach only and also i am using comp usage .

but not able to get the solution

Former Member
0 Kudos

I think the place (wddoinit)where you read is not right.

I assume, your component B is creating instance of component A right. By that time the interface node is empty. You are setting the value from the Comp-A ,view-1.

You are not reaching this place yet when you put your code in doInit method of the component-B to read the values.

You test this by setting default values to the interface node in DoInit method of the component-A, This will make sure that the data is available when the component usage is initiated.

Former Member
0 Kudos

Hi baskaran,

when i default any value to the attribute of node1 in comp-1 or if i force/assign any value to the same node with any hook methods are created methods comp controller of component -1, i am able to read the values in comp-2 as an interfacenode values.

but which is not happening in the case if i assign values to node of comp-1( interface node) through any method/action of view.

Best Regards,

Kranthikumar Palle.

Former Member
0 Kudos

Then in that case i think that your context mapping of the node-1 with the views are not correct.

remove the node-1 from the view(delete it). From the context editor view, drag the node-1 from the component controller and drop it on the root context node of the view.

Again, you read the data from component-B only after the runtime pass through this view.

Former Member
0 Kudos

My Dear Baskaran,

first I ahvent created any sepcial node in view , i Just dragged it from right side nothing but comp contrrolers node.

and also i tired removing the node from view and assginign the values to comp controller node on action of a button with the help of gettign ref to Comp controller node.. find the below code for the same.

DATA :

lo_componentcontroller TYPE REF TO ig_componentcontroller,

lo_controller TYPE REF TO if_wd_controller,

lo_context TYPE REF TO if_wd_context,

lo_component TYPE REF TO if_wd_component,

lo_node TYPE REF TO if_wd_context_node,

lo_child TYPE REF TO if_wd_context_node.

lo_component = wd_comp_controller->wd_get_api( ).

lo_controller ?= lo_component.

CALL METHOD lo_controller->get_context

RECEIVING

context = lo_context.

lo_node = lo_context->root_node.

lo_child = lo_node->get_child_node('NAME').

  • set single attribute

lo_child->set_attribute(

name = `STRING`

value = 'I LOVE MY INDIA - kranthikumar Palle' ).

in the both aboce mentioned sceanrio's if i try to read the value of comp controller node in any other view of the component 1, i am gettign the assigned values 100% but

when i tried to read in component-2 where this node 1 is a interface node but i am nt gettig any values.

hope i am clear!!!

Best Regards,

Kranthikumar Palle

Former Member
0 Kudos

This is all clear.

when i tried to read in component-2 where this node 1 is a interface node but i am nt gettig any values

As i already said, when you read this node-1 from comp2 the node is not yet filled with data. I am sorry to say it again and again. Here you are making some mistakes either mapping the interface node or you expect a behavior which is not happening at runtime.

How sure are you that when you read the node that the node is filled with data from comp-1? have you seen this happening in debug ?.

Why i am hammering here is that , it just working fine for me. I have not seen and heard such problem in this forum last days . Hope you understand that.

Probably you could step out of this and see a sample application in SWDP package , there are numerous components describing your scenario. Have a look,debug and see if anywhere you deviated.

Still problem exists then i would advice you to contact SAP raising a Support ticket.

Madhu2004
Active Contributor
0 Kudos

hi,

One final check..

Can you put a break point at both places i.e.where you are setting the values and where you are getting the values?

Check if getting method is called before setting method?

Madhu

Former Member
0 Kudos

Hi Madhu,

I checked with that..

i am settign the values before reading itself, that is the reason if i assign/force values through any method of comp controller i am able to read the same in second component through interface node.

Best Regards,

Kranthikumar Palle.

Former Member
0 Kudos

Hi Baskaran,

Thanks for you response.

i agree with you conceptually it shoould work and it's good to hear as it is working in your system.

i would like to rise a question , if in case as u explained in this scenarion node of comp2 is not gettign fill at that moment, but when i assignt he values from any method say wddoint of comp controller of comp1, then i am able to read the values in comp 2., so i think your assumption is bit confusing.

and i am sure as i checked in with debuger, in the case if i bind values to node from any method of comp1 - comp controller i am gettign values but not if i write the same logic from any view of comp 1.

it might be issue with package updates ???

Best Reagrds,

Kranthikumar Palle/

Former Member
0 Kudos

>

> i would like to rise a question , if in case as u explained in this scenarion node of comp2 is not gettign fill at that moment, but when i assignt he values from any method say wddoint of comp controller of comp1, then i am able to read the values in comp 2., so i think your assumption is bit confusing.

>

> and i am sure as i checked in with debuger, in the case if i bind values to node from any method of comp1 - comp controller i am gettign values but not if i write the same logic from any view of comp 1.

When you assign value in WDDOINT method of the comp-1, it is working because that is the place first executed when the comp-2 , creates the instance of comp-1.

The same is not working when you have the code in view because , when you access this node-1 from comp2, your view from comp-1 is not live does it ? . This is what we are trying to make you clear that you read the value from comp-2 before the value set from the view in comp-1.

Ofcourse this is my assumption as i cannot look into your souce/application.

Former Member
0 Kudos

Great to see such an beautiful explanation!!!

Obeviously when we are trying to read from comp1 in comp2 , nothgin will be visible expect comp controller ( interface methods and nodes).. what i am trying to say is before readint the comp1 from comp2 if u r addding some thign to interface node of comp1, it should be visible in comp2.

else no use of interface nodes as all the data wil be based on actions which exists in views.

kindly let meknow the solution and also let me know my assumption is correct or not.

once again thanks alot !!!

Regards,

Kranthikumar Palle.

Former Member
0 Kudos

Your assumption is correct, when you set a value to the interface node and read it after in the used component then i would expect the result as same as your assumption.

Solution. To be honest,i do not understand your problem why it is not working the way you described. Conceptually it should work. Only the execution of it , i cannot see what and how you coded your application. We can talk a week a long about this but we cannot come any further . It comes down to that you have a interface node, make sure that you read that data after you set the value.

if your design is to get the data from some view from comp-1 then, i would suggest to have this view in a window(interface view) and use this interface view from comp-2. By this way you can enter the value from your view and use the interface node to read the value, if you have already done this and if it is not still working then you may have to contact SAP about it.

Former Member
0 Kudos

Hello Baskaran

if your design is to get the data from some view from comp-1 then, i would suggest to have this view in a window(interface view) and use this interface view from comp-

with the above mentioned solution we can only display the values of view of comp1 in comp2 but we cant read the values as there wont be any context nodes for the same.

once again thanks for your valuable time and timely help !!!

Possible can u try a small demo in your system and let me knwo so that i can raise a ticket to SAP .

DEMO : Create a comp-1 with a node ( interface) and assign the values to the same node in any action of comp1 -view1- action buttn. and at the same time call view 2 which is having a view container which binded to comp 2- view 1(window) , and comp 2- view 1 sholud have a section to display values of comp1-view1 ( mapp the interface node values ).

Best Regards,

Kranthi kumar Palle.

Madhu2004
Active Contributor
0 Kudos

Hi Kranthi,

I have tried the way you suggested for the demo application and the ISSUE exists.

Regards,

Madhu

Former Member
0 Kudos

thanks Madhu,

I think now i can go ahead with raising OSS notes for the same ??

Yes , Right??

Best Regards,

Kranthikumar Palle

Former Member
0 Kudos

Do i understand the scenario correct.

Comp-1 has view1,view-2 ,inf_node(interface node).

Comp-2 has view1 and inf_node(interface node from comp_1)

View2-Embeds the Comp-2 view1. in a ViewContainerUIelement.

When you fill the values in View-1 and display it in view-2 (Comp-2 view1), this is the scenario and it is not working for you.

I shall create one test comp and let you know my result.

Former Member
0 Kudos

Hi Baskar,

you understood the scenario 100% correct, i request you to go ahead with a demo trail.

regards,

Kranthi

Former Member
0 Kudos

>

> Hi Baskar,

>

> you understood the scenario 100% correct, i request you to go ahead with a demo trail.

>

> regards,

> Kranthi

I was going to create my test components and re looked at my last post and i think , i know what is going wrong. IF my assumption is correct then you have mis leaded us greatly(without knowing ).

is that your both component refer each other as used components ? I think yes.

When your application starts with comp-1 and goes to view-2 ,component_2 usage is created. When component 2 is created , it needs comp-1 interface node,so it creates a whole new instance of comp-1 which is not the same as previous one.

When you set the data in wddoinit method of the component controller , it works because the second instance of the comp-1 come across this method.

If you had told that you have cyclic dependency in place, we could have looked it in different perspective.

Now the solution to your problem is to stick with only one instance of the comp-1 but that is not easy to make it work.

i thought that this would work

Create a method in comp-2 component controller like set_comp1_usage with parameter lo_usage of type if_wd_component_usage.

Pass through the comp_1 lo_usage from wddoinit method . But it is not working.

I think, you may have to seek another way to solve your problem with out usage dependency.

You could create a Shared data component which is used component for both comp_1 and comp_2.

Or you can use assistance class to share data.

Former Member
0 Kudos

Hi Baskaran,

Good Morning.

I stand by - Apologies for mis leading !!!

A big Thanks for your help , will try with Sahred component and will let u know the result.

Good Day !!

Best Regards,

Kranthikumar Palle

Former Member
0 Kudos

Baskaran,

I Knew assistance class approach, but i am not sure about shared component, if you can pass some steps or doc's it would be great help fr me

thanks in advance.

Regards,

Kranthi

Former Member
0 Kudos

One more Query!!!

find the following steps.

1) created a wda component (comp -1) with a node ( NODE_1 - interface node).

2) in the main view of comp 1- create a button( call) . on action of call 1 i am assiging values to node ( node_1 ) which is mapped from comp controller . and in the same action after assiginig values i am calling another webdynpro application ( comp _2) as an external window.

3) comp_1 has declared as comp usage in comp_2, and i mapped the interface node of comp_1 into comp_2.

4) in main view of comp_2 i builded a container from the dragged interface node.

In this scenario i dont have any circular comp usage, and as baskaran explained i assume that when i call comp_2 from comp_1 new instance for interface node wil be created hence no data in interface node. ( i cheked no data is coming).

for this situation is there any solution with the help of interface node.

i have another solution as appednign the required variables as parameters to URL adn reading the same in called application, but i dont want to go ahead with this.

waiting for suggestions!!

Regards,

Kranthikumar Palle

Former Member
0 Kudos

When you use external window then, it will be on a separate session. So , no use.

Shared Component, i meant that faceless component. You just create only context there (interface node). Use this component as used component in both comp_1 and comp_2. When you create a usage of this in comp_1, pass this reference to comp_2 via a method (set_usage ).

Use the entering_referencemode method of if_wd_component_usage. The point is that you do not create a new instance of Shared component, you make use of the usage created in comp-1.

Assistance class is my preference though. You decide what is best suit for your case.

Former Member
0 Kudos

Hi Baskaran,

Thank you so much!!!

i started with Assistance class and i am able to reach my requirement.

thanks to all !!

Regards,

Kranthikumar Palle