Quantcast
Channel: SCN : Discussion List - SAP Planning and Consolidation, version for SAP NetWeaver
Viewing all articles
Browse latest Browse all 5414

Script Logic - Distribution

$
0
0

Hello:

 

I need help to finish a script logic.

 


BPC NW 10 SP 11, Engine ABAP.


In the model OPERATIVO  we have the following dimensions: POS_PRESUPUESTAL (A), TIEMPO (T), VERSION(C), SOCIEDAD(E), MONEDA(R), MATERIAL (UserD), AREA_FUNCIONAL (UserD), FUENTE (D) and CENTRO_GESTOR (D).


We want to calculate through DM Package this:


The user will select (Prompt) :  AREA_FUNCIONAL,CENTRO_GESTOR,  POS_PRESUPUESTAL, VERSION, TIEMPO.


Through the POS_PRESUPUESTAL value selected in prompt, the script has to search the related materials using property CUENTA in MATERIAL dimension with the same value of the prompt.


The  input fields are: Amount and distribution key for each material. Both are members of POS_PRESUPUESTAL and the value is saved always in JAN.

The script has to distribute the Amount values into the months using distribution key.

 

0 - Do nothing. The user will input month by month as they wish.

1 - Monthly: /12  for each month. JAN to DIC.

2-  Bimonthly: /6 and put the values on FEB, APRIL, JUN, AUG, OCT and DEC.

3 - Quarterly: Amount/4 and put the values on MAR,JUN, SET, DIC

4 - Biannual: Amount/2 and put the values on JUN and DEC.


Example:

script.jpg

 

The script:

 

*SELECT(%YEAR_ACT%,YEAR,TIEMPO,ID=%TIEMPO_SET%)

*SELECT(%MES_ENE%, ID, TIEMPO, LEVEL = 'MONTH' AND MONTHNUM = '1' AND YEAR = '%YEAR_ACT%')

 

*LOOKUP Operativo

*DIM A1:POS_PRESUPUESTAL = Monto

*DIM A1:TIEMPO = %MES_ENE%

*DIM A2: POS_PRESUPUESTAL = Clave_D

*ENDLOOKUP

 

*XDIM_MEMBERSET CENTRO_GESTOR = %CENTRO_GESTOR_SET%

*XDIM_MEMBERSET VERSION = %VERSION_SET%

*XDIM_MEMBERSET FUENTE = Input

*XDIM_MEMBERSET POS_PRESUPUESTAL = %POS_PRESUPUESTAL_SET%

*XDIM_MEMBERSET MONEDA = LC

*XDIM_MEMBERSET TIEMPO = %MES_ENE%

*XDIM_FILTER MAT_SERV = [MAT_SERV].PROPERTIES("CUENTA")=%POS_PRESUPUESTAL_SET%

 

*WHEN MAT_SERV

*IS *

