cancel
Showing results for 
Search instead for 
Did you mean: 

How to design the context.

Former Member
0 Kudos

I have a view containing an input form. This view has two buttons:

1. "Verify": it calls an RFC which verifies the consistency of the input data.

2. "Create": it calls an RFC which insert the input data in the db.

By importing the two RFC, I got two different Model Objects.

Consequently, in the component controller context I created two

different Model Bound Nodes.

Here is the problem: I have ONE view with its context which should be mapped

to TWO different Model Bound Nodes.

Do you have any suggestion on how to solve this?

Thanks in advance and best regards.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Livio,

Directly using the model node for binding to UI element is always not recommended.

What you can do is copy all the context nodes and attributes which need to be passed to the model structure or used from the model structure from the view to the component controller and map them. Create two model nodes for two seperate models in this component controller and bind them to the model and execute them in the component controller itself. This way you can use all the values on the screen(view via component controller) and pass them on to the model. Same can be done when model is executed. if the model retrns some structure or value, you can always set that to the context of the component controller and hence the view via mapping.

Regards,

Tushar Sinha

Former Member
0 Kudos

Thank you Tushar Sinha.

One more clarification. You say:

"This way you can use all the values on the screen(view via component controller) and pass them on to the model."

This is to be done manually, correct?

Thank you.

Livio

Former Member
0 Kudos

Yes Livio, simply by context mapping. So, whatever change you make at view is reflected to component controller and visa versa if both of them are mapped.

Regards,

Tushar Sinha

Former Member
0 Kudos

My question was not clear.

I meant the "passing them on to the model" is to be done manually.

Correct?

Former Member
0 Kudos

Hi Friend,

Exactly that has to be done manually (Passing The Data to model node). Or if you can manage to create the local node from where you have to pass the data to model node with exactly same structure as model node you can use wdCopyService.

To Use wdCopyService() You can Take reference of this thread

Regards

Jeetendra

Former Member
0 Kudos

Yes my Friend,

Since the Context Value Node structure and Model Node Structure are independent, you manually using

String str = wdContext.current<ValueNode>Element().get<Attr1>();

<Bapi's Input Structure>.set<BapiAttr>(str);

wdContext.node<ModelNode>.bind(<Bapi's Input Structure>);

Regards,

Tushar Sinha