cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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();

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

It's about updating data of sale Order.

Former Member
0 Kudos

Just refer to

I got it.

If you have any question about this issue, please contact me.

For SAP B1, just need to patch java.exe, if you develop/test something in IDE you should also patch javaw.exe, please notice the right path used in IDE.

Just my steps-

1. download the Visual studio express 2008 from microsoft.com and install it online(no need to download SQLSERVER Express)

2. backup the original exe file, java.exe/javaw.exe

3. edit the PATH environment variable plus 'C:Program FilesMicrosoft Visual Studio 9.0VCin'

4. open CMD window and enter into %JAVA_HOME%/bin/

5. Use dumpbin.exe to check the original stack size

dumpbin.exe /headers java.exe

find line: 40000 size of stack reserve

It means the current stack size is 256k

6. Use editbin.exe to patch the exe, for example with 2m stack size

2m = 2 * 1024 *1024 bytes = 2097152 bytes

editbin.exe /stack:2097152 javaw.exe

7. Use dumpbin.exe to verify the patch.

dumpbin.exe /headers java.exe

dumpbin.exe /headers javaw.exe

find line: 200000 size of stack reserve

It means the current stack size is 2m

IT'S OKAYYYYYY.

The version of SAP B1 is 7.10.32 SP:00 EF:2.

The version of SDK just is contained in the SAP B1.

Hope it can help you a little.

MZ

Former Member
0 Kudos

Come on, please give me some inputs.

The version of SAP B1 is 7.10.32 SP:00 EF:2.

The version of SDK just is contained in the SAP B1.

Many Thanks,

MZ

Nussi
Active Contributor
0 Kudos

hj,

it's not like we don't want to help you - most people here don't use java.

people here are primary developing in visual studio c# or vb.net.

that's why it is hard for me to control your code.

what i would do in your situation is the following:

create a single procedure that

1. only uses the getbykey method

2. change a single value

3. and than update.

don't use the whole code you posted.

when the simple procedure works you know at least that you can update orders.

than the error is in the big code snippet.

lg David

Former Member
0 Kudos

Hi David,

Any way, thank you very much.

Even the following simple code is wrong.

I suppose my envirement met something wrong configuration.

//Or call method newDocuments... is the same error

// and updating module 'BoObjectTypes_Document_oDrafts' will raise the same error

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

IDocuments aOrder = SBOCOMUtil.getDocuments(vCompany,SBOCOMConstants.BoObjectTypes_Document_oOrders,1);

if (aOrder.getByKey(key)) {

System.out.println("aOrder:getCardCode:"+aOrder.getHandWritten());

System.out.println("getDocObjectCode:"+aOrder.getDocObjectCode());

// update a simple property raises same error too

int rr = aOrder.update();

SBOErrorMessage errMsg = vCompany.getLastError();

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

System.out.println(rr);

vCompany.disconnect();

return;

}

So which expert can give me any input? Not error in code, but maybe in config, or needs SP?

I don't know, I just use SAP/SDK for 2-3 weeks.

Thank you again, David.