on 02-11-2015 1:18 AM
Hi,
I am using Analysis for Office Version 1.4.0.2528.
I have written some VBA code to "reformat" the report after a query is prompted (to change some variables) and refreshed.
I would like to add to the beginning of the macro to force the display of the prompts (rather than clicking on "prompts" and then running the macro) and then proceed to run the rest of the macro.
I have tried some variations of SAPExecuteCommand but have not been successful.
Any help would be appreciated.
Thanks,
Alvin
Hi Alvin Toh,
you could use below VBA to display prompt
lResult = Application.Run("SAPExecuteCommand", "ShowPrompts", "ALL")
another option in Display panel under components tab you have options to display the force prompt
PS: you are using very old version of AO SP0, currently SP10 is available in SMP, if possibly you may use latest one
Best Regards,
Subhash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Venkata.
I did try the code but nothing seems to happen. I did step through and the code did not throw up an error.....do i need Callbacks?
I also seem to recall reading somewhere that Prompts became available in SP 4/8.
And yes, I wish I have the latest pack but my company has not been tested it.
Cheers,
Alvin
Hi Alvin,
almost all guys here make the same mistake... so it's likely you have the same issue:
BEFORE you can call the prompts screen via VBA, you have to refresh the DS once!
lResult = Application.Run("SAPExecuteCommand", "Refresh", "DS_1")
lResult = Application.Run("SAPExecuteCommand", "ShowPrompts", "DS_1")
Feel free to blame SAP that "ShowPrompts" has no incorporated refresh functionality 😉
Best regards,
Martin
Hello,
this code works for us. We use "RefreshData" instead of "Refresh". Additionally we have a loop if variables are merged:
Dim lResult As Long | |
lResult = Application.Run("SAPExecuteCommand", "ShowPrompts", "DP_11") | |
ErrorCode = Application.Run("SAPGetProperty", "LastError", "Number") | |
If ErrorCode = 37 Then 'DataSource is not yet refreshed | |
lResult = Application.Run("SAPExecuteCommand", "RefreshData", "DP_11") | |
ElseIf ErrorCode = 36 Then 'Variables are Merged | |
Click = MsgBox("Variables are merged! Do you want to refresh all queries in the workbook?", vbOKCancel, "Warning") | |
If Click = 1 Then | |
lResult = Application.Run("SAPExecuteCommand", "RefreshData", "All") | |
End If | |
End If |
Regards
Daniel
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.