Skip to Content
0

UI/DI API connection to SAP HANA

Feb 10, 2017 at 09:34 AM

365

avatar image
Former Member

Hello everybody,

I try to set up a UI/DI API connecting from local SAP HANA Client to remote SAP HANA Server. UI connection is successful and SBO_Application object is created with success from code below:

sConnectionString = Environment.GetCommandLineArgs().GetValue(1).ToString();

SboGuiApi.Connect(sConnectionString);

SBO_Application = SboGuiApi.GetApplication();

I even get

ret_Url = SBO_Application.XSEngineBaseURL;

with success.

Though when I try to get DI company object:

oCompany = new SAPbobsCOM.Company();
oCompany = (SAPbobsCOM.Company)SBO_Application.Company.GetDICompany();

I get an exception "Invalid Memory Access"

Alternatively I tried to connect with code below and got connection error from sap with code -119 and message "Database server type not supported"

The code is:

public void setApplication()
        {
            SAPbouiCOM.SboGuiApi SboGuiApi = null;
            string sConnectionString = null;
            SboGuiApi = new SAPbouiCOM.SboGuiApi();
            sConnectionString = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));
            SboGuiApi.Connect(sConnectionString);
            SBO_Application = SboGuiApi.GetApplication(-1);
        }


        public int SetConnectionContext()
        {
            int setConnectionContextReturn = 0;
            string sCookie = null;
            string sConnectionContext = null;
            oCompany = new SAPbobsCOM.Company();
            sCookie = oCompany.GetContextCookie();
            sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie);
            if (oCompany.Connected == true)
            {


                oCompany.Disconnect();


            }
            setConnectionContextReturn = oCompany.SetSboLoginContext(sConnectionContext);
            return setConnectionContextReturn;
        }


        public int ConnectToCompany()
        {


            int connectToCompanyReturn = 0;
            connectToCompanyReturn = oCompany.Connect();
            var error = oCompany.GetLastErrorDescription();
            return connectToCompanyReturn;
        }

Finally, I used HanaConnection object from Sap.Data.Hana.v4.5.dll and everything worked alright, managed to retrieve data from SAP HANA Database.

Any suggestions on helping me to solve this problem are much appreciated.

Kind Regards,

Dimitris

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Feb 10, 2017 at 09:50 AM
0

Hi Dmitris,

Have you tried re-installing the DI API?

Pedro Magueija

LinkedIn | Twitter | Blog

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Pedro,

that did the trick. Once again thank you very much for your quick and accurate response.

Kind Regards,

Dimitris

0