cancel
Showing results for 
Search instead for 
Did you mean: 

Context Mapping - generall problem

Former Member
0 Kudos

Hi,

sorry for this question, but I can't understand and found no other topic:

Situation:

1. I have created a Model (includes as Input a structure - only a line not a table and as output a single value)

and a custom controller with a model node and mapped id via model Binding to the model

2. I have created a View which includes a model node in the context which is mapped to the custom controller via context binding.

3. I fill the modelnode of the view via set methods like this wdContext....().setChildid(1);

4 than i call the execute method in the custom controller

and run the Functionmodule but I get the message that the necessary structure is not delivered

5. I try in the init method of custom controler this, but it dosn't work

Zmda_Prognose_Set_Node_Input input = new Zmda_Prognose_Set_Node_Input();

wdContext.nodeMDAPrognoseFubaSetNode().bind(input);

I think I have a general problem - I hope anyone can spend the time to answer this questions - Thanks Stefan

Accepted Solutions (1)

Accepted Solutions (1)

Yashpal
Active Contributor
0 Kudos

Hi Stefan,

Its sorry to say that u r not cleared with the concept of mapping and binding. mapping means the data is copied to the mapped nodes and we bind that to any UI Control so that it can display the data.u r saying that the data u have to pass is a structure so in ur model a class is created for that structure . so in order to invoke that RFC an object of that class is to be passed .first create object of that class ,set the attributes using setter methods and than pass that object to the execution method ..this will solve ur problem.

Thanks ,

Yashpal

Former Member
0 Kudos

Thanks for this answer,

but I think I try it:

cctest (Customcontroler Context)

->xyz (Modelnode type mystruc)

->struc (Structure)

-> Value1

-> Value2

vctest (View Context)

->xyz (Modelnode)

->struc (Structure type mystruc)

-> Value1

-> Value2

I mapped it via Context binding.

Now, I try to fill the values in the View

mystruc hello = new mystruc();

hello.setvalue1("a")

hello.setvalue2("b")

wdContext.createstruc(test);

If i try to get the values in the customcontroler

wdThis.wdGetContext().currentstrucElement().getValue1()

I get a nullPointer Exception

Can anybody help?

Stefan

Former Member
0 Kudos

If you get a NullPointerException in the line

wdThis.wdGetContext().currentstrucElement().getValue1()

which can also be written as

wdContext.currentstrucElement().getValue1()

this means that the node "struc" has no <b>current </b>element.

There are two possibilities:

- The lead selection of node "struc" is -1 (IWDNode.NO_SELECTION)

- No element is stored in node "struc"

Verify this and keep in mind that <b>mapped </b>nodes are only references (here: view context -> custom controller context -> model)

Armin

Answers (0)