cancel
Showing results for 
Search instead for 
Did you mean: 

Componentization help

Former Member
0 Kudos

Hi All!

I have a rather tricky question regarding the componentization of a Webdynpro java application that I am working on.

I have two components: Component A and Component B.

Component A is my main component which displays some information retrieved from a RFC . This information is displayed in a form and some details in a table.

The structure of the RFC is like this:

Output:

-Structure

-xxx

-xxx

-xxx

Tables:

Table1:

-xxx

-xxx

-xxx

Besides the RFC that reads out data, I also make use of an RFC module that saves some of the same data.

Component B is a u201Cslaveu201D component providing input to some of the table fields

That being said, this is where I have my problems.

In Component A I open a View from component B in a popup window,

(I have added the interface view of component B to a Window in component A).

When I select a value in Component B, this value is set in Component Bu2019s own context, which in term is mapped over in component A). Then Component B, closes itself (destroys) and the window is in term closed. This makes the popup window work a u201Csemiu201D OVS.

But my problem is : How do I get the value from component Bu2019s context into the table context of my RFC module in component A?.

The problem is that Component A can see component B, but Component B, canu2019t see component A, and therefore is not able to set the value directly in Component A.

Can I somehow get the info set in the Context of Component B, over in the right position of the table in Component A (The leadselction), or is this simply impossible.

Help is much appreciated,

Best regards,

Ronni

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi!

create one method to add elements and call that method from the action of onLeadSelect .

i wont suggest any code in modifyView.

regards

vishal

Former Member
0 Kudos

Hi Again,

i know,

but i guess that if i create a method that is called everytime that the lead selection is set, i might update the wrong context?

because the flow is like this:

User selects row 3 in my table, and press on the LinkToAction element in one of the rows,

the popup opens, i they select the value, and the popup is closes again

Now the leadselection is set, and the value yyy= "000"

and my Context from ComponentB contains another context with value

="888"

but how do i get this values from B to Y

because the leadselection is allready set, so if the action is on leadselection, then the next time the user changes the leadselection the value is copied to the new leadselection - which is not good...

The problem is that there is no action for when the popup closes... somehow if i could tell

that now i should copy the value from on element to another...

but is this possible??

Former Member
0 Kudos

hi!

to prvent the wrong context to be updated ,you can invalidate the node. and to get the values from B to Y i allready suggested you to use an intermediate component.you have two components A and B ..now take one more component and add your components and implement interface definition in both the child components.

regards

vishal

Former Member
0 Kudos

hi!

please make the question as answered if resolved.

regards

vishal

Former Member
0 Kudos

Hi Vishal,

In my opinion it is no good to have another component in my setup, since this is way to much overhead.

All i wanted was a shared component that could provide me with some data to my local contex.

This is allready posible, the only thing is that i had to go through wddomodyview to get the value to my context.

i solved it like this : (pseudo code)


if(wdContextNodeMyTableNode().size() > 0){
  if(wdContextNodeMyTableNode().getLeadSelection() > -1){
     if(wdContext.currentMyValue ! = null){
       wdContext.currentMyTableNodeElement.setMyValue (wdContext.currentMyValue.getMyValue();
       wdContext.currentMyValue.setmyvalue = null
  }  
}
}

But thanks anyway for your input!

Best regards,

Ronni

Former Member
0 Kudos

Hi,

You can do this by WDJ - Using Web Dynpro Component Interface Definition. Go through the following link, a good example on Component Interface Definition and Component Usage.

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0409d83-5ed5-2910-ef91-e41da6d5b8b4]

Regards

Raghu

Former Member
0 Kudos

Hi Again!

Thanks for your reply's

I have allready created Component A and Component B

and Component A allready Uses Component B with succes

I do the following in Component A

IWDWindowInfo commentWindowInfo = (IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows("MyWindow");

IWDWindow commentWindow = wdComponentAPI.getWindowManager().createModalWindow(commentWindowInfo);

wdContext.currentMyContextElement().setWindow(commentWindow);

Where i have added the interfaceView of Component B to the window called (MyWindow)

And the context called MyContext is mapped from Component B, so component b

is able to acces the Window info and then it can "close itself" when dont.

Alle this works FINE!

But when i close the window, and return i have the info i selected

in CompB in my MappedContext

But how do i get this Context filled in my Table?

If i Could Just map the Context of B right into the Table of A, but this is not possible since Comp A's table is a modelnode and not a value node...

Do you get the point, or should i try to explain it further?

Former Member
0 Kudos

Hi,

Create a one Value node with structure binding of that model node.and then copy data of model node to that newly created value node by using following code,and then bind the ui lelment to that value node attribute which u want to bind.

context>(right click)value node->checked the with strcture binding-->and map with model node.

write code as follow,

WDCopyService.copyElements(wdContext.node<model node>,wdContext.node<newly created value node>);

regards

vishal

Former Member
0 Kudos

Hi vishal

Thanks for your input, but this doesnt help me,

I have a model context which has some data int it

it looks like this:

RFC_XXXX_XXX

input paramterser

xxx

xxx

xxx

Output_RFC

output parameters

xxx

xxx

xxx

Output Structure

-xxx

-xxx

-xxx

Tables

Table1

-xxx

-yyy

From Component B i have the following mapped Context in my controller

ContextYYYFromBContext

-yyy

which is of cardinality 1:1

what i want is to be able to get the values from ContextYYYFromBContext up in my Table1

But on the right leadselection.

So that when the user selects - let say Leadselection 3 in the table, and finds a value in the CompB popup, this values should be set on my yyy Element on Leadseelction 3 in my Table.

Maybe the only way is to do it in wdModifyView.. but this somehow seems to be "ugly"

Former Member
0 Kudos

hi!

if component A is your parent component and component B is your child component (slave) then you can not see parent component in child component . one work around could be is to take another intermediate component .

regards

vishal