Skip to Content
0

Passing variables from Data manager Package to script logic issue

Sep 06, 2017 at 02:30 PM

63

avatar image
Former Member

I am trying to pass variable selections from Data manager package to script logic using /CPMB/DEFAULT_FORMULAS DM package, but it doesn't work.It says package status as Success but records are not writing into model.

I tested the script logic using UJKT and it is working fine, am I missing anything here?

DM package code-
PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%,%TIME_DIM%")
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SUSER,%USER%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPPSET,%APPSET%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPP,%APP%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SELECTION,%SELECTION%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,LOGICFILENAME,LTD_MEASURE.LGF)

Script logic-

*SELECT(%YEAR%,YEAR,TIME,[ID]=%TIME_SET%)
*SELECT(%LTD_TOTAL%,ID,TIME,[ID]>=%YEAR%.01 AND [ID]<=%YEAR%.12)

*XDIM_MEMBERSET TIME=%TIME_SET%
*XDIM_MEMBERSET CATEGORY=%CATEGORY_SET%

*WHEN TIME
*IS %LTD_TOTAL%
*WHEN CATEGORY
*IS $CATEGORY_SET$
*REC(EXPRESSION=%VALUE%,CATEGORY=%CATEGORY_SET%,TIME=%TIME_SET%)
*ENDWHEN
*ENDWHEN

DM Package selections
dm-package-selections.jpg

Package LOG-
/CPMB/MODIFY completed in 0 seconds
/CPMB/DEFAULT_FORMULAS_LOGIC completed in 0 seconds
/CPMB/CLEAR completed in 0 seconds
[Selection]
--------------------------------------------------------------
SELECTION = /ENABLE/PROJECTINPUT/PRIVATEPUBLICATIONS/90001200/TempFiles/FROM.TMP@@@SAVE@@@@@@EXPAND@@@|DIMENSION:CATEGORY|ACTUAL|DIMENSION:TIME|2016.LTD
[Message]
--------------------------------------------------------------
model: PROJECTINPUT. Package status: SUCCESS

Formula LOG-
LOG BEGIN TIME:2017-09-06 09:13:30
FILE:\ROOT\WEBFOLDERS\ENABLE\ADMINAPP\PROJECTINPUT\LTD_MEASURE.LGF
USER:90001200
APPSET:ENABLE
APPLICATION:PROJECTINPUT
[INFO] GET_DIM_LIST(): I_APPL_ID="PROJECTINPUT", #dimensions=7
CATEGORY,COSTELEMENT,DATASRC,MEASURES,PO,PROJECT,TIME

#dim_memberset=2
TIME:2016.LTD,1 in total.
CATEGORY:ACTUAL,1 in total.

SCRIPT RUNNING TIME IN TOTAL:0.00 s.
LOG END TIME:2017-09-06 09:13:30
File path: \ROOT\WEBFOLDERS\ENABLE\PROJECTINPUT\PRIVATEPUBLICATIONS\90001200\tempfiles\20170906091330\LTD_MEASURE.LOG

UJKT Test log-
ujkt-validation.jpg

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Vadim Kalinin Sep 06, 2017 at 03:08 PM
0

If you want to copy all months of the year to special month LTD then the correct code will be:

*SELECT(%YEAR%,YEAR,TIME,[ID]=%TIME_SET%)//%TIME_SET%=2016.LTD,%YEAR%=2016
*SELECT(%LTD_TOTAL%,ID,TIME,[ID]>=%YEAR%.01 AND [ID]<=%YEAR%.12) //%LTD_TOTAL%=2016.01,...,2016.12
*XDIM_MEMBERSET TIME=%LTD_TOTAL% //2016.01,...,2016.12
*XDIM_MEMBERSET CATEGORY=%CATEGORY_SET%
*WHEN TIME
*IS * // scoped to 2016.01,...,2016.12
*REC(EXPRESSION=%VALUE%,TIME=%TIME_SET%) //TIME=2016.LTD
*ENDWHEN

This script will work correctly ONLY if the user will select SINGLE LTD month! For multiple LTD months (2015.LTD,2016.LTD) selection FOR/NEXT loop is required.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Vadim Kalinin Sep 06, 2017 at 03:02 PM
0

Absolutely strange code!

*SELECT(%YEAR%,YEAR,TIME,[ID]=%TIME_SET%) //%TIME_SET%=2016.LTD, %YEAR%=2016
*SELECT(%LTD_TOTAL%,ID,TIME,[ID]>=%YEAR%.01 AND [ID]<=%YEAR%.12) //%LTD_TOTAL%=2016.01,...,2016.12
*XDIM_MEMBERSET TIME=%TIME_SET% //2016.LTD
*XDIM_MEMBERSET CATEGORY=%CATEGORY_SET%
*WHEN TIME
*IS %LTD_TOTAL% //2016.01,...,2016.12 - Will be NEVER executed - only 2016.LTD is scoped!!!!!!!!!!!!!!!!
*WHEN CATEGORY // useless line, already scoped
*IS $CATEGORY_SET$ // useless line, already scoped
*REC(EXPRESSION=%VALUE%,CATEGORY=%CATEGORY_SET%,TIME=%TIME_SET%) //CATEGORY=%CATEGORY_SET% - useless!
*ENDWHEN
*ENDWHEN

Please read how to ask questions about script logic and explain what do you want to achieve:

https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/

Share
10 |10000 characters needed characters left characters exceeded
Vadim Kalinin Sep 06, 2017 at 03:21 PM
0

For multiple selection:

*SELECT(%YEARS%,YEAR,TIME,[ID]=%TIME_SET%)//%TIME_SET%=2016.LTD,2015.LTD;%YEAR%=2015,2016
// it's better to use some property to check if the selected period is LTD
//*SELECT(%YEARS%,YEAR,TIME,[ID]=%TIME_SET% AND [LTD]=Y)
*FOR %Y%=%YEARS%
*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10,%Y%.11,%Y%.12
*XDIM_MEMBERSET CATEGORY=%CATEGORY_SET%
*WHEN TIME
*IS * // scoped to %Y%.01,...,%Y%.12
*REC(EXPRESSION=%VALUE%,TIME=%Y%.LTD)
*ENDWHEN
*NEXT
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Sep 06, 2017 at 03:51 PM
0

Hi Vadim-This code is working perfectly, thank you for helping me on this, this DM package is for admin, so we select only single LTD always.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Also in the advanced DM script you can use COMBOBOX prompt to select LTD period with some list for number of years. In this case it's hard to make a mistake!

Read my blog here:

https://blogs.sap.com/2014/09/19/dm-promptcombobox-behavior-in-bpc-nw-10-and-75/

0
Former Member
Vadim Kalinin

Thank you, this is helpful.

0