cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with adding item with ReadXML function

jaccomoolenaar
Participant
0 Kudos

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?

Accepted Solutions (0)

Answers (1)

Answers (1)

jaccomoolenaar
Participant
0 Kudos

I just found out that it has something to do with the user defined fields.... If I leave the UDF's out of the xml it seems to work well. The UDF's in both companies are the same. Isn't it possible to exchange the values of the UDF's through xml??

Regards,

Jacco

Former Member
0 Kudos

hello!!

i have the same problem, if i create the item with

Readxml, if i stay in my own company runs ok, but if i change the company occurs the error.

Ahh and if in the xml file i quit the udf tags.....nothing, the same error, and you say that it runs correctly if the xml file not has udf tags

any idea? pleaaaase