cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic operations with Variable in DM Advanced Script

former_member302911
Active Participant
0 Kudos

Hi,

I have created a custom DM Packages for copy all the dimension from one version to another.

I want to minimize the input from the final user and i set only one Prompt to get the YEAR.

The script:

PROMPT(COMBOBOX,%YEAR%,Insert Year:,1,,{2015,2016,2017,2018,2019,2020})

INFO(%Q1%,.Q1)

INFO(%Q2%,.Q2)

INFO(%Q3%,.Q3)

INFO(%Q4%,.Q4)

.....

TASK(/CPMB/CM_CONVERT................TIME_DIMENSION|%YEAR%%Q1%,%YEAR%%Q2%,%YEAR%%Q3%,%YEAR%%Q4%||....................

.....

This work fine for me, but i need to copy the data for 3 YEAR.

Example:

User Input 2015 | Copy 2015/2016/2017 - V1 to 2015/2016/2017 - V2

Is there a way to create a variabile like INFO(%YEAR_1%,%YEAR% + 1) ?

If there is no way with script, what is the best way to perform my requisite(Logic Script/Badi) ?

Thanks,

Angelo.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Angelo,

"Is there a way to create a variabile like INFO(%YEAR_1%,%YEAR% + 1) ?" - unfortunately not possible!

For sure you can create badi, but script logic will also do the job:

Let's assume that you pass Year in the variable $Y$ to the script (using TASK(...REPLACEPARAM..,

The script will be:

*XDIM_MEMBERSET TIME= $Y$.Q1,...,$Y$.Q4,TMVL(4,$Y$.Q1),...

Please explain - you have quarters as base members?

Screenshot of your TIME dimension administration?

Vadim

former_member302911
Active Participant
0 Kudos

Thanks for reply Vadim,

yes i have quarters as base members. Example for 2015:

I'm not familiar with Script Logic because i'm an abaper and work better with Badi, but if the solution with Script Logic is more easier than implement BADI_UJ_CUSTOM_LOGIC i want to learn how to do that.

Thanks in advance,

Angelo.

former_member186338
Active Contributor
0 Kudos

For TMVL function to work correctly you need to have TIMEID property to be properly configured!

TMVL(4,$Y$.Q1) will result in 2016.Q1 ($Y$=2015)

if you have increasing number in TIMEID.

Please show your values in TIMEID!

The script is simple:

*XDIM_MEMBERSET VERSION=V1

*XDIM_MEMBERSET TIME= $Y$.Q1,$Y$.Q2,$Y$.Q3,$Y$.Q4,TMVL(4,$Y$.Q1),TMVL(4,$Y$.Q2),TMVL(4,$Y$.Q3),TMVL(4,$Y$.Q4),TMVL(8,$Y$.Q1),TMVL(8,$Y$.Q2),TMVL(8,$Y$.Q3),TMVL(8,$Y$.Q4)

*WHEN TIME

*IS * //scoped

*REC(EXPRESSION=%VALUE%,VERSION=V2)

*ENDWHEN

Vadim

former_member302911
Active Participant
0 Kudos

Thanks Vadim,

i have configured TIMEID for order purpose, created the advanced script to pass variable $Y$ and finally write the code in the Script Logic file.

The copy working fine, except a strange error (BPC 10.0 SP16) when validate the file:

TMVL(4, $Y$.Q1) return Invalid TMVL return value

TMVL(4, %Y%.Q1) and TMVL(4, 2015.Q1) validate with no problem

However if i save the file with error, the package run well.

Now i have the last question:

When use the syntax *REC(EXPRESSION=%VALUE%,VERSION=V2) i want to pass 2 dynamic variable for CATEGORY and VERSION like *REC(EXPRESSION=%VALUE%,CATEGORY=$CATEGORY%, VERSION=$VERSION$), it is possible ?

I have tried to pass two variable with REPLACEPARAM but the package log return an error for Invalid Member.

Thanks,

Angelo.

former_member186338
Active Contributor
0 Kudos

First - ignore validation error, just save script!

Second: If you want to pass dimension member from DM advanced script to the script logic code you have 2 options:

1. Use SELECTION to pass some initial script scope that you can use in script logic as %SOMEDIMNAME_SET%

2. Use TASK MEMBERSELECTION to pass individual $VAR$ variables. REPLACEPARAM is for text only strings like TEXT or COMBOBOX.

Vadim

Answers (0)