Skip to Content
0
Former Member
Aug 29, 2008 at 06:38 PM

At Invoke of: Update,A COM exception has been encountered

1144 Views

Hi Guys,

I just use java to access the data of SAP B1, and I met a trouble, I have no idea.

I have imported into SAP B1 from file and export the SAP data to a file, just in business partner module,

it's ok.

I also can export data from ORDR of SAP B1 database to a file.

But I can't work out importing data from external data about Order module, just table ORDR.

I have search the WEB for 2 days, just nothing!!

I will appreciate to your great help. Could you please give me a sample, should be perfect!!!!

ERROR LOG about updating operation-

!!!Error***-A COM exception has been encountered:

At Invoke of: Update

Description: The server threw an exception.

com.sap.smb.sbo.wrapper.com.ComFailException: A COM exception has been encounter

ed:

At Invoke of: Update

Description: The server threw an exception.

at com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Native Method)

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)

==========================================================

ERROR LOG about adding operation is similar-

!!!Error***-A COM exception has been encountered:

At Invoke of: Add

Description: The server threw an exception.

com.sap.smb.sbo.wrapper.com.ComFailException: A COM exception has been encounter

ed:

At Invoke of: Add

Description: The server threw an exception.

......

=================================================================

the following just is some code.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

ICompany vCompany = SapSdkHelper.getICompany();

vCompany.connect();

IDocuments aOrder = SBOCOMUtil.newDocuments(vCompany,

SBOCOMConstants.BoObjectTypes_Document_oOrders);

IDocument_Lines line = aOrder.getLines();//line should be the data in table rdr1

int successCount = 0;

for (String[] rowData : dataList) {

Integer key = new Integer(rowData[0]);

if (aOrder.getByKey(key)) {

aOrder.setAddress(aOrder.getAddress()+"test");

int rr = aOrder.update();

SBOErrorMessage errMsg = vCompany.getLastError();

System.out.println(errMsg.getErrorMessage());

System.out.println(rr);

continue;

}

aOrder.setDocNum(key);

...

aOrder.setCardCode(rowData[2]);

aOrder.setCardName(rowData[3]);

aOrder.setDocTotal(Double.valueOf(rowData[4]));

aOrder.setDocType(SBOCOMConstants.BoDocumentTypes_dDocument_Items);

//aOrder.setDocCurrency("RMB");

//aOrder.setDocRate(10.1);

line.setItemCode("A00001");

line.setItemDescription("description Testing");

line.setQuantity(new Double(3));

line.setPrice(new Double(3));

//line.setRate(10.1);

//line.setCurrency("RMB");

//line.add();

long rc = aOrder.add();

SBOErrorMessage errMsg = vCompany.getLastError();

System.out.println(errMsg.getErrorMessage());

System.out.println(rc);

successCount++;

}

vCompany.disconnect();