VBA code to select multiple variables in SAP AfO

Cime14

New Member
Joined
Dec 19, 2017
Messages
30
Hi all,

I am trying to write a VBA code which would populate variables in SAP Analysis for Office prompts window.
With the code I am using now is only possible to change one variable line (example: SetReportingUnit = Application.Run("SAPSetVariable", "Select FCRSCode-Child(s) Opt", "XX1", "INPUT_STRING", "DS_1")) but I would like to populate two or more lines which would be at the end reflected in prompt window as on below picture (XX1 and XX2).

Any idea?

VBA code:
Sub UpdateData()

Dim SetPeriod As Long
Call Application.Run("SAPSetRefreshBehaviour", "Off")
Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "On")
SetReportingUnit = Application.Run("SAPSetVariable", "Select FCRSCode-Child(s) Opt", "XX1", "INPUT_STRING", "DS_1")

End Sub

SAP Analysis for Office prompt window (variables selector):
1657714266252.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Necro thread but there is an INPUT_STRING_AS_ARRAY which will probably do what you need! :)

I.E.

Application.Run("SAPSetVariable", "Select FCRSCode-Child(s) Opt", Array("XX1","XX2"), "INPUT_STRING_AS_ARRAY", "DS_1"))
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,839
Members
449,193
Latest member
MikeVol

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top