cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a variable from a DM package/Script logic into RUNLOGIC_PH

Former Member
0 Kudos

Hi,

I have a piece of transfer logic between a YTD and a periodic model and I am then running a second script in the destination using RUNLOGIC_PH.  This is working successfully

What I am now trying to do is to either pass a variable or create a variable in the second but of logic based on the selection made in the data manager package.  Ideally this variable would be created by a *SELECT statement either in the first transfer logic or the second bit of logic.

The scenario is that I have a Monthly Model with a monthly time dimension transferring data to a Weekly model with a weekly time dimension.  So I am taking a month (base level in monthly time dimension) and wanting to post it to the last week in the month in the weekly model which has weeks as a base level.

In the DM package - a month is selected, there is a property in the monthly time dimension called LAST_WEEK.  I need to be able to pass the LAST_WEEK variable to the second bit of logic so I can use it in the REC statement.

// SCOPING

*XDIM_MEMBERSET ACCOUNT = BAS(P-190-000-000)

*XDIM_MEMBERSET ACCOUNT_DETAIL = BAS(T_DEPARTM)

*XDIM_MEMBERSET AUDITTRAIL = INPUT,ERP//BAS(Inp_ERP)

*XDIM_MEMBERSET CURRENCY = LC,GBP

*XDIM_MEMBERSET ENTITY_MONTHLY = %ENTITY_MONTHLY_SET%

*XDIM_MEMBERSET EXPENSE_TYPE = <ALL>

*XDIM_MEMBERSET INTERCO = <ALL>

*XDIM_MEMBERSET TIME_MONTHLY = %TIME_MONTHLY_SET%

*XDIM_MEMBERSET VERSION = ACTUAL

// DESTINATION

*DESTINATION_APP = WEEKLY

*RENAME_DIM ENTITY_MONTHLY = ENTITY_WEEKLY

*RENAME_DIM TIME_MONTHLY = TIME_WEEKLY

// CALCULATION

*WHEN TIME_MONTHLY.PERIOD

*IS M01

*REC(EXPRESSION = %VALUE%, AUDITTRAIL=MONTHLY,TIME_MONTHLY=TIME_MONTHLY.LAST_WEEK)

*ELSE

*REC(EXPRESSION = [TIME_MONTHLY].[%TIME_MONTHLY_SET%]-[TIME_MONTHLY].[TMVL(-1,%TIME_MONTHLY_SET%)], AUDITTRAIL=MONTHLY,TIME_MONTHLY=TIME_MONTHLY.LAST_WEEK)

*ENDWHEN

// SEND TO THE DATABASE

*COMMIT

// Runs the Monthly Adjustment script in the Weekly model

*START_BADI RUNLOGIC_PH

QUERY=OFF

WRITE=ON

VALIDATION = OFF

LOGIC = MONTHLY_ADJUSTMENT.LGF

APP = WEEKLY

APPSET = GROUPBPC

// Dimension only exist in source

DIMENSION TIME_MONTHLY = <NONE>

DIMENSION ENTITY_MONTHLY = <NONE>

// Dimension only exist in destination

DIMENSION TIME_WEEKLY = BAS(%TIME_MONTHLY_SET%)

DIMENSION ENTITY_WEEKLY = %ENTITY_MONTHLY_SET%

// Dimension that exist in both

*END_BADI

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Not very clear, but

You have MONTHLY model with the script with RUNLOGIC_PH

RUNLOGIC_PH will run script in WEEKLY model.

Please show the script in WEEKLY model!

P.S. %TIME_MONTHLY_SET% can be single month or multiple months?

Anyway you can:

*SELECT(%W%,[LAST_WEEK],TIME_MONTHLY,[ID]=%TIME_MONTHLY_SET%)

...

DIMENSION TIME_WEEKLY=%W%

former_member186338
Active Contributor
0 Kudos

P.P.S. And remove *COMMIT - absolutely useless, WHEN/ENDWHEN will always save data at the end of the loop!

Former Member
0 Kudos

Hi Vadim,

My scope on the runlogic is correct in that I am want to scope all of the weeks within the month so your recommendation of the selection statement doesn't work because the problem is that in my rec statement I only want to send data to the last week of the month.

Here is the logic in the Weekly model:

//*SELECT (%LAST_WEEK%, "[ID]", "TIME_WEEKLY", "[MONTH_ID]='LAST_WEEK'")

// SCOPING

*XDIM_MEMBERSET ACCOUNT = BAS(P-190-000-000)

