cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate records in input structure of model node

Former Member
0 Kudos

Hi,

Following is the way, I am assigning data to a model node:

//Clearing the model input node
for (int i = wdContext.nodeInsppointdata().size(); i > 0; i--)
	wdContext.nodeInsppointdata().removeElement(wdContext.nodeInsppointdata().getElementAt(i - 1));

//Creating element of the input model node
IPrivateResultsView.IInsppointdataElement eleInspPointData;

//START A
Bapi2045L4 objBapi2045L4_1 = new Bapi2045L4(); //Instance of the input structure type

//Populating data
eleInspPointData = wdContext.nodeInsppointdata().createInsppointdataElement(objBapi2045L4_1);
wdContext.nodeInsppointdata().addElement(eleInspPointData);

eleInspPointData.setInsplot(wdContext.currentContextElement().getInspectionLotNumber());
eleInspPointData.setInspoper("0101");

//Inspection_Validate_Input is the model node. Adding instance to main node
wdContext.currentInspection_Validate_InputElement().modelObject().addInsppointdata(objBapi2045L4_1);
//STOP A


//Now executing the RFC

Above code seems to be fine. Works very well for the first time. But, when the user clicks on the same button for the second time, I can see duplicate records getting passed to RFC [Debugged using external breakpoint]. When I am sending 4 records, I can see there are total of 6 records. The number keeps increasing when clicked on the button.

I am adding multiple records to input model node using the code from START A to STOP A. Does the code look fine? Why do I see multiple records?

Thanks,

Sham

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Issue solved.

After executing RFC, I used following code to clear the input model node:


try 
{
     wdContext.current<yourBAPI>_InputElement().modelObject().get<yourinputnode>().clear();
}
catch (Exception e1) 
{

}