on 04-08-2008 11:13 AM
in sap business one sdk how DI API is connect.
hi
threre r two method for connection
1. single sign one connection
2 seprate connection
In the single sign one connection we connect to UI api nd DI api ,
In the seprate connection we r connect seprate DI api nd UI api ,
This is single sign one code. connect to di api
private SAPbobsCOM.Company oCompany;
private void SetApplication() {
// *******************************************************************
// // Use an SboGuiApi object to establish connection
// // with the SAP Business One application and return an
// // initialized appliction object
// *******************************************************************
SAPbouiCOM.SboGuiApi SboGuiApi = null;
string sConnectionString = null;
SboGuiApi = new SAPbouiCOM.SboGuiApi();
// // by following the steps specified above, the following
// // statment should be suficient for either development or run mode
sConnectionString = System.Convert.ToString( Environment.GetCommandLineArgs().GetValue( 1 ) );
// // connect to a running SBO Application
SboGuiApi.Connect( sConnectionString );
// // get an initialized application object
SBO_Application = SboGuiApi.GetApplication( -1 );
}
private int SetConnectionContext() {
int setConnectionContextReturn = 0;
string sCookie = null;
string sConnectionContext = null;
int lRetCode = 0;
// // First initialize the Company object
oCompany = new SAPbobsCOM.Company();
// // Acquire the connection context cookie from the DI API.
sCookie = oCompany.GetContextCookie();
// // Retrieve the connection context string from the UI API using the
// // acquired cookie.
sConnectionContext = SBO_Application.Company.GetConnectionContext( sCookie );
// // before setting the SBO Login Context make sure the company is not
// // connected
if ( oCompany.Connected == true ) {
oCompany.Disconnect();
}
// // Set the connection context information to the DI API.
setConnectionContextReturn = oCompany.SetSboLoginContext( sConnectionContext );
return setConnectionContextReturn;
}
private int ConnectToCompany() {
int connectToCompanyReturn = 0;
// // Establish the connection to the company database.
connectToCompanyReturn = oCompany.Connect();
return connectToCompanyReturn;
}
.................this is code for cneect ui api nd di api..............
...........................................////////........................................this is code for connect for di api seprate.....................................................
Dim oCompany As SAPBobsCOM.Company
Dim lRetCode, lErrCode As Long
Dim sErrMsg as String
'Instanciate a Company object
oCompany = New SAPBobsCOM.Company
oCompany.Server = "(local)"
oCompany.CompanyDB = "SBODemo_US"
oCompany.UserName = "manager"
oCompany.Password = "manager"
oCompany.Language = ln_English
Sample: Use Windows Auth. to SQL Server
oCompany.UseTrusted = True
Set AddOn identifier (new in 2004)
oCompany.AddOnIdentifier = Your Add-On Identifier
lRetCode = oCompany.connect
'Check Return Code
If lRetCode <> 0 Then
oCompany.GetLastError lErrCode, sErrMsg
End If
.applay any one code for coonection tp di api....
if u have any problem replay me ,
nd if u r satisfied than give me rewards point.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Venkat,
I am not 100% sure of what you are asking. Are you asking how to connect to the DI API using code? Can you give more detail on what you are looking for?
The DI API connection through code you may create is listed in detail in the SAP Business One SDK Help Center Documentation that comes with the SAP Business One SDK as well as the DI API sample code that comes with the SDK.
Eddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.