on 05-20-2012 11:13 PM
Hi Friends,
I have a requirement to copy a key figure value from a group/family CVC and set that key figure value to all member CVCs in a different Key figure. Here is what I did.
My Requirement:
I have two key figures: 1) Key figure “NTDM” values available for family level SKUs, & 2) Key figure “Family Level NTDM” values which we need to populate using a macro for all the SKUs including family SKUs.
The proposed macro should read & copy values from NTDM key figure at Family level (ZFAMX22 SKU marked in red box) and populate into Key figure “Family Level NTDM” for all SKUs including Family SKUs marked in blue box.
Macros: I have to split into 2 macros as they are not working in a single macro with multiple steps. Combined them into a collective macro. Macro-1 first initializes/assigns family level values into a VECTOR variable, and Macro-2 then takes VECTOR variable values and copy into all SKUs. Here I am assuming that VECTOR variable is a global variable like any other LAYOUTVARIABLE_SET().
Macro-1: Initialize FAMILY NTDM in to Vector
Step-1:Init & Copy NTDM KF to Vector Variable : ( 1 Iterations :Initial;Initial )
IF
If it’s a Family Product
ACT_PRODUCT > 'ZFAM'
Action: Assign Fam-NTDM to Vector Variable
VEC_LAYOUTVARIABLE_SET( 'VECTOT' ;
Area: [ $NTDM ( Initial ) ; $NTDM ( M 04/2014 ) ]
)
ENDIF
Macro-2:Update FAMILY Level NTDM in all Prods
Step-1:Update KF with Vector Variable : ( 1 Iterations :Initial;Initial )
Action: Assign Vec Variable to KF Family Level NTDM
Area: Family Level NTDM ( Initial ) =
VEC_LAYOUTVARIABLE( 'VECTOT' )
Collective Macro:
Coll:Update Family NTDM into All Products
Macros to be Executed:
Macro-1: Initialize FAMILY NTDM in to Vector
Macro-2: Update FAMILY Level NTDM in all Prods
Interactive Run:
When run interactively in planning book we have to drill down by product, it runs successfully and populate values correctly as expected. One set of Vector variable is copied over all SKUs including Family SKU ZFAMX22.
Background Job definition:
Activity: ZSPBG_ACT1
Macro: Coll:Update Family NTDM into All Products
Background Job:
Activity: ZSPBG_ACT1
Planning Book: ZSNP02_PB1
View: ZSNP02_PB1_V01
Version: 000
Selection ID: ZSP_TEST1 (contain Location, & Products)
Aggregation Level: 9ALOCNO, 9AMATNR (assigns default based on selection id)
Before the background job starts, all the values are reset in “Family Level NTDM” key figure:
The background job was run and completed successfully:
Log Results after completion:
Charact. Combination(1 Frm 5): 1108 A912340
Macro Coll:Update Family NTDM into All Products has been executed
No data has been changed; data must not be saved
Charact. Combination(2 Frm 5): 1108 A912350
Macro Coll:Update Family NTDM into All Products has been executed
No data has been changed; data must not be saved
Charact. Combination(3 Frm 5): 1108 A912360
Macro Coll:Update Family NTDM into All Products has been executed
No data has been changed; data must not be saved
Charact. Combination(4 Frm 5): 1108 A912370
Macro Coll:Update Family NTDM into All Products has been executed
No data has been changed; data must not be saved
Charact. Combination(5 Frm 5): 1108 ZFAMX22
Macro Coll:Update Family NTDM into All Products has been executed
Data saved successfully
Results after completion: Copied the NTDM values only to Family SKU in Family Level NTDM key figure and not copied to all products (not copied to SKUs in blue box). Based on the results the VEC_LAYOUTVARIABLE_SET() in background job is only copied to Family SKUs where it is originally assigned hence it’s not a global.
What I am doing wrong in background job? Any idea how to achieve this?
Thanks
Raj
Hi Raj,
This post is much better than the other one.
As you see from the background job run log, each CVC along with corresponding key figure vales are being passed one at at a time to the macro. Due to this reason, the value copied with product ZFAM is not available for use with other products. Probably, you need to revisit your logic keeping in mind the background execution behavior.
Or, if it's possible, change the family product # from ZFAMX22 to any other so as to make sure this number will come first in the sorted list.
Thanks,
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.