cancel
Showing results for 
Search instead for 
Did you mean: 

Script to populate Cost Centers based on the actual records from a related Benefit Center.

jlhdiaz
Member
0 Kudos
297

When the relationship among Benefit centers is one to one on the dimension property, the scrpit logic delivers appropiate data.
When the relationship among Benefit center is several to one on the dimension property, the scrpit logic DOES NOT deliver appropiate data, it only makes calculations for the first Benefit Center, the second one it make it ceros.
sap-answers-similar-store.txt

Accepted Solutions (0)

Answers (1)

Answers (1)

vishalakshmi
Contributor
0 Kudos

Hello jose,

In Scenario A, the script logic seems to work as expected because each new Benefit Center (CEBE) is related to a unique existing Benefit Center (SEMEJANTE). Therefore, the LOOKUP function retrieves the appropriate data from the related Benefit Center, and the script logic populates the new Benefit Centers accordingly.

In Scenario B, the issue arises because two different new Benefit Centers (TA040480 and TA048760) are related to the same existing Benefit Center (TA024000). The script logic does not handle this situation correctly, and it overwrites the data for one of the new Benefit Centers with zeros.

To address this issue, you can try modifying your script logic to account for multiple new Benefit Centers related to the same existing Benefit Center. You should calculate the data for each new Benefit Center separately and then aggregate the results. Here's a modified script logic suggestion:

*SELECT(%P_YEAR%,"[YEAR]",VERSION, "[ID] = 'PPTO'")

*SELECT(%VERSIONP%,"[VERSION_ACTIVA]",VERSION, "[ID] = 'PPTO'")

*SELECT(%TDA_NVA%,[ID],CEBE,"[TIPO_TDA]='NUEVA'")

*XDIM_MEMBERSET CEBE = %TDA_NVA%

*XDIM_MEMBERSET CUENTA = BAS(BIGNCMC)

*XDIM_MEMBERSET METRICA = IMPORTE

*XDIM_MEMBERSET MONEDARPT = LC

*XDIM_MEMBERSET ODATOS = BAS(OD_SIN_AJ_DIR)

*XDIM_MEMBERSET SOCIEDAD = BAS(COMERCIAL)

*XDIM_MEMBERSET CONCEPTO = NO_CONCEPTO

*XDIM_MEMBERSET TIEMPO = BAS(%P_YEAR%.TOTAL)

*XDIM_MEMBERSET VERSION = %VERSIONP%

*LOOKUP GASTOS

*DIM TDA_SEM:CEBE=CEBE.SEMEJANTE

*ENDLOOKUP

*WHEN_REF_DATA = MASTER_DATA

*WHEN CEBE

*IS *

*REC(EXPRESSION = (LOOKUP(TDA_SEM))*([CUENTA].[FACT_NVA],[ODATOS].[CALINT],[SOCIEDAD].[NO_SOC]),ODATOS = TDA_NUEVAS)

*ENDWHEN

*WHEN CEBE

*IS TA040480

*REC(EXPRESSION = (LOOKUP(TDA_SEM))*([CUENTA].[FACT_NVA],[ODATOS].[CALINT],[SOCIEDAD].[NO_SOC]),ODATOS = TDA_NUEVAS_TA040480)

*ENDWHEN

*WHEN CEBE

*IS TA048760

*REC(EXPRESSION = (LOOKUP(TDA_SEM))*([CUENTA].[FACT_NVA],[ODATOS].[CALINT],[SOCIEDAD].[NO_SOC]),ODATOS = TDA_NUEVAS_TA048760)

*ENDWHEN

*COMMIT

In this modified script logic,

We still use the LOOKUP function to retrieve data from the related Benefit Center (SEMEJANTE).

We added separate WHEN conditions for each new Benefit Center (TA040480 and TA048760). This way, the script logic calculates the data for each new Benefit Center separately.

We use different ODATOS members for each new Benefit Center (TDA_NUEVAS_TA040480 and TDA_NUEVAS_TA048760) to avoid overwriting the data.

This modification should ensure that the script logic properly handles the case where multiple new Benefit Centers are related to the same existing Benefit Center.

Thanks,

Lakshmi.