gburkel
30th April 2002, 17:24
Hi everybody!

After executing Methods of BOI-Objects (i.e. ChangeSalesOrderHeader) I get an
ChangeResultSalesOrderHeader-Object returned.
This object has a method to get a BaanErrorDoc which IMHO contains the Baan error-numbers and messages.

How can I access those error-information?

The BaanErrorDoc-Object has no Method like getErrorDescription or getErrorCode, whereas the
BaanErrorStructure does ?
But how do I have to bring them together?


thanks in advance
Gabi

Jeyaseelan
3rd May 2002, 10:43
Hai Gapi,
All the baan business object methods has the last argument which is StructError. The error structure contains a message code (usually the Baan application message code), the description of the message in the users language, and a pointer to the element of data where this error occurred in case where multiple elements are retrieved (as in List). Return value for each method is long.

You can access this error information from the JavaClient from where u are calling the BOI.
Define a errorstructure in Javaclient like this

StructError outerror = new StructError();
.....
after calling the BOI just add println statement
System.out.println(outerror);

The return value of the outerror can be decoded in the follwing manner

Return Value Description
0 Successful completion
1 Functional Error
>1 - 99 Operating system error at server end.
>99 - 999 Database related error at server end.

Hope this will help. If u need any specific coding level problem suit me a mail.
Bye.

Jeyaseelan.J

gburkel
3rd May 2002, 15:39
Hi Jeyaseelan,

thank you for your reply. I should have mentioned that I am using broker and one of the standard Objects of the COM-Domain (SalesOrders.ChangeHeader)
). I use the brokernative scripting language.

The describtion you gave, refers IMHO to the BOI-Objects one uses with the Connect-Kit,right?

Here“s a piece of code to demonstrate where my problem is:



//executing the ChangeHeader-Method and getting the resulting object ! --> works fine!

_ChangeResultSalesOrderHeader = myBoiConnection.changeHeader(_RecordSetSalesOrders);

//the resulting object contains error information, but how can I get access to it, in order to print the message to the system-log?
_BaanErrorDoc= _ChangeResultSalesOrderHeader.getBaanErrorDoc ();

//Now I have an BaanErroDoc-Object, but it has no methods for getting the message!

//the BaanErrorStructure has a Method called "getErrorDescription" which should do the job. But I cannot see a relation between the BaanErrorStructure and the BaanErrorDokument :-(


Regards
Gabi

lakoon
15th October 2003, 17:35
Hello Gabi

Do you know in the meantime the solution for your problem?
At the moment i have the same question as you asked one year ago.
In addition: How do i access the result structure.
I'm actually inserting a record into sales order header. The system determines the salesordernumber and writes it back into the communicationstructur between server and broker (i can see the results in the buscomponent logfile). This information is certainly also available in the borker script. I think the method getRecordset....() should be the one.

Thanks in advance

/lakoon

gburkel
16th October 2003, 15:11
Hi Lakoon,

here is an example of the whole process:


//Create SalesOrder
SalesOrderHeaderCreateResult = SalesOrderManager.createHeader(SalesOrdersRecordSet);

//Check for Errors
Number SalesOrderHeaderCreateErr = Number(SalesOrderHeaderCreateResult.getBaanErrorDoc().sizeBaanErrorStructure());
if(SalesOrderHeaderCreateErr > 0)
{
objBaanErrorDoc = SalesOrderHeaderCreateResult.getBaanErrorDoc();
for (j=0; j<SalesOrderHeaderCreateErr;j++)
{
objBaanErrorStruct = objBaanErrorDoc.getBaanErrorStructureAt(j);
System.debug(objBaanErrorStruct.getErrorCode());
System.debug(objBaanErrorStruct.getErrorDescription());
}
} else {
//Get Sales Order Number or any other field of the Sales Order Object
Number orno =Number(SalesOrderHeaderCreateResult.getRecordSetSalesOrders().getSalesOrdersAt(0).getSalesOrder());
}


bye
Gabi

lakoon
16th October 2003, 17:24
Hello Gabi,

thank you.

/Lakoon