cancel
Showing results for 
Search instead for 
Did you mean: 

passing table values to RFC

Former Member
0 Kudos

how can i pass tables to RFC as input?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If I understand you right, you want to pass the values of a webdynpro table to an RFC. In this case, you have to loop through the context and individually pass the values to the RFC input elements.

Regards,

Vaishnavi

Answers (2)

Answers (2)

former_member186148
Active Participant
0 Kudos

Hello prasanthi!

Let's imagine that your model node has following structure:

ModelNode

...+---TableNode

..............+---- tableAttr1

..............+---- tableAttr2

And that you should fill table from nodeSource (another node from context).

So you can fill table like this:

// begin loop for source
TableNodeType table = new TableNodeType(model);
// set attributes of your table node:
table.setTableAttr1( value1 );
table.setTableAttr2( value2 );
etc...
// add a record to RFC table
bapiInput.addTableNode(table);
// end loop for source

TableNodeType is a type of your TableNode. This type you can see in property "Structure" of property group "Model" of TableNode properties.

regards, Lev

Edited by: Lev Kulaev on Jul 14, 2010 12:09 PM

Edited by: Lev Kulaev on Jul 14, 2010 12:11 PM

Former Member
0 Kudos

Thanks for the replies.

I have actually written the below code, but not getting the output.

Model1 mod=new Model1();

zbapi_Input ip=new Zbapi_Input(mod);

ztable tab1;

tab1=new Ztable(mod);

tab1.setcode("2100");

input.addZtable(tab1);

wdContext.nodezbapi_Input ().bind(ip);

try {

wdContext.currentzbapi_Input Element().modelObject().execute();

} catch (ARFC2ModelExecuteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

p330068
Active Contributor
0 Kudos

Hi Prasanthi,

Please try this

zbapi_Input objinput =new Zbapi_Input(mod);
wdContext.nodezbapi_Input ().bind(objinput );

ztable tab1 = null;
tab1=new Ztable(mod);

tab1.setcode("2100");
objinput.addZtable(tab1);

try {
wdContext.currentzbapi_Input Element().modelObject().execute()

} catch (ARFC2ModelExecuteException e) {
        e.printStackTrace();
}fianlly{
       wdContext.currentzbapi_Input Element().modelObject().modelInstance().disconnectIfAlive();
}

Refer to

Hope it will helps

Regards

Arun

former_member186148
Active Participant
0 Kudos

Hi Prasanthi!

For output you should invalidate all output nodes one after another after executing model. For example, If you have following node structure:

ModelNode

....+---InputNode

....+---OutputNode

..............+---SomeResults

you should invalidate code like this:


// executing a model
wdContext.nodeOutputNode.invalidate();
wdContext.nodeSomeResults.invalidate();

Former Member
0 Kudos

i have done that already. its giving error "Typed model execution failed". Any idea about this error?

Thanks.

former_member186148
Active Participant
0 Kudos

Please post here your code from model creation to execution and invalidation result nodes

regards, Lev

Former Member
0 Kudos

Hi,

the Typed model execution can also simply result in the missing configuration of the RFC destination data.

WD_MODELDATA_DEST

WD_RFC_METADATA_DEST

In case of 7.2 you have simply to configure these in the nwa floorplan app.

If e.g. WD_MODELDATA_DEST is missing, deployment and application execution are successful, but the RFC calls will fail with the typed mode execution exception.

Hope this helps,

Artjom

Former Member
0 Kudos

Hi Lev,

Thanks to your answer, I have finally get solved my problems!

Best regards,

Marcelo

Former Member
0 Kudos

Hi Prasant,

First you have to pass values of the table to Model node with context mapping.Model node will be the 'Import ' parameters of the RFC. Then you have to write a method to execute the RFC with .execute() statement.

After that you can able to pass the values from the table to the desired RFC.Check that context binding has been done properly in the view.

Regards,

Sukalyan