cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a mandatory parameter document for the interface when calling DI API in Java

ZHD
Explorer
0 Kudos
Excuse me, currently I am using Java to call the DI API interface to operate on SBO. However, I often spend a lot of time troubleshooting parameters. Some parameters are mandatory and there seems to be no explanation in the document. Do any friends know where I should go to find some mandatory parameters for the interface? thanks

Accepted Solutions (1)

Accepted Solutions (1)

Johan_H
Active Contributor

Hi,

If you mean parameters for the connection to the SBO database, you can take a look at the example code that comes with the SDK when you install it. The documentation is notoriously bad. It is best to to create a method to make the connection. Determine all parameters from the documentation or translate this vb.net code to java:

 vCmp = New Company
With vCmp
.Server = "***"      'Name of the database Server 
.DbUserName = "***"  'Database user
.DbPassword = "***"  'Database user password
.LicenseServer = "***"  'Name of the server where the license server is installed
.CompanyDB = "***"      'The name of the company database
.UserName = usr         'The B1 user name
.Password = pwd         'The B1 user password
.language = BoSuppLangs.ln_English        'The logon language
.DbServerType = BoDataServerTypes.dst_MSSQL2019
.Connect 'Returns and integer. 0 = connection opened successfully
End With

If you mean mandatory parameters for transactions (sales orders, invoices, purchase orders, etc.), there are very few absolutely mandatory parameters. However, there can be more if the system was not setup correctly. What I mean is, if certain default settings were not determined, you will need to provide them when you try to create a transaction.

Absolutely mandatory parameters for the transaction header:

  • CardCode

Absolutely mandatory parameters for the transaction lines:

  • ItemCode
  • Quantity

Absolutely mandatory parameters for creating master data (items, business partners):

  • CardCode / ItemCode

 

ZHD
Explorer
Thank you for your answerI am currently installing SBO on the server for local testing, and I am thinking of creating a business partner. However, I have found that even after setting up some regular settings, it still does not work. Therefore, I am thinking of coming to the forum to check if there are any relevant files. Thank you again
Johan_H
Active Contributor

When creating objects with the Di API, it is probably good to know the following:

  • When debugging DI API code, the error is usually returned directly when a parameter requires a certain enumerated value, or data type, and you provide the incorrect one. All other errors are returned by functions like Add, Update, and Delete. generally speaking 0 means success, and any other integer (usually negative) means an error occurred. In this case you will have to retrieve the error code and description yourself with the method: vCmp.GetLastError(errNr, errMsg) Please note that you must provide the variables for this method, which will then fill them.
  • The GetLastError method will always only return the first error it encounters. This means that you may still have to troubleshoot your code many times.

Answers (0)