cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Script Logic - Copy

Former Member
0 Likes
2,658

HELLO,

BPC 10.1NW

iam trying to copy data from 1 period to next 2 periods.Below is my script. I want to copy

2017.09 to 2017.10,2017.11 & 2017.12 to 2018.01,2018.02. When i run below script - 2018.01,2018.02 -data is getting copied from both 2017.09 & 2017.12. script works when i have only one member for time selection. with multiple members it gives incorrect results.

Time = 2017.09,2017.12

version - FORECAST

-----------------------------------------------------

*XDIM_MEMBERSET ACCOUNT = BAS(INVENTORY_FIFO)

*XDIM_MEMBERSET AUDIT_ID = IC_ALLOC_CALC

*XDIM_MEMBERSET TIME = %TIME_SET%

*XDIM_MEMBERSET VERSION = %VERSION_SET%

*WHEN ACCOUNT

*IS *

*FOR %TIM%=%TIME_SET%

*REC(FACTOR=1,TIME=TMVL(1,%TIM%))

*REC(FACTOR=1,TIME=TMVL(2,%TIM%))

*NEXT

*ENDWHEN

Thanks.

View Entire Topic
former_member186338
Active Contributor
0 Likes

Ashish provided a correct script, but I have some extra questions:

if you select 2 months:

2017.09

2017.10

overwrite will happen. What values do you want to have as a result?

Former Member
0 Likes

Thanks Ashish.

Vadim, we run allocations only on quarter end(period 3,6,9 & 12) & want to copy the quarter end values to next 2 periods.

2017.03 to 2017.04,2017.05

2017.06 to 2017.07,2017.08

2017.09 to 2017.10,2017.11

Thanks

former_member186338
Active Contributor
0 Likes

Then it's better to add at the beginning of script:

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET% AND MONTHNUM=3,6,9,12)

and use %TS% instead of %TIME_SET% later

It will reject incorrect user selection.

Former Member
0 Likes

Thanks Vadim.

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET% AND MONTHNUM=3,6,9,12)

above statement throws an error "invalid attribute name (06,09,12) in dimension TIME.

It works only when i have 1 value for monthnum. is there a way to filter with multiple values?

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET% AND MONTHNUM=3) ->this works.

former_member186338
Active Contributor
0 Likes

Standard question - BPC and BW version and SP!!!! I am unable to remember versions for each person on the forum.

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

And screenshot of your TIME dimension, please!

Former Member
0 Likes

BPC 10.1 NW SP 10 ON HANA

BW 7.4 SP 15

former_member186338
Active Contributor
0 Likes

Nothing wrong with your version.

I have tested in UJKT with environmenshell and the result is correct

TIME=2017.03,2017.04,2017.05,2017.06

Script:

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET% AND MONTHNUM=3,6,9,12)
*XDIM_MEMBERSET TIME=%TS%

Result after Execute:

LGX:

*XDIM_MEMBERSET TIME=2017.03,2017.06

Former Member
0 Likes
I can also confirm that the Select statement works with multiple month num with SAP BW 7.5 SP2, SAP BPC 10.1 NW on HANA.

However, if this doesn't work for you, you can use below as a workaround.

*FOR %TIM%=%TIME_SET%

*WHEN TIME

*IS %TIM%

*WHEN TIME.MONTHNUM

*IS 3,6,9,12

*REC(FACTOR=1,TIME=TMVL(1,%TIM%))

*REC(FACTOR=1,TIME=TMVL(2,%TIM%))

*ENDWHEN

*ENDWHEN

*NEXT

The initial scope is large so it would take more time to execute this script. If the data volume in question is not huge, this should serve the purpose.
former_member186338
Active Contributor
0 Likes

To my mind it's better to investigate what's wrong with

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET% AND MONTHNUM=3,6,9,12)

it has to work!

And it's better to provide screenshot of the web administration page of the TIME dimension, not Excel download...

Former Member
0 Likes

TIME SCREENSHOT ATTACHED

time-webadmin.png

Former Member
0 Likes

UJKT ERROR SCREENSHOT

Former Member
0 Likes

found below snote-

2445350 - Error "Invalid attribute name (dynamic variable) in dimension (XXXX)" occurs when validating a Script logic

former_member186338
Active Contributor
0 Likes

The note looks like relevant!

But traditionally MONTHNUM has values 1,2,3... (not 01,02,03... ) Look on the environmentshell sample.

P.S. MONTHNUM is a string property.

Former Member
0 Likes

i tried changing monthnum to 1,2,3,4,...12.

It still didnt work. we'll apply the note to see if it fixes the error. Thanks vadim for your help

former_member186338
Active Contributor
0 Likes

My successful test was on BW 7.50 SP06.