cancel
Showing results for 
Search instead for 
Did you mean: 

Macro to zero out al KFs

Former Member
0 Kudos

Hello,

Is it possible to create a macro which can zero out values for all KFs.

Right now, we have background books for forecast calculations & not a single book books has all KFs in it, the KFs are deseminated through all different Background books. If I want to zero out all KFs, I have to add macro in each background book, for respective Key figures to zero out; which I want to avoid as it is a long process .

So is it possible to put wild card (*) in KF or some thing else to zero out all KFs in one go & not by creating macro in each background planning book.

Please help....

Regards

Rahul Chitte

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member187488
Active Contributor
0 Kudos

Hello,

If you must do this by macros, using "key figure = initialize" macro function, I think you can consider creating a dataview which contains all key figures. You can restrict the access to this dataview if you don't want other users access it.

If you can also consider other options except for macro, I think copy from a initialized version by TSCOPY is a good choice.

Best Regards,

Ada

Former Member
0 Kudos

Hello Ada Lv,

If I have to create a new Dataview (DV) which consists all KFs, what initials steps do I have to do ? or just create a DV with all KFs ? or Do I have to intialize or de-intilaize the planning area ?

Regards

Rahul Chitte

former_member187488
Active Contributor
0 Kudos

Hi,

I think if you create a dataview that contains all KFs, at least you only need to create one macro in one dataview.

But I don't know whether it is possible to acheive your requirement without list out all KFs in the macro, since the function "ROW(attribute) = initial" must specify a 'ROW' factor in the macro.

Maybe you can consider using the macro function Row_Cleare(). The good point of this function is that you can pass a whole number as the paremeter, instead of a 'ROW' factor. The whole number is the position of the row in the planning book.

So now maybe you can use WHEN condition, together with a layout variable to control the number of loops ...

Just FYI, I poseted the syntax of row_clear():

Syntax :ROW_CLEAR( key figure)

Key figure: Rows of the key figure of the planning area. You can enter the key figure two ways:

● As the internal number of the key figure. This is the position of the key figure in the table on the Key Figure tab page of planning area maintenance

● By including the row as the argument. In this case you must the data source to Row Attributes in the Macro Workbench

Description: ROW_CLEAR() deletes all values of the key figure at aggregate (total) level. The value 0 is then disaggregated to all detail levels. Thus it is sufficient to execute the macro only at aggregate level. Similarly it is sufficient to include the function in a step with only one iteration.

Best Regards,

Ada

Former Member
0 Kudos

Hello Ada,

Yes, I have created a new DV with all KFs; thats seems to be a most pragmatic & efficient way to handle this.

I have already created the macro too, but was looking for a short -cut to avoid adding all KFs in it. As you said, the function "ROW(attribute) = initial" must specify a 'ROW' factor in the macro; thats remains a problem, when I have to do it for all KFs.

Regards

Rahul Chitte

former_member187488
Active Contributor
0 Kudos

Hi Rahul,

In order to test macro function ROW_CLEAR(), I created the following macro in our internal system, and tested it in a dataview with 6 rows:

Macro: Clear All Rows (run only at aggregated level)

--Step: Set Loop Variable (1 iteration)

-


Action Box: Set to 1

-


Function: LAYOUTVARIABLE_SET( 'LP' ; 1 )

--Control: DO 6 TIMES

--Step: Clear Row (1 iteration)

-


Action Box: Clear Row

-


Function: ROW_CLAER(

-


Function: LAYOUTVAR_VALUE( 'LP' ) )

--Step: Loop Variable + 1 (1 iteration)

-


Action Box: Loop Variable + 1

-


Function: LAYOUTVARIABLE_SET( 'LP' ;

-


Function: ( LAYOUTVAR_VALUE( 'LP' ) + 1 ) )

--Control: ENDDO

The macro seems work fine in my system.

But a known issue of ROW_CLEAR() is that, it set the row to zero instead of initial and distributes the zero to details.

So if you have a key figure that differenciates zero and initial, it will give different result with 'Row (attribute) = initial'.

Not sure whether this works for you ...

Best Regards,

Ada

satish_waghmare3
Active Contributor
0 Kudos

Hi Rahul,

Based on details you mentioned in your question, not a single book books has all KFs in it etc.

Following options you can explore -

1.

/SAPAPO/TSCUBE - Load Data from InfoCube - From Cube to PA - Load a KF which has zero values into (all) different target keyfigure(s) from Planning Area.

OR

2.

/SAPAPO/TSCOPY - Copy/Version Management - Within PA - Copy a KF which is initial/has zero values into (all) target keyfigure(s).

OR ELSE

3.

Otherwise write different macros till you cover all the KFs in your PA. A macro can have logic to cover all the KFs from that Pbook.

Example : Row: Customer Forecast ( Frm M 10/2011 ) = Initial - to set it to blank or to do zero out use below

Row: Customer Forecast ( Frm BKT ) = Row: Customer Forecast ( Frm BKT ) * 0 Or

Row: Customer Forecast ( Frm BKT ) = 0

But I believe wildcard option is not available.

Hope this will help.

Thank you

Satish Waghmare

Former Member
0 Kudos

Seems like you want to start from the scratch.

How about reinitializing the planning area? Is that an option for you albeit a bit drastic?

Satish

Former Member
0 Kudos

Hello Satish W,

First two options are not useful for me because, I have to delete the values for a particular Location & Sales org. after the forecast calculation from 02.2012 onwards.

I have created a macro, which would run after the forecast calculation is done, but was wondering how it would cover all the KFs ? so option # 3 seems viable as I have to create macro in all planning books which covers all KF OR Create a new Data view (DV) which has all KFs & write a single macro in that book ..

Regards

Rahul Chitte