Dear experts,
I have this allocation that I am trying to do in script logic but I am not sure how.
We have two models: COST and MARGIN.
In COST, users plan their costs by cost centers. Then, in MARGIN, these costs must be reallocated by PRODUCT/CUSTOMER.
Dimensions are:
COST | MARGIN |
CATEGORY | CATEGORY |
RPTCURRENCY | RPTCURRENCY |
COSTELEMENT | COSTELEMENT |
ORGANISATION (CC/PC) | ORGANISATION |
AUDITTRAIL | AUDITRAIL |
TIME | TIME |
DIVISION | |
SITE_EXPEDITION | |
CUSTOMER | |
PRODUCT | |
REPART_COPA |
I first push the data from COST to MARGIN on a particular AuditTrail (IMPORT_COST), no problem with that.
Now I need to reallocate these costs in model MARGIN.
In MARGIN we have added a dimension REPART_COPA to handle the different way each CC will reallocate to CUSTOMER/PRODUCT.
The dimension look like this:
ID | EVDESCRIPTION | CC | COMP_CODE | DISTRI_CHANNEL | CUSTOMER | VALUEFIELD | CP | PRODUCT |
R_BA11E001 | BA11E001 | BA11E001 | 2521 | [COMPCODE]="2551" | VV430 | 1B | BAS(TOTAL_PRODUCT) | |
R_BA13E001 | BA13E001 | BA13E001 | 2521 | [COMPCODE]="2551" | VV430 | 1B | BAS(TOTAL_PRODUCT) | |
R_BA15E001 | BA15E001 | BA15E001 | 2551 | 30 | [COMPCODE]="2521" AND [CHANNEL]="30" | VV430 | 1B | BAS(TOTAL_PRODUCT) |
REPART_COPA_NA | Répartition NA |
Extract of the CUSTOMER dimension:
ID | CHANNEL | COMPCODE |
01302521-0010020353 | 30 | 2521 |
01302521-0010020357 | 30 | 2521 |
01352521-0010020363 | 35 | 2521 |
01302551-0010022342 | 30 | 2551 |
01302551-0010000404 | 30 | 2551 |
01302551-0010022291 | 30 | 2551 |
01302551-0010024230 | 30 | 2551 |
The script I’m trying:
*SELECT(%CC_TO_REPART%,"CC","REPART_COPA","[ID]<>'REPART_COPA_NA') // get the CC to reallocate > OK
*SELECT(%CLT%,[CLIENT],REPART_COPA,"CC = %CC_TO_REPART%") // get value of property CLIENT of the CC to reallocate
> KO
*XDIM_MEMBERSET CATEGORIE=BUDGETV0
*XDIM_MEMBERSET DEVISE_RPT=LC
*XDIM_MEMBERSET DIVISION=DIVISION_NA
*XDIM_MEMBERSET HCLIENT=CLIENT_NA
*XDIM_MEMBERSET HPRODUIT=PRODUIT_NA
*XDIM_MEMBERSET NATURE=BAS(PANXTNAT)
*XDIM_MEMBERSET ORGANISATION=%CC_TO_REPART%
*XDIM_MEMBERSET REPART_COPA=REPART_COPA_NA
*XDIM_MEMBERSET SITE_EXPEDITION=SITE_EXPEDITION_NA
*XDIM_MEMBERSET SOURCE_DONNEES=IMPORT_COUTS
*XDIM_MEMBERSET TEMPS=2016.01
*FOR %CC%=%CC_TO_REPART%
*RUNALLOCATION
*FACTOR=USING/TOTAL
*DIM_NONAGGR NATURE WHAT=BAS(SFNA); WHERE=VV430; USING=VV010; TOTAL=<<<
*DIM ORGANISATION WHAT=%CC%; WHERE=1B; USING=<<<; TOTAL=<<<
*DIM DIVISION WHAT=DIVISION_NA; WHERE=>>>; USING=BAS(TOTAL_DIVISION); TOTAL=<<<
*DIM HCLIENT WHAT=CLIENT_NA; WHERE=>>>; USING=%CLT%; TOTAL=<<<
*DIM HPRODUIT WHAT=PRODUIT_NA; WHERE=>>>; USING=BAS(TOTAL_PRODUCT); TOTAL=<<<
*DIM SITE_EXPEDITION WHAT=SITE_EXPEDITION_NA; WHERE=>>>; USING=BAS(TOTAL_SITE_EXPEDITION); TOTAL=<<<
*DIM SOURCE_DONNEES WHAT=IMPORT_COUTS; WHERE=COPA; USING=CALCUL; TOTAL=<<<
*ENDALLOCATION
*NEXT
This works fine if I have only one line in the dimension REPART_COPA…. When multiple line, the 2nd select will not work: error saying “UJP_RULE_EXCEPTION:'AND' missing in expression "[SOCIETE]="2521",[SOCIETE]="2521",[SOCIETE]="2551
Ideally I would need to put this 2nd select inside the FOR/NEXT but that does not work like that.
Any idea on how I could do this calculation in script logic? I wanted to avoid writing a BADI …
Thanks in advance for your help,
Camille