//// Mensual

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(0,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(1,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(2,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(3,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(4,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(5,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(6,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(7,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(8,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(9,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(10,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = TMVL(11,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

 

 

//Bimestral

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = TMVL(1,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = TMVL(3,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = TMVL(5,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = TMVL(7,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = TMVL(9,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = TMVL(11,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

//

////Trimestral

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = TMVL(2,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = TMVL(5,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = TMVL(8,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = TMVL(11,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

//

//Semestral

*REC(EXPRESSION = LOOKUP(A2) == 4?LOOKUP(A1)/2:0,TIEMPO= TMVL(5,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 4?LOOKUP(A1)/2:0,TIEMPO= TMVL(11,%MES_ENE%),POS_PRESUPUESTAL = MAT_SERV.CUENTA)

 

 

*ENDWHEN

 

 

Result in UJK:

 

LGX:

 

 

*LOOKUP Operativo

*DIM A1:POS_PRESUPUESTAL = Monto

*DIM A1:TIEMPO = 2015.01

*DIM A2: POS_PRESUPUESTAL = Clave_D

*ENDLOOKUP

*WHEN_REF_DATA = MASTER_DATA

*XDIM_MEMBERSET CENTRO_GESTOR = CP014070301013

*XDIM_MEMBERSET VERSION = G01

*XDIM_MEMBERSET FUENTE = Input

*XDIM_MEMBERSET POS_PRESUPUESTAL = CP016419061373

*XDIM_MEMBERSET MONEDA = LC

*XDIM_MEMBERSET TIEMPO = 2015.01

*XDIM_FILTER MAT_SERV = [MAT_SERV].PROPERTIES("CUENTA")=CP016419061373

*WHEN MAT_SERV

*IS *

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.01 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.02 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.03 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.04 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.05 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.06 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.07 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.08 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.09 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.10 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.11 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 1?LOOKUP(A1)/12:0,TIEMPO = 2015.12 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = 2015.02 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = 2015.04 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = 2015.06 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = 2015.08 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = 2015.10 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 2?LOOKUP(A1)/6:0,TIEMPO = 2015.12 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = 2015.03 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = 2015.06 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = 2015.09 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 3?LOOKUP(A1)/4:0,TIEMPO = 2015.12 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 4?LOOKUP(A1)/2:0,TIEMPO= 2015.06 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*REC(EXPRESSION = LOOKUP(A2) == 4?LOOKUP(A1)/2:0,TIEMPO= 2015.12 ,POS_PRESUPUESTAL = MAT_SERV.CUENTA)

*ENDWHEN

 

 

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

LOG:

 

 

FILE:\ROOT\WEBFOLDERS\PPTO_PETROPERU \ADMINAPP\Operativo\TEST.LGF

USER:LZAVALAGA

APPSET:PPTO_PETROPERU

APPLICATION:Operativo

[INFO] GET_DIM_LIST(): I_APPL_ID="Operativo", #dimensions=10

AREA_FUNCIONAL,CENTRO_GESTOR,FUENTE,MAT_SERV,MEASURES,MONEDA,POS_PRESUPUESTAL,SOCIEDAD,TIEMPO,VERSION

 

 

#dim_memberset=8

AREA_FUNCIONAL:LIMA,1 in total.

CENTRO_GESTOR:CP014070301013,1 in total.

VERSION:G01,1 in total.

FUENTE:Input,1 in total.

POS_PRESUPUESTAL:CP016419061373,1 in total.

MONEDA:LC,1 in total.

TIEMPO:2015.01,1 in total.

MAT_SERV:6000005010,COMPROME_0466,COMPROME_0467,COMPROME_0468,COMPROME_0469,...6 in total.

 

 

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 1?LOOKUP(A1)/12:0

REC :LOOKUP(A2) == 2?LOOKUP(A1)/6:0

REC :LOOKUP(A2) == 2?LOOKUP(A1)/6:0

REC :LOOKUP(A2) == 2?LOOKUP(A1)/6:0

REC :LOOKUP(A2) == 2?LOOKUP(A1)/6:0

REC :LOOKUP(A2) == 2?LOOKUP(A1)/6:0

REC :LOOKUP(A2) == 2?LOOKUP(A1)/6:0

REC :LOOKUP(A2) == 3?LOOKUP(A1)/4:0

REC :LOOKUP(A2) == 3?LOOKUP(A1)/4:0

REC :LOOKUP(A2) == 3?LOOKUP(A1)/4:0

REC :LOOKUP(A2) == 3?LOOKUP(A1)/4:0

REC :LOOKUP(A2) == 4?LOOKUP(A1)/2:0

REC :LOOKUP(A2) == 4?LOOKUP(A1)/2:0

 

 

CALCULATION BEGIN:

QUERY PROCESSING DATA

QUERY TIME : 145.36 ms. 6  RECORDS QUERIED OUT.

QUERY REFERENCE DATA

QUERY LOOKUP DATA FROM APPLICATION: Operativo

QUERY TIME : 143.73 ms. 18  RECORDS QUERIED OUT.

QUERY TIME : 112.94 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 109.78 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 116.55 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 110.00 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 110.74 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 109.55 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 111.70 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 129.13 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 111.01 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 118.97 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 109.86 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 121.35 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 114.18 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 123.31 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 117.69 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 114.16 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 115.86 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 117.86 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 110.66 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 117.27 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 110.20 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 115.54 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 111.71 ms. 6  RECORDS QUERIED OUT.

QUERY TIME : 110.48 ms. 6  RECORDS QUERIED OUT.

CALCULATION TIME IN TOTAL :2910.40 ms.

72  RECORDS ARE GENERATED.

CALCULATION END.

 

 

SCRIPT RUNNING TIME IN TOTAL:3.84 s.

 

 

The problem with the script is that is not working for the Distribution Key 0. It put all the values in Zero and what I need is to do nothing.

 

 

Please, let me know if you have any suggestions.

 

Thank you.

 

Luciana


Viewing all articles
Browse latest Browse all 5414

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>