on 06-14-2011 3:27 PM
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
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)
{
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
8 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.