cancel
Showing results for 
Search instead for 
Did you mean: 

Analysis Office: - Pass from & to Variable values for planning sequence in Macro code

former_member207028
Contributor
0 Kudos

Hi Experts,

I wonder how to call the pass from & to values for planning sequence variables in Analysis office workbook.

For instance, I have a Distribution by refernce planning function with Sender cost center variable [single value mandatory input variable] & Receiver cost center variable [Multiple single value mandatory input variable].

these two variables are part of input ready query designer on cost center infoobjects.

when workbook is opening, both Sender & Receiver cost center variables will be filled along with other variable values.

1.can we pass same variable values into macro code before execution of planning sequence as below ?

ex:

Sub onExecuteFYDistribute()

    IResult = Application.Run("SAPSetPlanParamert", "FY_ALLOC", "ZCC_FROM", "XUSOMCA01", "INPUT_STRING")

    IResult = Application.Run("SAPSetPlanParamert", "FY_ALLOC", "ZRECEIVER_CC", "XUSFICH01;XUSHOCA01;XUSHOCH01", "INPUT_STRING")

    IResult = Application.Run("SAPExecutePlanningSequence", "FY_ALLOC")

End Sub

this is giving error.

2.  Both Sender and Receiver variable parameter can be passed in same "SAPSetPlanParamert" ?

  IResult = Application.Run("SAPSetPlanParamert", "FY_ALLOC", "ZCC_FROM", "XUSOMCA01", "ZRECEIVER_CC", "XUSFICH01;XUSHOCA01;XUSHOCH01", "INPUT_STRING")

3. In Analysis Office user guide

Example:

Dim lResult as long
lResult= Application.Run("SAPSetPlanParameter", "PF_1", "0TARGET_YEAR", "2013", "INPUT_STRING")

for 0TARGET_YEAR variable, value 2013 is mentioned;

how to pass variable value dynamically instead of maintaining value like 2013 ?

could you please help on how to pass from and to variable values for executing planning sequence.

I checked in SCN, but did not get clue to resolve this issue.

Thank you.

Best Regards,

Daya Sagar

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hello,

1.) the function name is "SAPSetPlanParameter" not "SAPSetPlanParamert".

following your example i would expect the following code to work:

[...]

dim strPromptFROM as String

dim strPromptRECEIVER as String

[...]

strPromptFROM = Application.Run("SAPGetVariable", "<YourDatasource>", "<YourQueryVariable1>,, "INPUT_STRING")

[...]

strPromptRECEIVER=Application.Run("SAPGetVariable","<YourDatasource>", "<YourQueryVariable2>", "INPUT_STRING")

[...]

lResult=Application.Run("SAPSetPlanParameter","FY_ALLOC","<YourParameter1>", strPromptFROM, "INPUT_STRING")

[...]

lResult=Application.Run("SAPSetPlanParameter","FY_ALLOC","<YourParameter2>", strPromptRECEIVER, "INPUT_STRING")

[...]

Try using the technical names of the Plan Parameter variable prompts or the descriptive names of the Parameters you want to set. We sometimes had issues getting the SAPSetVariable function to work, when not using the technical names for the Queries variable prompts. As a result i always use the technical names when working with e. g. SAPSetVariable in macros. Perhaps you see something similiar with SAPSetPlanParameter here.

Insert Code for Error Handling / Checks of the return values as needed.

2.) I do not think you can set both Plan Parameter variables with one call of SAPSetPlanParameter.

3.) see 1.)

Kind regards,