cancel
Showing results for 
Search instead for 
Did you mean: 

Planning sequence in analysis does only work once in a session

0 Kudos
1,173

Dear experts,

on a customer project we have created a few workbooks within anaylsis for office. I am going to explain one of them in more detail here, but the behaviour does occur in all of them.

The workbook is design for entering planning values on a yearly basis.We have implemented macros for getting the prompt screen, saving the entered data and for a custom distribution sequence. This sequence distributes the yearly value to months. The sequence contains only one planning function (so no huge complexity here). There is another sequence which does the opposite way an deletes the monthly values and recovers the yearly value.

There are two sheets implemented in this workbook. One for the yearly view and the other one for the monthly view.

Now the behaviour:

When the workbook is opened for the first time and the user has logged in he is able to run all of the sequences. He is able to open the prompt dialogue for several times, as well as saving the entered data. The sequence for the data distribution and the sequence for reverse the values from monthy to yearly will only run one time.

When the user does a re-login or closing and re-opening of the workbook, he will be able to run them again - once.

If the user tries to run the sequences a second time an error message will appear, that the necesary variables for the sequences are not set. But as we set the PlanParameters just a second before the sequence is executed that might not exactly the issue.

Does anyone have an idea or have had the same issue and found a solution?

Is there a way to find out the steps which are done when logging in? Is there a function which does a refresh for cleaning up a buffer or anything?

Any hints appreciated!

Below the macro coding for the distribution sequence (which does work for the initial call)

Sub Verteilen()

Dim lResult As Long

Dim strCalyear As String

Dim strSalesorg As String

Dim strDivision As String

strCalyear = Application.Run("SAPGetVariable", "DS_1", "Y_CALYEAR_MEMV_002", "INPUT_STRING")

strSalesorg = Application.Run("SAPGetVariable", "DS_1", "0SALEORG", "INPUT_STRING")

strDivision = Application.Run("SAPGetVariable", "DS_1", "Y_0DIVISION_MME_001", "INPUT_STRING")

lResult = Application.Run("SAPSetPlanParameter", "PS_2", "Y_CALYEAR_MEMV_002", strCalyear, "INPUT_STRING")

lResult = Application.Run("SAPSetPlanParameter", "PS_2", "Y_0SALESORG_MME_001", strSalesorg, "INPUT_STRING")

lResult = Application.Run("SAPSetPlanParameter", "PS_2", "Y_0DIVISION_MME_001", strDivision, "INPUT_STRING")

lResult = Application.Run("SAPExecutePlanningSequence", "PS_2")

lResult = Application.Run("SAPExecuteCommand", "PlanDataSave")

lResult = Application.Run("SAPExecuteCommand", "Refresh")

End Sub

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Gregor,

that sounds very good. I will send that information to the customer and hope he is going to implement the notes.

Thanks so far,

Eva

gregor_dieckmann
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Eva,

the variables used in the query and in the planning sequence (filter, parameters) are replaced independently, so its seems that some already set variables get lost when the sequence is processed the second time. The variables have to be reprocessed. The following notes might be relevant for your scenario:

2505914

2662895

Regards,

Gregor