cancel
Showing results for 
Search instead for 
Did you mean: 

Macro Initial Value

Former Member
0 Kudos


Hello Experts,

I need you help, i have an keyfigure attribute in planning book which shows 2 years of history from past, instead going back in past to see the history i set the macro to copy the history to the keyfigure attribute, but now i am facing an issue i only have 4 months of history in the past and rest of the month is black, so when i tried to run the macro it keey giving an error message saying "A Macro tried to set initial Value" even though i have set the zero allowed indicator in the keyfigure setting but still no luck, is there a step in the macro that i need to add please advise how to do it.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ganesh

Initial (i.e. blank) is different from zero since SCM5.0. Please go through OSS note 1068603 - it provides solution for this type of issue. Specifically, scenario 3 (Copying a Key Figure) in this note might be applicable to you.

Thanks,

Prasun


Former Member
0 Kudos

Hi Prasun have seend this answer already from a diffrent forum, i need a guidline on how to do it

Former Member
0 Kudos

Hi Ganesh

There is an example macro provided in the note for copying from one key figure to another which shows exactly the steps you need to execute/configure. You just need to change the two key figures and date range based on your requirement. Let us know where you are facing the issue with screenshot so that we can help further.

Thanks,

Prasun

Answers (4)

Answers (4)

0 Kudos

Hi Ganesh,

Here's an alternative for you without having to use any macros:

Create a Univariate Forecast profile based on strategy 60 - Copy History


Choose this strategy if demand does not change at all and you want to opt for the least performance- or work-intensive strategy. No forecast is calculated. Instead, the historical data from the previous year is copied.

It's really simple to set up in my opinion. Just make sure you adjust:

  • forecast key figure
  • forecast horizon, using an offset
  • history horizon, using an offset

Only thing is it copies a max of 12 months of history in the past. You have plenty of options to adjust and get results for 24 months.

Cheers,

MZ

Former Member
0 Kudos

Hello Satish i h vae followed what you said but i am getting dump error

former_member187488
Active Contributor
0 Kudos

Hi, this is a really easy macro. For the row you want to check whether it's initial or you want to set it to initial, you must set the data as "attribute" instead of "value". You can see this setting by double click the row element. Note 1068603 will help you to handle this case.

Former Member
0 Kudos

I have tried everything you guys told but still i am getting abap dump error can someone please test it and write a macro so i can copy it please

Former Member
0 Kudos

Ganesh, Satish

I am having similar macro issues as Ganesh as a result of a recent SP upgrade,   I have followed the thread and gotten the same results that Ganesh is getting.  Set KF to Allow Zero and set KF assignment to Attribute

Still getting error

Any help you can offer would be appreciated.

Thanks

Jim

former_member187488
Active Contributor
0 Kudos

Hi Jim, Maybe can you please attach the call stack part in the ST22 dump.

Former Member
0 Kudos
former_member187488
Active Contributor
0 Kudos

Hi, you still did not set to "Attribute" for the "Row: Working Forecast Lock" as the parameter of maction funcion "IS_INITIAL()". You set to "Attribute" to the next  "Row: Working Forecast Lock" which is incorrect.

Former Member
0 Kudos

here is the screenshot i have done what yo said and i am getting error to activate it

satish_waghmare3
Active Contributor
0 Kudos

Hello Ganesh,

You are missing a code before ELSE in your above screenshot, which makes you macro logic incomplete.  Please refer carefully the screenshot which I had given you earlier.

IF IS_INITIAL Condition

ACTION  ---> This is missing in your macro

ELSE

ACTION

ENDIF

Hope this will help

Thank you

Satish Waghmare

former_member187488
Active Contributor
0 Kudos

Af first glance, I think you can use a IF statement, to copy only the non-initilial value, like if is_initial(the source value) = 0 then make the copy

Former Member
0 Kudos

Hi Prasun

i dont have access to SAP Marketplace can you please send screenshot

Former Member
0 Kudos

Hi Ganesh

Based on your screenshot, you need to incorporate the following logic

Macro for copying row XXX to YYY

Copy Step : ( 12 Iterations : P 02.2014; P 01.2015 )

IF

Value Initial?

IS_INITIAL(

Row: XXX ( Frm  P 02.2014 )

)

= 1

Row: YYY ( Frm  P 02.2014 ) = Initial

ELSE

Row: YYY ( Frm  P 02.2014 ) =

Row: XXX ( Frm  P 02.2014 )

ENDIF

Former Member
0 Kudos

Hi Prasun

i have tried exactly what you have mentioned in the macro but when i tried to check the macro i got this error message

Former Member
0 Kudos

as you mentioned row YYY should be = initial i cant select intitial for row YYY because its an keyfigure attribute

Former Member
0 Kudos

Hi Ganesh

Then make Row YYY = 0 in this logic. Please make sure zero is allowed in key figure setting. Also please make sure that you set "Missing Values" as "Replace with 0" in step properties.

Thanks,

Prasun


satish_waghmare3
Active Contributor
0 Kudos

Hello Ganesh,  Please write more details on your requirement.  Please share the screenshot of your macro.

Sample Macro having IF...ELSE...ENDIF with IS_INITIAL function.

Hope this will help.

Thank you

Satish WAghmare

Message was edited by: SATISH WAGHMARE

Former Member
0 Kudos

ok here is the screenshot that shows how i have copied the previous year history and populate it under keyfigure attribute, so everytime i run the macro it copies the value but it keep shooting the error on initial value so please help