cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Model Initialization issue

praveenkumar_kadi
Active Contributor
0 Kudos

Hi,

I am getting issues in initilization of RFC model. I have RFC context node structure as follows:

Root node

-> node_input

->node_1

->low_at

->high_at

->node_2`

>low_at

>high_at

->node_output

->att1

->att2

node_1 and node_2 are the input nodes along with att1, att2.

How we do initialize whole input model here?

Thanks

Praveen

Accepted Solutions (0)

Answers (2)

Answers (2)

p330068
Active Contributor
0 Kudos

Hi Praveen

You need to create object of the input node like

Node_input input = new Node_input();

wdContext.nodeNode_input.bind(input);

Set the parameter for Abstruct List using : [Initializing AbstractList Model in Custom Controller |;

then


try
{
  //Execute the model
  wdContext.current<ModelName>_InputElement().modelObject().execute();
}
catch (com.sap.tc.cmi.exception.CMIException e)
{
  //In case of error when executing the RFC, we catch the exception.
  wdComponentAPI.getMessageManager().reportWarning(e.getMessage());
}
finally {
  //Make sure the connection is closed once the RFC's execution has finished
  wdContext.current<ModelName>_InputElement().modelObject().modelInstance().disconnectIfAlive();
}

Refer to [How to Call RFC from Web Dynpro Application|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10c2c440-7f8c-2b10-7db0-dce34360f118]

Hope it will helps

Best Regards

Arun Jaiswal

former_member182598
Active Contributor
0 Kudos

Hi Praveen,

Go as follows:

<RFC NAME>_INPUT bapiInput;

bapiInput = new <RFC NAME>_INPUT();

<TYPE OF NODE_1> node1 = new <TYPE OF NODE_1>();

<TYPE OF NODE_2> node2 = new <TYPE OF NODE_2>();

bapiInput.setnode_1(node1);

bapiInput.setnode_2(node2);

wdContext.nodenode_input().bind(bapiInput);

Thanks

Prashant

praveenkumar_kadi
Active Contributor
0 Kudos

Thanks prashant,

I have input type as AbstarctList for node1. and need to set those input node (node_1 and node_2)

why we need to add AbstarctList ?

Thanks

Praveen

0 Kudos

Hi Praveen,

if a RFC contains sructure in Import parameters that will reflect in webdynpro java side as AbstractList.

you have to set the parameters to the input node to send the values to backend.

Use the parasanth's code to set the values to the rfc input nodes.

here <TYPE OF NODE_1> or <TYPE OF NODE_2> are the database structure's which are given as the ref type in RFC.

Hope this will help you.

Thanks & Regards,

Bhargava.

former_member185879
Active Contributor
0 Kudos

Hello Praveen,

I hope you are talking about the Nodes which is available under the Tables Tab of RFC. If this is the case, you dont want to add Abstract List, you need to add element for the same.

For Ex:

RFC_1 rfc1 = new RFC_1();

Node1 node1 = new Node1();

node1.setABC("Hello");

rfc1.addNode1(node1);

This adding of elements will run in For Loop.

Reply for queries.

Regards

Nizamudeen SM