Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Duplicate records in input structure of model node

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

Former Member
Not what you were looking for? View more on this topic or Ask a question