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

Memory Management in Logic Script?

former_member192555
Participant
0 Kudos
413

Hi Guys,

I have a case with a simple calculation on about 15 million records. Basically, the average of two members should go to a third member. So we have when/endwhen statement with REC=0.5.

The system on which I work is BPC 10.1 NW SP01/AnyDB (I know, it is for ramp-up...).

As you may expect I am experiencing tsv_tnew_page_alloc_failed dump.

I tried to use *XDIM_MAXMEMBERS, but from the limited experience, I had it was not helping. I think it is not releasing the internal table with each iteration. 

For that reason, I am doing the calculation with *FOR/NEXT loop which is making 25-27 When/Endwhen iterations based on members from one of the dimensions.

The question I have is, in which step the internal table is released/truncated?

From my feelings, Maxmembers is querying the data based on the defined slices, making the calculations and keeping the results in the internal table. However, the internal table is growing until all the slices are calculated. 

What are your experiences and do you know more intelligent way of spreading and keeping the internal table low?

Regards,

Emiliyan

Accepted Solutions (1)

Accepted Solutions (1)

former_member192555
Participant
0 Kudos

Hi Guys,

Finally, the script which worked for me was the following. I was not able to use XDIM_PACKAGEBY for an unknown reason. Most probably due to lower ramp-up SP level.

As Vadim suggested, RUNLOGIC_PH will help to decrease the time this script currently takes to run.

//Selecting Base Members

*SELECT (%BASEMEMBERS%, [ID], DIMENSION, CALC = N)

//Looping through all Selected members

*FOR %VAR_ID% = %BASEMEMBERS%

*WHEN DIMENSION

      *IS %VAR_ID%

           *REC(FACTOR = 0.5, DIMENSION = MEMBER)

      *ENDWHEN

*NEXT

former_member186338
Active Contributor
0 Kudos

Have you tested RUNLOGIC_PH?

Former Member
0 Kudos

Hi Emeliyan,

First of all, PACKAGEBY doesn't work with RUNALLOCATION; your initial question was about WHEN/ENDWHEN.

My understanding of that script this script is it erasing all data in the Model. It would be easier just to drop data from the cube. This script will work forever on your 15M records.

If you still want to use something similar I'd suggest looping on all sub nodes of the top node or run each FOR/NEXT loop on some property. RUNALLOCATION commits data after every END....

This will take reasonable time and should not run out of memory.

Regards,

Gersh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Emiliyan,

Yes, WHEN/ENDWHEN has to keep all resulting data in memory in case records from separate batches produce record with same key - then it adds them up. Therefore *XDIM_MEMBRSET is useful when you have a big source set and a small resulting set of records.

You can also try *XDIM_PACKAGEBY. Similarly to RUNLOGIC it writes back each batch of data independently.

Regards,

Gersh

former_member192555
Participant
0 Kudos

Thank you Gersh, I will try it!

former_member186338
Active Contributor
0 Kudos

Hi Emiliyan,

Please try RUNLOGIC_PH badi How To Implement the RUNLOGIC_PH Keyword in SAP... | SCN

Vadim

former_member192555
Participant
0 Kudos

Hi Vadim,

Your idea is to have several Logic Script Files with different data regions?

Updated: I guess CHANGED property splitting the data.

Regards,

Emiliyan

former_member186338
Active Contributor
0 Kudos

The idea of RUNLOGIC_PH is to split scope (by members or property or...)

The scripts will be executed in parallel (depending on settings) but simultaneously calculated scope will be not so huge!

Vadim

former_member186338
Active Contributor
0 Kudos

P.S. Why not to test? Anyway, RUNLOGIC_PH is very useful in different script scenarios like data transfer between cubes!

former_member192555
Participant
0 Kudos

I will consider it, Thanks, Vadim.  I am currently testing something and perhaps in combination RUNLOGIC_PH will work great.

Implementing RUNLOGIC_PH depends on the stakeholders. We will see.