Skip to Content
author's profile photo Former Member
Former Member

Automatic refresh of queries into workbook

Dear SAP fans,

I am using a workbook with 2 BEX queries and some VBA coding for each "onRefresh".

I set both queries to "refresh query when opening the workbook" so that my workbook is automatically updated when I open it.

Unfortunately the "system" automatically refreshes the queries in the "wrong" order. Therefore my result in incomplete...

Any idea to refresh the queries in the right order?

Alternatively, I was thinking to refresh the second query via VBA coding, but I can't get it right...

Thanks in advance for your help!!

Kind regards

Julien

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:28 AM

    Hi both,

    Thanks a lot for your great answer:

    S.Sankaran,

    I saw the same behaviour, but was not quite sure it will be the rule...

    This solution does work!

    However I would be happy to use Sebastian solution, which sounds cleaner and more flexible...

    Unfortunately I do not manage to make it work: I do not manage to get the option definition..

    Seastian,

    Could you help me to open the object katalog of the sapbex.xla?

    Thanks again both of you!

    Julien

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Julien,

      opening the object katalog is pretty easy, you just have to start the Bex Analyzer then press alt+F11 ( for opening the Visual Basic editor ) then mark "SAPBEX(sapbex.xla)" and press F2 ( to open the object katalog).

      So thats it, now you can see all function that included in sapbex.xla.

      Kind regards

      Sebastian

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 03:39 PM

    Hi Julien,

    you can try to refresh it with the VBA function SapBexrefresh

     Run "sapbex.xla!SAPBEXrefresh", True 

    "True" is the Option for refresh all queries but I guess there is also one option where you can put the Query name .

    ( For more Information that a look into the obejct katalog of the sapbex.xla )

    hope this helps

    Sebastian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 04:01 PM

    Hi,

    The order in which u add the queries in the workbook, the reverse order it will be refreshed.

    so remove the queries from the workbook and add in such a way that that the query to be refreshed first to be added at last.

    The last added query will be refreshed first.

    thanks ,

    S.Sankaran

    Edited by: Sankaran Shanmugam on Jan 29, 2008 5:11 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 11:34 AM

    Thanks you again!

    Easy indeed... But it open a wild range of possibility for me!

    I manage to refresh my query:

    Run "sapbex.xla!SAPBEXrefresh", False, Sheets(X).Cells(Y,Z)

    Since definition is as below:

    'Function SAPBEXrefresh(allQueries As Boolean, [atCell As Range], [iShowScreen As Boolean]) As Integer

    An now I know were to look for other functions...

    Thanks again

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.