on 10-14-2011 12:24 PM
All,
I have created a BEx workbook with 4 worksheets. On the first worksheet I have a button that executes an IP (Integrated Planning) function. My requirement is to call the functionality behind that button in the VB code upon opening of the workbook and upon changing variable values.
I call the button in the CallBack routine of the DefaultWorkbook in VB. But the code behind that button actually triggers the execution of the CallBack routine and thus causes an endless loop. Also I have 4 worksheets and the CallBack routine gets called (I think) for every worksheet), And I want the functionality of the button only to run once after the variable pop up screen (thus after changing the variable values). So I created a boolean and set it to TRUE in the Sub Workbook_Open(). And made the call of the button dependant on that boolean and set it to FALSE afterwards.
This all works ok when I first open my workbook, populate the variables in the pop up. The functionality behind the button gets executed (ie some key figures get populated in the planning sheet). But then when I hit button 'Change Variable Values' the button is not called again. This is becasue my boolean is still FALSE. So obvioulsy the Sub Workbook_Open() is not called after 'Change Variable Values' and thus boolean not set to TRUE again.
Does anyone know where I should set the Boolean to TRUE so that after 'Change Variable Values' it is set to TRUE, but that it happens before the CallBack routine is called?
Cheers!
Hi Pandaa,
Kindly have a look at below link,
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=19690
Hope this helps.
Regards,
Mani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which version of Bex are you using ? Bex 7 changes the whole Macro environment rather significantly, and many of the functions no longer work the same. Here is Prakash's blog on the topic
You may wish to consider taking over the 'Refresh Workbook" function with your button, ensuring that the Bex action takes place AFTER your button is pushed. Alternative, set up a Global variable that handles tracking in your VBA routines.
It's important to understand that in multi query workbooks, the VBA "CALLBACK" routine is executed after EACH query is executed. While the user is only prompted for variables once, the queries still execute in turn, based on the dataprovider ID number (DP1 is first, DP2 second, and so forth).
So you will actually execute your CALLBACK Macro four times for a workbook with four dataproviders.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.