cancel
Showing results for 
Search instead for 
Did you mean: 

Change "Interface node" property at runtime

bustamantejt
Explorer
0 Kudos

I have two web dynpro components (say component A and component B) that, at one point, component A has to call component B and send some information to it. I could achieve this by creating a node in the component B with the properties "Interface node" and "Input Element (Ext.)" and declaring component B as a component usage in component A and embedding the main view of component B in a view container in component A and mapping a node from component A with that interface node from component B in the interface controller.

That worked perfectly. Component A called component B and it received the proper information through the interface node and it was displayed in the view container. The problem is that I also need to execute component B by itself, i.e. without being called by component A. If I try to do that I get a dump saying that the mapping of the node was not completed, which makes sense because the component has a node declared as "Interface node" but is not receiving any information.

¿Is there a method to detect if an interface node has received information and then ignore it in case it hasn't received any?

Accepted Solutions (0)

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Tomas,

Please do not mark the interface node for external input only by ticking the check Input Element(ext).

if you make the node as just interface node, it can accept the data from its own component as well as from outside.

Example:

  •    Component B is having interface node NodeB and marked as interface node
  • Component B is used in component A
  • Now, go to the context of controller of component A and map the interface node NodeB from interface controller of component B
  • Hence the interface node is mapped onto controller of component A and you can set data to the context node of component A, which reflects in component B

The same requirement can be achieved by using interface methods as suggested by Mr.Jozef.

Hope this helps you.

Regards,

Rama

bustamantejt
Explorer
0 Kudos

Ramakrishnappa Gangappa wrote:

Please do not mark the interface node for external input only by ticking the check Input Element(ext).

if you make the node as just interface node, it can accept the data from its own component as well as from outside.

If I set the node only as interface node and without the "Input Element (ext.)" property, I get the following error message when I try to map it from another component.

ramakrishnappa
Active Contributor
0 Kudos

Hi Tomas,

You cannot do the external mapping in this case.

Instead, you need to drag interface context node from interface controller of COMPONENT B to context of component A controller. So it copies same node on to context of component A. Now, if you set data in component A, it reflects in component B.

Regards,

Rama

Former Member
0 Kudos

I had the same problem a couple of times. Once  anode is to be externally mapped, it has to be. My favourite workaround is overcoming the context mapping between components in general.

You see you only need to map different context when you need the data on both sides. Now in only seldom situations you do not get confused / angry with the fact that you need to update the context node for every component using it and this can be something you really do not want to do.

So to workaround it - do not create any interface nodes in the context, create interface methods to fill the context. You will need some more time to implement the logic, which will call the corresponding method after context changing (in any of the components). This can also be confusing, because values can be changed in both of the components. But once you know the prerequisities, you can construct / design your application to support this kind of approach.