cancel
Showing results for 
Search instead for 
Did you mean: 

connecting to BEX from python

former_member792265
Discoverer
0 Kudos

I have a bex query defined by SAP BW 7.5 and want to connect to it from python 3. Any idea?

Accepted Solutions (1)

Accepted Solutions (1)

AndreasForster
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Abdulbaqi, Most BW 7.5 are running on HANA but it is possible in 7.5 to have other database below.

If your system is not on HANA then the approach I posted with hana_ml won't work and I don't know of any other interface on 7.5 that could help.

You could consider moving the relevant data to HANA Cloud or SAP Data Warehouse Cloud, ie with the BW Bridge.

Once the data is in HC or DWC the hana_ml package can be used.

Andreas

Answers (1)

Answers (1)

AndreasForster
Product and Topic Expert
Product and Topic Expert

Hi sharaf, You can expose the query as Calculation View, which is then accessible from Python through the hana_ml package. Here some code that I have just typed together without executing

import hana_ml.dataframe as dataframe

conn = dataframe.ConnectionContext(userkey="MYHANA")

df_remote = conn.sql('''SELECT * FROM "_SYS_BIC"."THECALCVIEW"''')

Note that using the hana_ml library is not allowed with all HANA licenses, please check with your SAP Account Executive. If the functionality is covered by your license you can either

  • extract the data through Python: df_pandas = df_remote.collect()
  • or even use the hana_ml package to push calculations down to HANA without extracting data (data exploration, data prep, ML, etc...)

The library is documented on https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/latest/en-US/index.html

Andreas

former_member792265
Discoverer
0 Kudos

many thanks andreas.forster, our organization have not moved yet to HANA and we are still using BW 7.5, do you think the method you suggested will still work?