cancel
Showing results for 
Search instead for 
Did you mean: 

Problems while setting Multiple Rows of data as Table Parameter to the RFC

Former Member
0 Kudos

Hi All,

I need to pass a structure <b>Zess_Testtable</b> as a table parameter to the RFC.

This structure needs to hold multiple rows.

Currently I am using the below mentioned LOC.

<b>wdContext.currentZesstest1_InputElement().modelObject().addZpernr1(objESSTable);</b>

where objESSTable is a object of the Zess_Testtable structure.

However the above code works when the structure objESSTable has single of data.

For setting multiple rows of data I tried to use the below code:

<b>wdContext.nodeZesstest1_Input().nodeZpernr1().bind(objVector);</b>

Here objVector is object of Vector class holding multiple rows of the sturcture objESSTable.

But this is not working.

Please help!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sanjay,

Assuming a model node, you can do something like this:

//BAPI model class

Z_Dsktp_Wi_Container_Read_Input read = new Z_Dsktp_Wi_Container_Read_Input();

//bind node with the model

wdContext.nodeZ_Dsktp_Wi_Container_Read_Input().bind(read);

//Swwwimulti is a structure (work area in ABAP terms).. add such multiple work areas to the BAPI

for (int i = 0; i < reqWi_Ids.size(); i++) {

Swwwimulti multi = new Swwwimulti();

multi.setWi_Id((String) reqWi_Ids.elementAt(i));

//add structure to the model

read.addIt_Wi_Id(multi);

}

Regards,

Rajit Srinivas

former_member206397
Contributor
0 Kudos

Hi Sanjay,

You need to put the structure into a loop for setting the

value of multiple rows.Please try with the procedure bellow

// Code for creating structure

ITechnicalDescription technicalDescription =

TechnicalDescriptionFactory.newTechnicalDescription(

"CO_DEMO",

"CO_DEMO_DESCRIPTION",

resourceAccessor,

locale);

IStructureInfo output =

technicalDescription.getOutputStructureInfo();

IStructureInfo accountStructure = output.addStructure("DemoOutPutData");

accountStructure.setMultiplicity(IStructureInfo.MULITIPLICITY_0_N);

accountStructure.addAttribute("Account", IAttributeInfo.BASE_STRING);

// Code for setting the value of the structure with multiple row

IStructure output = executionContext.getOutputStructure();

for(int i=0;i < wdContext.node_<Name>.size(); i++)

{

IStructure accntstr= output.addStructure("DemoOutPutData");

accntstr.setAttributeValue("Account" ,<value> );

}

I think this will be helpful.

Thanks

Chandan