cancel
Showing results for 
Search instead for 
Did you mean: 

Cross component context mapping

Former Member
0 Kudos

Hi all,

i have two components A and B.

Now i want to map the context from component A to component B.

I have done the following steps:

- Create the two components

- Create context node with one attribute (test) of component controller A -> create view in A with text field mapping to context field test + button

- Create context mapping from component controller A and view controller A

- Specify component controller A context as interface node

- Component controller B: implement usage of component controller A

- Mapping component controller B context with interface controller A context

- Mapping component controller B context with a view of B

- Create view to show the input data in a text view (B)

Summary:

View A context bind to Comp. Controller A context

Comp. Controller A context is interface node

Comp. Controller B context is bind to interface node

View B context bind to Comp. Controller B

I would expect that if i input some data into the text field from component A and press the button that the input data should be shown on view 2 of component controller 2.

But the text view of B is empty???

Any ideas?

regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Wolfgang,

As said you don't need to use it. You can create a so called interface method (check the checkbox) inside Component B. This makes it possible to call this method from Component A.

If you still want to use Context Mapping, you can do it as follows:

1. Go to the context of Component B. Select the Node you want to be mapped. Check the interface Node checkbox.

2. Create a component usage in Component A, of Component B. (Also in your componentcontroller!!).

3. Now you should be able to map the context of the Component B into your context of Component A.

4. Use the attributes of this Node to bind them to your UI Elements.

Hope this will help you resolving your issue.

Regards,

Roelof

Former Member
0 Kudos

Hi Wolfgang Bauer ,

by componet reuse we cant Transfer values between two componets a and b. when we are defining componr a as a used component for component B, it doesnt meant that the values we are entering on the coponent b should be available in coponent A, when we are runnig that.. we are just using the structure available incomponent A. Once the nodesor context are mapped to Component B, all the mapped elements will be like private to B , we cant access those data from A.

Regards

Sarath

Former Member
0 Kudos

Hi,

thanks for your answer.

But there must be a solution how to get data from one component to the other one.

I think it is called external mapping.

regards

thomas_szcs
Active Contributor
0 Kudos

Hello Wolfgang,

you don't need external mapping for that. Your example is supposed to work as it is.

Well, how do you trigger the roundtrip to the server? Best would be to have a separate

button for that with a dummy action behind it.

Second note: Please be aware that if you change the value of both inputfields that bind to

the same context attribute, the outcome will not be deterministic. Usually, the last entry

will win though. So my suggestion is to change one of the input fields to a TextView or

to set it to readOnly.

Best regards,

Thomas

Former Member
0 Kudos

Hi Wolfgang,

did you solve your problem?

I had exactly the same problem here and I couldn't get it to work.

Finally, external mapping did the trick for me. As far as I understand, external mapping only means that you define the mapping from the node in the comp. controller of B to the node in the comp. controller of A not in B, but in the component usage of B in A. To enable this you have to

- declare the node in B as externally mappable and

- create a component usage of B in A (with the mapping).

To understand external mapping, I found the following document very helpful (although it focuses on a different topic) https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8d7cd90-0201-0010-4a8c-dd22fa16... . External mapping is on page 27.

Christoph