I am trying to send all item modifications (add and updates) in one company to several other companies. I use XML in other to achieve this. Now I have encounterd a problem with the ReadXML function. The code I use is (java):
<code>
try
{
IItems sourceItem = null;
try
{
sourceItem = SBOCOMUtil.newItems(oCmp);
}
catch (SBOCOMException e)
{
System.out.println("Exception while creating new items Object");
}
if (sourceItem.getByKey("1010101"))
{
System.out.println("Item found");
String path = sourceItem.getItemCode() + xmlFileOrderFileType;
oCmp.setXmlExportType(SBOCOMConstants.BoXmlExportTypes_xet_ExportImportMode);
sourceItem.saveXML(path);
ICompany comp2 = connectToSbo("sboontw2","SBODemo_Dutch2","manager","manager");
if (comp2 != null)
{
comp2.setXmlExportType(SBOCOMConstants.BoXmlExportTypes_xet_ExportImportMode);
IItems targetItem = null;
try
{
targetItem = SBOCOMUtil.newItems(comp2);
}
catch (SBOCOMException e)
{
System.out.println("Exception while creating new items Object2");
}
targetItem.getByKey(values);
targetItem.getBrowser().readXml(path,new Integer(0));
System.out.println("Itemcode: " + targetItem.getItemCode());
}
}
}
catch (Exception e)
{
System.out.println("Error in class" + this.getClass().getName());
e.printStackTrace();
}
</code>
The error I get is:
Error in classConnector.SAPBOConnectorThread
com.sap.smb.sbo.wrapper.com.ComFailException: A COM exception has been encountered:
At Invoke of: ReadXml
Description: De server heeft een uitzondering geretourneerd.
at com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Native at com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Unknown Source)
at com.sap.smb.sbo.wrapper.com.Dispatch.callN(Unknown Source)
at com.sap.smb.sbo.wrapper.com.Dispatch.call(Unknown Source)
com.sap.smb.sbo.api.DataBrowser.readXml(Unknown Source)
If I try this when the source company and the target company are the same everything works, but if they are different the error occurs. Note that the target company is a copy of the source company and that data errors should not occur!
Does anyone have an idea of what the problem is?