📚 SAP Business One SDK Help

GetLastError Method
See Also 
errCode

The error code. If no error occurred, the code is 0.

errMsg

The error message. If no error occurred, the message is an empty string.

When applicable, the message also contains the application error code, for example, 10001090 - Posting period missing.

More information about the error with this code can be found in the application help, accessible in the application via the Help --> Documentation --> Online Help. In the help, you can search for the error code or you can navigate to SAP Business One --> Message Documentation.

Description

Retrieves the error code and message for the last error for any object tied to the Company object.

Syntax

Visual Basic
Public Sub GetLastError( _
   ByRef errCode As Long, _
   ByRef errMsg As String _
) 

Parameters

errCode

The error code. If no error occurred, the code is 0.

errMsg

The error message. If no error occurred, the message is an empty string.

When applicable, the message also contains the application error code, for example, 10001090 - Posting period missing.

More information about the error with this code can be found in the application help, accessible in the application via the Help --> Documentation --> Online Help. In the help, you can search for the error code or you can navigate to SAP Business One --> Message Documentation.

Remarks

You must call this method immediately after the API call that caused the error. The error information is lost when you call other methods.

If an error is associated with a system error, a description of the system error is included.

Error Codes

Code (errCode)

Description (errMsg)

0

(Empty string - no error was found)

-103

Connection to the company database has failed.

-104

Connection to the license database has failed.

-105

The observer.dll init has failed.

-106

You are not connected to a company.

-107

Wrong username and/or password.

-108

Error reading company definitions.

-109

Error copying dll to temp directory.

-110

Error opening observer.dll.

-111

Connection to SBO-Common has failed.

-112

Error extracting dll from cab.

-113

Error creating temporary dll folder.

-114

No server defined.

-115

No database defined.

-116

Already connected to a company database.

-117

Language is not supported.

-118

Exceeded the number of max concurrent users.

-1001

The field is to small to accept the data

-1002

Invalid row.

-1103

Object not supported.

-1104

Invalid XML file.

-1105

Invalid index.

-1106

Invalid field name.

-1107

Wrong object state.

-1108

The transaction is already active.

-1109

There is no active transaction in progress.

-1110

Invalid user entered.

-1111

Invalid file name.

-1112

Could not save the XML file.

-1113

Function not implemented.

-1114

XML validation failed.

-1115

No XML schema was found to support this object.

-1120

Ref count for this object is higher then 0.

-1130

Invalid edit state.

-2000

SQL native error.

-2050

No query string entered.

-2051

No value found.

-2052

No records found.

-2053

Invalid object.

-2054

Either BOF or EOF have been reached.

-2055

The value entered is invalid.

-3000

The logged on user does not have permission to use this object.

-3001

You do not have a permission to view this fields data.

-8004

Company connection is dead.

-8005

Server connection is dead.

-8006

Error opening language resource.

-8007

License failure.

-8008

Error initializing the DB layer.

-8009

Too many users connected.

-8010

No valid license is present.

-8011

Error initializing Business objects layer.

-8012

Company version mismatch.

-8013

Error initializing the application environment.

-8014

Invalid command.

-8015

Missing parameter. .

-8016

Unsupported object.

-8017

Invalid command for this object.

-8018

Internal permission error.

-8019

Dll is not initialized.

-8020

Language init error.

-8021

Timeout encountered.

-8022

Init error.

-8023

Wrong user or password.

Example

See Also