on ‎2022 May 24 3:44 PM
Hi,
I'm a complete newbie when it comes to SAP BI VBA.
I have a report that needs daily refreshes and the date range in prompts needs to be updated when new month comes around. For two weeks of a new month, the range needs to be Previous Month - Current Month, then it can be Current Month from and to
.
I found multiple solutions to when the prompt update is a single input, however in my case it's a range From - To.
I have tried both to filter by text MAY 2022 - MAY 2022 (this is how it shows in the Filter Information in the side pane) and by range like 05.2022 - 05.2022, but nothing works.
Below the code I have come up with - could you please support with how the function should be structured so that the array works?
Thanks!
Sub UpdateData()
Dim SetPeriod As Long
Dim RefPeriod As String
Call Application.Run("SAPSetRefreshBehaviour", "Off")
Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "On")
'RefPeriod = UCase(Range("r_FilterFrom").Value) & " - " & UCase(Range("r_FilterTo").Value) 'returns MAY 2022 - MAY 2022
RefPeriod = Format(Date - 14, "MM.yyyy") & " - " & Format(Date, "MM.yyyy") 'returns 05.2022 - 05.2022
SetPeriod = Application.Run("SAPSetVariable", "[0CALMONTH_C_C_I_M_001]", RefPeriod, "INPUT_STRING_AS_ARRAY", "DS_1")
Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "Off")
Call Application.Run("SAPSetRefreshBehaviour", "On")
SetPeriod = Application.Run("SAPExecuteCommand", "RefreshData", "DS_1")
End Sub
Request clarification before answering.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.