cancel
Showing results for 
Search instead for 
Did you mean: 

BPC NW10 : Script 'DEFAULT' , Copy on several TIME

wissler_bastien
Participant
0 Kudos

Hi,

I need to copy from TIME "2016.01" to several  "TIME" in script DEFAULT.LGF

For example: in input form, I enter the following value

    TIME       ACCOUNT       SIGNDATA

2016.01            ACCOUNT1        200

After that I need to have when we save input form : create the 11 new records follonwing

TIME                ACCOUNT           SIGNDATA

2016.01            ACCOUNT1        200

2016.02           ACCOUNT1         200

2016.03            ACCOUNT1        200

2016.04            ACCOUNT1        200

2016.05            ACCOUNT1        200

2016.06            ACCOUNT1        200

2016.07            ACCOUNT1        200

2016.08            ACCOUNT1        200

2016.09            ACCOUNT1        200

2016.10            ACCOUNT1        200

2016.11            ACCOUNT1        200

2016.12            ACCOUNT1        200



I started to write the following script


*XDIM_MEMBERSET CATEGORY = ACTUAL

*XDIM_MEMBERSET ACCOUNT = ACCOUNT1

*WHEN  TIME

*IS 2016.01

*WHEN ACCOUNT

*IS ACCOUNT1

*REC(TIME="2016.02")

*ENDWHEN

*ENDWHEN

Of course, the script is good for only the period 2016.02. I tried with the TMVL and variable....


Can you help me to modify this script ?



NB : NW10SP12, BW731 SP16


Regards

Bastien

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Bastien,

One REC = One copy!

You can use multiple REC's...

But you have to clearly explain your requirements:

Do you want to copy always from the first month?

Do you want to copy to all months of the year except the first month?

Do you want to do it only if category is ACTUAL?

Vadim

wissler_bastien
Participant
0 Kudos

Hi Vadim,

See my answer

Do you want to copy always from the first month? Yes

Do you want to copy to all months of the year except the first month? : Yes

Do you want to do it only if category is ACTUAL? : Yes

Remarks : I dont use the multiple REC's because in order to simplify this example, I want to copy all weeks and not all months, So 52 lines with *REC is too much

Bastien

former_member186338
Active Contributor
0 Kudos

Don't simplify The picture has to be clear!

"So 52 lines with *REC is too much" - another possible option is to use RUNALLOCATION with FACTOR=1 and TIME where: list of target weeks!

But you have to also assume possibility of simultaneous entry of first months of different years

former_member186338
Active Contributor
0 Kudos

//%TIME_SET%=2015.01,2015.02,2016.01,2016.03

*SELECT(%FPS%,[ID],TIME,BASE_PERIOD=1 AND ID=%TIME_SET%) //get list of first periods

//%FPS%=2015.01,2016.01

*SELECT(%YS%,[YEAR],TIME,ID=%FPS%) //get list of years

//%YS%=2015,2016

*XDIM_MEMBERSET CATEGORY = ACTUAL

*FOR %FP%=%FPS% AND %Y%=%YS%

*RUNALLOCATION

*FACTOR=1

*DIM TIME WHAT=%FP%;WHERE=%Y%.02,%Y%.03,...,%Y%.52

*ENDALLOCATION

This script is not perfect because it will be launched even if data is entered not for ACTUAL

The best solution is to write simple write back badi like here:

Vadim

former_member186338
Active Contributor
0 Kudos

If it's only for ACTUAL it can be slightly improved to:

In CATEGORY dimension create property ISACTUAL and fill it with Y for ACTUAL member

*SELECT(%FPS%,[ID],TIME,BASE_PERIOD=1 AND ID=%TIME_SET%)

*SELECT(%YS%,[YEAR],TIME,ID=%FPS%)

*SELECT(%AC%,[ID],CATEGORY,ISACTUAL=Y AND ID=%CATEGORY_SET%)

//%AC% will contain ACTUAL or nothing

*FOR %A%=%AC%

//The code here will not execute if no ACTUAL

// But if multiple categories are processed with ACTUAL - all time members will be calculated - even not ACTUAL

...

Answers (0)