*XDIM_MEMBERSET ACCOUNT_DETAIL = BAS(T_DEPARTM)

*XDIM_MEMBERSET AUDITTRAIL = ADJ_W2M

*XDIM_MEMBERSET CURRENCY = LC,GBP

//*XDIM_MEMBERSET ENTITY_WEEKLY = %ENTITY_WEEKLY_SET% 

*XDIM_MEMBERSET EXPENSE_TYPE = <ALL>

*XDIM_MEMBERSET INTERCO = <ALL>

//*XDIM_MEMBERSET TIME_WEEKLY = %TIME_WEEKLY_SET%

*XDIM_MEMBERSET VERSION = ACTUAL

// CALCULATION

*WHEN AUDITTRAIL

*IS ADJ_W2M

*REC(FACTOR=0)

*ENDWHEN

// SCOPING

*XDIM_MEMBERSET ACCOUNT = BAS(P-190-000-000)

*XDIM_MEMBERSET ACCOUNT_DETAIL = BAS(T_DEPARTM)

*XDIM_MEMBERSET AUDITTRAIL = ERP, INPUT

*XDIM_MEMBERSET CURRENCY = LC,GBP

//*XDIM_MEMBERSET ENTITY_WEEKLY = %ENTITY_WEEKLY_SET% 

*XDIM_MEMBERSET EXPENSE_TYPE = <ALL>

*XDIM_MEMBERSET INTERCO = <ALL>

//*XDIM_MEMBERSET TIME_WEEKLY = 2016.W05,2016.W06,2016.W07,2016.W08

*XDIM_MEMBERSET VERSION = ACTUAL

// CALCULATION

*WHEN AUDITTRAIL

*IS ERP,INPUT

*REC(FACTOR=1, AUDITTRAIL=ADJUSTMENT,TIME_WEEKLY=%LAST_WEEK%)

*ENDWHEN

*XDIM_MEMBERSET ACCOUNT = BAS(P-190-000-000)

*XDIM_MEMBERSET ACCOUNT_DETAIL = BAS(T_DEPARTM)

*XDIM_MEMBERSET AUDITTRAIL = ERP, INPUT

*XDIM_MEMBERSET CURRENCY = LC,GBP

//*XDIM_MEMBERSET ENTITY_WEEKLY = %ENTITY_WEEKLY_SET% 

*XDIM_MEMBERSET EXPENSE_TYPE = <ALL>

*XDIM_MEMBERSET INTERCO = <ALL>

//*XDIM_MEMBERSET TIME_WEEKLY = 2016.W05,2016.W06,2016.W07,2016.W08

*XDIM_MEMBERSET VERSION = ACTUAL

// CALCULATION

*WHEN ACCOUNT

*IS *

*REC(EXPRESSION = [AUDITTRAIL].[MONTHLY]-[AUDITTRAIL].[ADJUSTMENT], AUDITTRAIL=ADJ_W2M, TIME_WEEKLY=%LAST_WEEK%)

*ENDWHEN

I have created a select statement the same as you recommended before posting this discussion and then used the variable in the rec statement in the weekly model and I get warning on the package and no records are posted because it has not populated the variable.

Any help would be appreciated.

former_member186338
Active Contributor
0 Kudos

Can you show the TIME_WEEKLY screenshot in dimension administration?

Please answer my question: "%TIME_MONTHLY_SET% can be single month or multiple months?"

P.S. The script in WEEKLY is strange, why do you need to repeat scope before each WHEN/ENDWHEN???

Former Member
0 Kudos

Time_Weekly Screenshot:

It will only pass 1 month at a time.

The scoping sections are slightly different in terms of the audit trail dimension.

Justine

former_member186338
Active Contributor
0 Kudos

And TIME_MONTHLY screenshot!

"The scoping sections are slightly different in terms of the audit trail dimension." - you don't need to repeat scoping for dimensions without scope change! WHEN/ENDWHEN don't affect the scope!

Former Member
0 Kudos

Time_Monthly:

former_member186338
Active Contributor
0 Kudos

OK, the solution is to pass Month member:

DIMENSION TIME_WEEKLY = %TIME_MONTHLY_SET% //2015.M03

Then in the WEEKLY script (%TIME_WEEKLY_SET%=2015.M03):

*SELECT(%LASTWEEK%,LAST_WEEK,TIME_MONTHLY,ID=%TIME_WEEKLY_SET%)

//%LASTWEEK%=2015.W...

*XDIM_MEMBERSET ADV=BAS(%TIME_WEEKLY_SET%) //scope to weeks in the month

Answers (0)