cancel
Showing results for 
Search instead for 
Did you mean: 

executing a model object?

Former Member
0 Kudos

Hi Gurus,

In the onQuery method of OVS help given,

<i>public void onQuery(IWDNodeElement queryInputNodeElement, IWDNode queryOutputNode) {

IPublicTestUser.IName4Element input4 =

(IPublicTestUser.IName4Element) queryInputNodeElement;</i>

IWDNodeElement is type casted into IPublicTestUser.IName4Element.

Can any one give me some clues upon this functionality.

When I tried for similar scenario I am getting exception as "java.lang.ClassCastException".

My custom controller has an input model node and NameN Value Node.Value entered by user is available in NameN.

I want to pass this to BAPI as input parameter.

Using the OVS code as reference I have written the following code:

<i>IWDNodeElement element = wdContext.currentNameNElement();

IPublicCust.IYyh190_Test_InputElement input = (IPublicCust.IYyh190_Test_InputElement) element;</i>

Then Iam getting this exception "java.lang.ClassCastException".

Can you please correct me if I am wrong or let me know whats happening here.

Answer given in this was helpful in understanding this concept.

Regards,

ND.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Nagaraju,

Not sure but...

Seems that you have node in custom controller, and corresponding mapped node in view controller. You add OVS extension in custom controller, but parameter to the OVS methods comes from view, so in fact node type here is IPrivate<ViewName>.IName4Element

VS

Former Member
0 Kudos

Hi Valery Silaev,

Yes thats the way OVS is working.

Let me say my basic requirement for which I was using this concept.Let me know if we have some better ways in achieving it.Thanks in advance.

My view controller has a Value node and attribute.

My component controller also has Value node and attribute which is binded with the one in View controller.

Now the component controller has model node.

I want to execute the model using the value inside the Value node.

Can you please let me know the possible ways for this kind of requirement.

Regards,

ND

Former Member
0 Kudos

Hi,

Looking at your original post, what you are trying to do is not correct. The value node type and the model object type are not compatible, so you can't typecast. Hence you are getting the ClassCastException.

If you want to use the values contained in the value node as an input to the model, then you will have to fetch values from the value node and pass it using the setters of the model.


PublicCust.IYyh190_Test_Input input = new PublicCust.IYyh190_Test_Input();

input.set<attribute name>(<value from value node>);

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

I could not do that.I am getting some error when I am doing that.

This is what I have written in my custom controller.

wdDoInit(){

Yyh190_Test_Input input = new Yyh190_Test_Input();

wdContext.nodeYyh190_Test_Input().bind(input);

}

public void execute_bapi( ){

try{wdContext.currentYyh190_Test_InputElement().modelObject().execute();

}catch(Exception e){

}

}

Where and how should I bind the Model Node value to input.

Can we do that in init method.

Regards,

ND.

Former Member
0 Kudos

Hi

What kind or error message you got?

See this Thread

/message/2187817#2187817 [original link is broken]

Kind Regards

Mukesh