This website is not affiliated with, sponsored by, or approved by SAP AG.

BEX and VBA commands

Business Warehouse

Moderators: Snowy, thx4allthefish

BEX and VBA commands

Postby Bezzy » Tue Oct 22, 2002 11:06 am

Hi,

Can anyone help........

I'm attempting to run the BEX VBA command SAPBEXgetWorkbookID in order automate the refreshing of particular workbooks on a daily basis. I've managed to get 'BW Server Connection' by using the VBA command SAPBEXgetConnection but now wish to retrieve the particular workbook back into Excel. To do this I believe you can use the VBA command SAPBEXreadWorkbook.

Example below................

Sub Get_Workbook()

wbName = "GWRWJDG2WB0Q78MKS8N7ON2V"
Run "SAPBEX.XLA!SAPBEXreadWorkbook", wbName

If wbName = "GWRWJDG2WB0Q78MKS8N7ON2V" Then
MsgBox "Correct"
Else
MsgBox "Incorrect"
End If


This code display the message Correct so I know that the workbook ID which I'm supplying exists but nothing seems to happen. I expected the workbook to be returned to excel.

Please help. It you can it would be great.
:lol:
Thanks

Bezzy
Bezzy
 

Bex and strange Conculsion

Postby JustanotherMichael » Tue Oct 22, 2002 2:16 pm

Hi!

This code will always show "correct"

wbName = "GWRWJDG2WB0Q78MKS8N7ON2V"
Run "SAPBEX.XLA!SAPBEXreadWorkbook", wbName

If wbName = "GWRWJDG2WB0Q78MKS8N7ON2V" Then


This is not the real McCoy. You check the input parameter and not result that is returned. The Result of this Function is the Workbookname given als String.

wbName = "LUMPITHEDOG"
Run "SAPBEX.XLA!SAPBEXreadWorkbook", wbName

If wbName = "LUMPITHEDOG" Then

also retruns true.

:wink:

It is better to take the Result of Run "SAPBEX.XLA!SAPBEXreadWorkbook and look if the returned Workbookname is correct.


I don't know the code that connects you to BW. But as long as you type in username and password nothing is usually wrong. In my opinion, taking the giving information as my knowledge concerning this case, the WORKBOOK ID is wrong.

Maybe it's late in the evening and I understand then tricks of the mind play their funny games,....

Ciao
Michael
JustanotherMichael
 
Posts: 22
Joined: Tue Oct 22, 2002 3:37 am

Postby Guest » Fri Oct 25, 2002 2:59 pm

Hi,

Sorry if i am misunderstanding your question about refreshing but if you write the VBA code, generally it occurs after the query has been refreshed (in the SAPBEXonREFRESH) subroutine. Perhaps just turning the setting of the workbook to automatically refresh whenever the workbook is opened?
Guest
 

Hi Guest

Postby JustanotherMichael » Sat Oct 26, 2002 9:15 am

Hi!

You are right, but you don't need to wait until SAPBEXRefresh occurs.

You can use the workbook id for e. g. opening other workbooks or do some kind of batch driven refresh.

This makes sense if you have reports that can be compard with lists and where no navigation is required or wanted. In the cases mentioned you have to calculate the workbooks content and save the report back to the warehouse. Normally you have to use the silent login and don't do this manually.

One disadvantage is the these reports run on a client workstation. I personally would say normally you don't need this feature unless it can be run on a server.

You can use BEX Macros from WORKBOOK_OPEN Event on.

best regards
Mike
JustanotherMichael
 
Posts: 22
Joined: Tue Oct 22, 2002 3:37 am


Return to Business Warehouse

Who is online

Users browsing this forum: Google [Bot] and 4 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.