on 2016 May 17 4:30 PM
Hi Folks,
Please I want to calculate the value of member I have it's the value of the current iventory -inventory of the previous day .
when i'm trying to execute the script it's giving me this error how could achieve that.
Here is the informations you need
1-
*SAP_BW 740 0009 SAPKW74009 SAP Business Warehouse
*CPMBPC 801 0009 SAPK-80109INCPMBPC CPM Business Planning and Consolidation
2- UJK_VALIDATION_EXCEPTION:Dimension set:"TIME" not assigned in Data Manager
3- I have The Extractio Model, it contains 5 dimensions:
TIME:01.01.2015, 2015.01,2015.01,2015
TV_Extraction:Inventory,.....
Version: Type C Contains , Forecast , Budget...
4-Default.LGF
5 I-want to calculate the value of member I have it's the value of the current iventory -inventory of the previous day . .
6- this script is just for testing the TMVL Function which is not working for me
*XDIM_MEMBERSET TV_EXTRACTION=EXTR0014
*XDIM_MEMBERSET TIME=%JOUR_SET%
*WHEN TV_EXTRACTION
*IS EXTR0014
*REC(FACTOR=1,TIME = TMVL(-1,%JOUR_SET%),TV_EXTRACTION =a)
*ENDWHEN
*COMMIT
7- Data like 7800
8-
UJK_VALIDATION_EXCEPTION:Dimension set:"TIME" not assigned in Data Manager
9-The script is not working.
Request clarification before answering.
Looks like you time dimension is named JOUR
*XDIM_MEMBERSET TV_EXTRACTION=EXTR0014
*XDIM_MEMBERSET JOUR=%JOUR_SET%
*WHEN TV_EXTRACTION
*IS EXTR0014
*REC(FACTOR=1,JOUR = TMVL(-1,%JOUR_SET%),TV_EXTRACTION =a)
*ENDWHEN
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You simply missed setting some members in Data Region! If you want to simulate default.lgf you need to specify dimensions and members here:
Like:
JOUR=2015.01
And the script will work correctly for the single time member.
But if you have:
JOUR=2015.01,2015.02
You will have incorrect result!
Correct script will be:
// No XDIM_MEMBERSET!
*WHEN TV_EXTRACTION
*IS EXTR0014
*WHEN JOUR
*FOR %J%= %JOUR_SET%
*IS %J%
*REC(FACTOR=1,JOUR = TMVL(-1,%J%),TV_EXTRACTION =a)
*NEXT
*ENDWHEN
*ENDWHEN
Vadim
Sample:
Data Region:
PERIODS=2010.JAN,2010.MAR
BE=BE1000
TITLES=1100
PLANTYPE=ACTUAL
Script:
*WHEN INACCT
*IS 101
*WHEN PERIODS
*FOR %P%=%PERIODS_SET%
*IS %P%
*REC(EXPRESSION=%VALUE%,PERIODS=TMVL(-1,%P%))
*NEXT
*ENDWHEN
*ENDWHEN
LGX Result:
*WHEN INACCT
*IS 101
*WHEN PERIODS
*IS 2010.JAN
*REC(EXPRESSION=%VALUE%,PERIODS= 2009.DEC )
*IS 2010.MAR
*REC(EXPRESSION=%VALUE%,PERIODS= 2010.FEB )
*ENDWHEN
*ENDWHEN
Vadim
Sorry, but what for you want to "put every day for example from 01.01.02014 to 01.01.2017"???
Default.lgf will run with the scope of changed members, please read:
To simulate user input for 2 different time periods I used PERIODS=2010.JAN,2010.MAR.
Please explain your requirements from the business user point of view: step by step!
Vadim
the business user requirement is to calculate the difference between inventory in current member - the inventory of the previous member and I should do this for every member of time dimension
when I have Days like values ,
Time diemnsion values : 01.01.2015,2015.01,2015...
Should I put in the script all members of time dimension .
I don't know if I was clear in my explication please mention it not.
thank you so much vadim
"the business user requirement is to calculate the difference between inventory in current member - the inventory of the previous member" Absolutely not clear!
Please, step by step!
What data user enter?
When he want to calculate?
Where he want to store the result?
Etc...
Just explain the proposed work process!
Vadim
Hi Vadim,
we will take example we have here: when the user input value in the inventory cell we should calculate Weight wich is Weight =( Current member of Inventory(Time=02.02.2015)-Previous member of inventory( Time=01.01.2015))/100
1- user will enter decimal numbers
2-he when to calculate it after entering the inventory value (signed data) of the current member.
3-he want to store it in weight.
Please if you need any addtional information tell me
Assuming that "EXTR0014" is Inventory and "a" is weight
"Weight =( Current member of Inventory(Time=02.02.2015)-Previous member of inventory( Time=01.01.2015))/100"
Use default.lgf:
*WHEN TV_EXTRACTION
*IS EXTR0014
*WHEN JOUR
*FOR %J%= %JOUR_SET%
*IS %J%
*REC(EXPRESSION=(%VALUE% -[JOUR].[TMVL(-1,%J%)])/100,TV_EXTRACTION =a)
*NEXT
*ENDWHEN
*ENDWHEN
Here is the script I wrote just to put the value I enter of Inventory in the Weight KPI,
I have Inventory code EXTR0014, Weight a ,
here what i got after executing the script in ujkt
LGX:
*WHEN TV_EXTRACTION
*IS EXTR0014
*WHEN JOUR
*IS 01.01.2015
*REC(FACTOR=1 ,JOUR= 01.01.2014 ,TV_EXTRACTION=a)
*IS 02.01.2015
*REC(FACTOR=1 ,JOUR= 02.01.2014 ,TV_EXTRACTION=a)
*IS 03.01.2015
*REC(FACTOR=1 ,JOUR= 03.01.2014 ,TV_EXTRACTION=a)
*IS 03.01.2015
*REC(FACTOR=1 ,JOUR= 03.01.2014 ,TV_EXTRACTION=a)
*IS 04.01.2015
*REC(FACTOR=1 ,JOUR= 04.01.2014 ,TV_EXTRACTION=a)
*IS 05.01.2015
*REC(FACTOR=1 ,JOUR= 05.01.2014 ,TV_EXTRACTION=a)
*ENDWHEN
*ENDWHEN
-------------------------------------------------------------------------------------------------------------------------------------
LOG:
LOG BEGIN TIME:2016-05-17 20:05:26
FILE:\ROOT\WEBFOLDERS\PLANNING_SHELL1 \ADMINAPP\Extraction_Sucreries\TEST.LGF
USER:FELAMRANI
APPSET:PLANNING_SHELL1
APPLICATION:Extraction_Sucreries
[INFO] GET_DIM_LIST(): I_APPL_ID="Extraction_Sucreries", #dimensions=5
JOUR,MEASURES,SITE,TV_EXTRACTION,VERSION
#dim_memberset=1
JOUR:01.01.2015,02.01.2015,03.01.2015,03.01.2015,04.01.2015,...6 in total.
REC :%value%*(1)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 1 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberset=1
JOUR:01.01.2015,02.01.2015,03.01.2015,03.01.2015,04.01.2015,...6 in total.
REC :%value%*(1)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 2 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberset=1
JOUR:01.01.2015,02.01.2015,03.01.2015,03.01.2015,04.01.2015,...6 in total.
REC :%value%*(1)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 1 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberset=1
JOUR:01.01.2015,02.01.2015,03.01.2015,03.01.2015,04.01.2015,...6 in total.
REC :%value%*(1)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 1 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberset=1
JOUR:01.01.2015,02.01.2015,03.01.2015,03.01.2015,04.01.2015,...6 in total.
REC :%value%*(1)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 2 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberset=1
JOUR:01.01.2015,02.01.2015,03.01.2015,03.01.2015,04.01.2015,...6 in total.
REC :%value%*(1)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 2 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
ENDWHEN ACCUMULATION: 5 RECORDS ARE GENERATED.
DATA TO WRITE BACK:
JOUR SITE TV_EXTRACTION VERSION SIGNEDDATA
01.01.2014 15 a 001 0.00
02.01.2014 15 a 001 0.00
03.01.2014 15 a 001 0.00
04.01.2014 15 a 001 0.00
05.01.2014 15 a 001 44.00
5 RECORDS HAVE BEEN WRITTEN BACK.
WRITING TIME :0.00 ms.
SCRIPT RUNNING TIME IN TOTAL:1.00 s.
LOG END TIME:2016-05-17 20:05:27
But normaly i should have 44 in 04.01.2015 but I got 0
Actually the script has to update the next month also 2 loops required:
*WHEN TV_EXTRACTION
*IS EXTR0014
*WHEN JOUR
*FOR %J%= %JOUR_SET%
*IS %J%
*REC(EXPRESSION=(%VALUE% -[JOUR].[TMVL(-1,%J%)])/100,TV_EXTRACTION =a)
*NEXT
*ENDWHEN
*ENDWHEN
*WHEN TV_EXTRACTION
*IS EXTR0014
*WHEN JOUR
*FOR %J%= %JOUR_SET%
*IS %J%
*REC(EXPRESSION=([JOUR].[TMVL(1,%J%)]-%VALUE%)/100,TV_EXTRACTION =a,JOUR=TMVL(1,%J%))
*NEXT
*ENDWHEN
*ENDWHEN
I tried just to write the same value In Day -1 but it's wrtitign the value in the same day of previous year, I don't know why , so I resolved that by stroring the previous value in another Member of Tv_Extraction and I added another property in the time dimension wich is Day +1 and then I use Destination App .
Ps : after Exectting the script ( just putting the value I enter in the previous day) , here is what happen
DATA TO WRITE BACK:
JOUR SITE TV_EXTRACTION VERSION SIGNEDDATA
01.01.2014 15 a 001 0.00
02.01.2014 15 a 001 0.00
03.01.2014 15 a 001 0.00
04.01.2014 15 a 001 0.00
05.01.2014 15 a 001 44.00 ( the same day of previous year)
5 RECORDS HAVE BEEN WRITTEN BACK.
WRITING TIME :0.00 ms.
Thank you so much Vadim , I'm really grateful.
Property is a good solution but require some maintenance! If you create 2 properties: PREV and NEXT (previous day and next day) then the script will be:
*LOOKUP SameModel
*DIM PRV: JOUR=JOUR.PREV
*DIM NXT: JOUR=JOUR.NEXT
*ENDLOOKUP
//current day calc
*WHEN TV_EXTRACTION
*IS EXTR0014
*REC(EXPRESSION=(%VALUE%-LOOKUP(PRV))/100,TV_EXTRACTION =a)
*ENDWHEN
//next day calc
*WHEN TV_EXTRACTION
*IS EXTR0014
*REC(EXPRESSION=(LOOKUP(NXT)-%VALUE%)/100,TV_EXTRACTION =a,JOUR=JOUR.NEXT)
*ENDWHEN
Vadim
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 7 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 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.