0

We are trying to integrate SAP Business One DI Server with JAVA. Checked help documents in SDK for DI Server but it is available for .NET only.

Don't want to use B1WS as we came to know that B1WS is not stable and has lots of bugs. Also checked for Python flask RESTful application but it has limited functionality.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Anup Ganatra
  • 366
  • 1
  • 6
  • 23

1 Answers1

1

The following code should allow you to connect to a "Company" object and from there perform your tasks (DI - NOT UI).

    import com.sap.smb.sbo.api.*;

public static void main(String[] args) 
{
    ICompany company;
    IDocuments document;    
    SBOCOMUtil util = new SBOCOMUtil();
    company = util.newCompany();
    try 
    {
        company.setServer( "sqlservername" );
        company.setCompanyDB( "dbname" );
        company.setUserName( "manager" );
        company.setPassword( "manager" );
        company.setLanguage(com.sap.smb.sbo.api.SBOCOMConstants.BoSuppLangs_ln_English);
        company.setDbUserName("sa");
        company.setDbPassword("pwd");
        company.setUseTrusted( new Boolean(false) ); 
        int result = company.connect();
        System.out.println("Company: " + company.getCompanyName());
        // analyze connection result
        if ( result != 0 ) 
        {
            System.out.println("Connection error: " + result);
        }
        else 
        {
            System.out.println("Connection success, company name: " + company.getCompanyName() );
        }
    }
    catch(SBOCOMException ex)
    {
        System.out.println(ex.getStackTraceString());
    }
    finally 
    {
        company.disconnect();
    }
}

Also take a look at the following path; "C:\Program Files (x86)\SAP\SAP Business One DI API\JCO\LIB" where you can find the wrapper for DI API also "C:\Program Files (x86)\SAP\SAP Business One SDK\Help" there should be a JCO zip with more details regarding the JAVA Approach. Generally, documentation is very poor regarding Java. Your best approach would be either the B1i or the COM solutions.

Regards,

enshadowed_

enshadowed_
  • 99
  • 1
  • 10