cancel
Showing results for 
Search instead for 
Did you mean: 

Cyclical DP Macro Help

Former Member
0 Kudos

APO DP Macro Help

I have a problem where I have created a 2 step macro where the result of step 1 is an input into step 2. The result of step 2 is then an input to the NEXT TIME BUCKET of step 1 and so on..(e.g. Step 2 result for March16, affects the Step 1 for April 16)

(Its a replenishment forecast calculation followed by a stock projection)

The standard macro logic appears to run step one for all periods before moving onto step 2 for all periods. Which does not meet my requirements.

In my mind I have 3 options, somehow combine 2 separate tasks into the same step.. (how can this be done?)

OR

Find a way where the macro will look at one period for BOTH steps before moving onto the next

OR

Have a macro function that will run the macro 24 times automatically. (Loop?) (I'm am unable to understand the coding for loop when its set number of times)

Thanks

SSB

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Susan,

Thanks for your reply, I had already read your post and  the 'Loop' functionality in mind but had become confused by all the loop counter stuff and wondered if this was more than I need?

Is your post also creating a popup for the user to define the number of loops? (As I DON'T need that).. I will just have a fixed number of loops.(Based on the time buckets)

I will have a go at doing as you say and provide feedback

Thanks

Simon.

Former Member
0 Kudos

Hi Susan.

I have tried to follow your macro the best I can and the logic makes sense in my head, but i'm getting an error.

Below in the screenshot is my macro, the yellow are steps added from your help, and the red is my existing steps (Still minimised)

Can you see the error also in the screenshot and think what could be wrong?

I had an earlier error in step 6, where I missed press 'space' before the (..So does this mean this error occurs after that point?)

As you can see in step 2, I hardcode the number of iterations, rather than provide a popup to the user as you had done.

Former Member
0 Kudos

Hi S SB -

Yes, I see that you are missing apostrophes in your 6th step:

Former Member
0 Kudos

Hi Susan,

Thanks again for the response, but no.. that didn't work, I added those in and the error remains the same.

Any other ideas?

Does the error message in checking the macro happen in a sequence for lines of the macro? e.g., if I put a deliberate error is somewhere but this same error still occurs is if fair to say this error is BEFORE my deliberate error?

Simon

Former Member
0 Kudos

Simon,

Another thing I just noticed is that you use LAYOUTVARIABLE_VALUE.

Try VAR_VALUE

Former Member
0 Kudos

(LAYOUTVAR_VALUE is for numbers.  LAYOUTVARIABLE is for characters)

Former Member
0 Kudos

Hi Susan,

Thanks again for your advice, and it has managed to move on a little with this change.. I can now activate the macro correctly. But when I run it, it doesn't seem to loop! it appears the same as before and I have to manually run the macro over and over rather than letting the loop do it.

Any further ideas? I have had a play around with the > in the 'until loop reached' part, but it doesn't help and the logic that it should exit when loop Counter becomes > Loop Number.

Its like its not reading my request in step 2 to set the loop number to 5.and stopping at 1.

Former Member
0 Kudos

Susan,

I have got it! its working now and I have attached this below for you to see and other viewers can see. (You may wish to adjust this in your blog version of this loop macro?)

I have tided up the steps a little, but the main change that appeared to make it work was the number of iterations in the loop related steps. They all should be set to just 1 iteration.

Thank you for your help, its exactly what this board if for.

Former Member
0 Kudos

Oh geez! I don't know why I didn't notice the iterations! I have right here in my notes: "The number of iterations is VERY IMPORTANT….l they must = “1”… otherwise the count each iteration as “1”… so if there are 48 timebuckets, it will count in groups of 48 if you use the total horizon instead of setting it to “1”" 

Sorry about that! As you might have noticed, I took a break and only rejoined this community a couple of days ago. So I guess I am pretty rusty. But I am really glad your problem is solved! Can you award me some points? (My first points under my new ID )

Former Member
0 Kudos

P.S. - I checked my blog and already it does show "new step - 1 iteration" in each case. But I appreciate the suggestion to update my blog. I added screenshots to a new blog entry. They are old screenshots, but I think they convey this information better. LINK: Looping APO Macros Screenshots | SAP APO Think

Former Member
0 Kudos

Hi Susan,

not a problem.. I think marking you as 'correct answer' is giving you the points automatically?

Do you know if there is a way to connect outside this public forum? i'm keen to stay in touch and share ideas and I am happy to help you with your blog etc.

Simon

Former Member
0 Kudos

Sure Simon ~ connect with me on LinkedIn?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello -

Here is a link to my post I wrote a few years ago with code for writing a looping macro. Looping APO Macros | SAP APO Think