cancel
Showing results for 
Search instead for 
Did you mean: 

Request for Macro logic which locks the past period for different naming and selection condtions in a split week data view

Former Member
0 Kudos

Hi Gurus,

I am facing a challenge to write a default macro logic, which is used for non editable for keyfigure (KF1 %) in the past periods/weeks , where the data view is in weeks format and  which has horizon from 2011 to 2015 for restricted selection based on Z table entry.

Now This table is a z table with  country, product and allocations time period name.

So we have a functional module  ZAPO_GET_TABLE_DATA to refer the specific country, products and time period name data when its called in any macro.

Now the requirement is to run a macro to close the past horizon in the keyfigure  (KF1 %) based on the specific naming which is given in the Z table entry.

There are 6 different unique names in the Z table which have combinations of country and product.

Here the KF1 % is expected to be editable for the following conditions:

So based on the combinations and time naming, if in planning book we load data with for example: LOC1;PROD1; 'week"  in the table, then in the planning book it should open kf1 % for week.39 and future till end of horizon as editable.

Second point is if it is 'Monthly' then the KF1 % is expected to be editable in the current month (X) from the September day 1  Here for example: It starts from (week 35 B.2013 ) as September 1st is a single day which come under split week to till the end of the horizon of the book which is week 35.2015 September.

Third point is that For "Year" naming country and products, the keyfigure should be editable for the entire horizon.

Now I have used the following logic to define the three above conditions in a single macro.

Here I am facing issue in "month" logic where in the total level of the keyfigure for the past weeks of the current month is showing as non -editable and at detail level it is editable and users wants to change the values only at total level is its a % value and the products are also more.

The keyfigure KF1 % is of calculation type A and time disaggregation as N.

Here are the details of the full logic:

macro name:EDIT KF1%

step1)

Set Variable : ( 1 Iterations :W 39.13;W 39.13 )

Set Variable

LAYOUTVARIABLE_SET( 'LEVEL' ; 0 )

step2)

Check Level : ( 1 Iterations :W 39.13;W 39.13 )

IF

Single Material

DET_LEVEL( 'ZMATNR' ) = 1

Set Variable

LAYOUTVARIABLE_SET( 'LEVEL' ;

LAYOUTVAR_VALUE( 'LEVEL' ) + 1 )

ENDIF

IF

Single Customer

DET_LEVEL( 'ZCUSTLEV2' ) = 1

Set Variable

LAYOUTVARIABLE_SET( 'LEVEL' ;

LAYOUTVAR_VALUE( 'LEVEL' ) + 2 )

ENDIF

IF

Single Country

DET_LEVEL( 'ZCOUNTRY' ) = 1

Set Variable

LAYOUTVARIABLE_SET( 'LEVEL' ;

LAYOUTVAR_VALUE( 'LEVEL' ) + 4 )

ENDIF

IF correct level

LAYOUTVAR_VALUE( 'LEVEL' ) = 7

AND DATA_IS_LOCKED = 1

STEP:Check if Monthly

IF

CONDITION:Before Current Month

BUCKET_EDATE(

Row: KF1 % ( Frm W 50.11 )

)

<

MONTH_BDATE( TODAY )

Row: KF1 % ( Attributes ) =

CELL_INPUT( 0 )

CELL_BG( 9 )

ELSEIF

CONDTION:Check if ('FULL HORIZON')

Open Whole Period : ( 256 Iterations :W 36.11;W 40.15 B )

Row: KF11 % ( Attributes ) =

CELL_INPUT( 1 )

Row: KF1 % ( Attributes ) =

CELL_BG( 0 )

ELSE

Open Current Week : ( 256 Iterations :W 36.11;W 40.15 B )

IF

CONDTION: Weeks Prior to current week

BUCKET_EDATE(

Row: Tolerance % ( Frm W 36.11 )

)

< WEEK_BDATE( TODAY )

Row: KF1 % ( Attributes ) =

CELL_INPUT( 0 )

CELL_BG( 9 )

ENDIF

We have a data view which is viewed in split weeks. Split weeks

Please let me how to go about it and request to do let me know your suggestion,

Thanks in advance.

Praveen

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ada,

Thanks for the reply,

I have checked and The keyfigure KF1 % is executed in all planning objects level only and adding to the point the mode of display of KF1% keyfigure the property is maintained as INPUT/OUTPUT in data view.

Please let me know how to go about it .

Thanks

Praveen

former_member187488
Active Contributor
0 Kudos

Hi Praveen, I just realized that even if the macro is executed for all planning objects, when it is executed on aggregated level (the 'Total') key figure, since it is not on the details level as the detailed lines, the macro will not set it as editable, which means LAYOUTVAR_VALUE( 'LEVEL' ) = 7 will never be satisfied for the 'Total' line.

former_member187488
Active Contributor
0 Kudos

Maybe your macro is set to be executed in the details level only. You may need to set it to be executed to all planning objects.