cancel
Showing results for 
Search instead for 
Did you mean: 

How to import Table from Webdynpro to RFC?

Former Member
0 Kudos

In my application there is one RFC that has one import parameter String and a Table for import/export data from webdynpro.

The context of model node and attributes is as follows

A (Root Model Node for RFC)

|....B (Model Sub Node for Output)

|....C (Model Sub Node for Table)

|....x (Model attribute)

|....y (Model attribute)

Table structure in RFC is same as Model node C.

Before Executing RFC using

wdContext.currentAElement().modelObject().execute();

In Java end how to set or add data to x,y attribute so that RFC can get those values from table and insert into the ABAP table.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

use the setter for the attribute

Ex: wdContext.currentCElemement.setx(<Yourvalue>;

Regards

Ayyapparaj

former_member751941
Active Contributor
0 Kudos

Hi SBS,

Try this code.

IWDMessageManager msg = wdComponentAPI.getMessageManager();

try {

String empid = 10020;

//or you can take empid from UI field also

// String empid = wdContext.currentValueNodeElement().getEmployeeID();

Bapi_Employee_Getdata_Input input = new Bapi_Employee_Getdata_Input();

input.setEmployee_Id(empid);

wdContext.nodeBapi_Employee_Getdata_Input().bind(input);

// Calls remote function module BAPI_EMPLOYEE_GETDATA

wdContext.currentBapi_Employee_Getdata_InputElement().modelObject().execute();

// Synchronise the data in the context with the data in the model

wdContext.nodePersonal_Data().invalidate();

} catch (Exception e) {

// TODO Auto-generated catch block

msg.reportSuccess(“Message : “+e.getMessage());

}

Regards,

Mithu

Former Member
0 Kudos

Hi Mithu,

A,B,C not in the same level. The level is

A[RFC Model]>B[Output Model Node]>C[Model representaion of Table]-->{x,y}[Table attributes]

I want to insert for x,y say {xyz,abc} and {mno, pqr} those two set of data.

How to set those values

former_member751941
Active Contributor
0 Kudos

Hi SBS,

Check the code.

try

{

A aInputModel = new A();

for(int i=0;i<2;i++)

{

ZCstruc cDetails = new ZCstruc();

cDetails.setX(wdContext.nodeTest().getTestElementAt(i).getXVal());

cDetails.setY(wdContext.nodeTest().getTestElementAt(i).getYVal());

aInputModel.addC(cDetails);

}

wdContext.nodeA().bind(aInputModel);

wdContext.currentAElement().modelObject().execute();

wdContext.nodeB().invalidate();

}

} catch (WDDynamicRFCExecuteException e) {

msg.reportException("Error in Creation. Please try Again... "+e.getMessage(),true);

}

finally

{

TestModel testModel = (TestModel)WDModelFactory.getModelInstance(TestModel.class);

testModel.disconnectIfAlive();

}

Regards,

Mithu