cancel
Showing results for 
Search instead for 
Did you mean: 

Problem refreshing query when opening workbook in VBA

Former Member
0 Kudos

I have a report menu in a workbook not containing any queries - only the description, technical name and additional information about the reports.

I use Run ("SAPBEX.XLA!SAPBEXreadWorkbook"), <TECHNICAL_NAME> to open the respective workbooks, which works fine.

However, if I try to refresh the query, BEx displays a message saying:

"Can only refresh this query agains a server of release 2.0 or higher: <QUERY DESTINATION RANGE>"

We're using BW 3.5!

After that, BEx is a complete mess:

- Open workbook dialog is from a previous version (without History, Favorites, Roles buttons)

- All workbooks are displayed, but if I try to open one, BEx claims that "The workbook does not exist in the document store". Then why display it, dear SAP programmers?

Now, if I disconnect and reconnect, the query can be refreshed as if I had opened the workbook directly instead of using VBA.

Our users like the idea of a report menu, so any help would be appreciated!

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Changed the error handling as follows, dropped the SAPBEXinitConnection function, which is completely redundant:

Sub OpenWBTechName()

On Error GoTo ErrorHandler

Run ("SAPBEX.XLA!SAPBEXreadWorkbook"), <TECHNAME>

Exit Sub

ErrorHandler:

If Err.Number = 1004 Then ExtraInfo = "Start BEx Analyzer!"

res = MsgBox("Sorry, could not open requested report!" & vbCrLf & vbCrLf & ExtraInfo, vbExclamation + vbOKOnly, "Open SAP/BW workbook report: ERROR!")

End Sub

Former Member
0 Kudos

I found the answer myself:

I assumed users may or may not be connected (if they have the report menu workbook e.g. on their desktop), so I added the following command before attempting to open the workbook:

Run ("SAPBEX.XLA!SAPBEXinitConnection")

Works fine if you are disconnected, messes up BEx if you already are...

I have to find another way to do error handling, if at all necessary.

Former Member
0 Kudos

Christian,

did you check ST22 for short dumps?

Can you see if after rebooting your client you still have that problem?

Let me know,

Gili