Skip to Content

Help on Script logic?

Hi All,

We have a requirement to calculate standard costing based on rate value and user input.

standard costing = user input *rate value. Rate value will always save in current year last period (December) with entity none (E_NONE).

User may input in multiple years but script should pickup current period and current ENTITY and should multiply with December of current period year and E_NONE.

Example scenario:

ENTITY1 2016.MAY 100

E_NONE 2016.DEC 20

Final value:

ENTITY1 2016.MAY 200

Below is the scrip logic i have written as part of the code execution: (it is working fine for single user input but unable to pickup multiple members in select member when enter more than one)

*XDIM_MEMBERSET TIME=%TIME_SET%

*XDIM_MEMBERSET ENTITY=%ENTITY_SET%

*FOR %VAR4% = %TIME_SET%

*SELECT(%VAR1%,"[YEAR]",TIME,[ID]=%VAR4%)

*WHEN AUDITTRAIL

*IS INPUT

*REC(EXPRESSION = %VALUE% * ([ENTITY].[E_NONE],[TIME].[%VAR1%.APR],[AUDITTRAIL].[CALC]),CURRENCY=LC,AUDITTRAIL=STD_CAL,TIME=%VAR4%) *ENDWHEN

*NEXT

Thanks,

Naidu

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    Oct 31, 2016 at 11:51 AM

    There is a simple workaround for multiple years, but requiring some administration :)

    In TIME dimension create a property: LASTMONTH and fill it with the correct id:

    2016.MAY LASTMONTH:2016.DEC

    2016.JUN LASTMONTH:2016.DEC

    2016.JUL LASTMONTH:2016.DEC

    ...

    2017.MAY LASTMONTH:2017.DEC

    ...

    Then the script will be:

    *LOOKUP SameModel
    *DIM ENTITY="E_NONE"
    *DIM AUDITTRAIL="CALC"
    *DIM LM:TIME=TIME.LASTMONTH
    *ENDLOOKUP
    
    *WHEN AUDITTRAIL
    *IS INPUT
    *REC(EXPRESSION = %VALUE% * LOOKUP(LM),CURRENCY=LC,AUDITTRAIL=STD_CAL)
    *ENDWHEN
    
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 10:17 AM

    Hi Valdim,

    We are on SAP NW 10.0 and below error have got when we run from UJKT.

    LGX:

    *XDIM_MEMBERSET TIME=%TIME_SET%

    *XDIM_MEMBERSET ENTITY=%ENTITY_SET%

    *WHEN AUDITTRAIL

    *IS INPUT

    *REC(EXPRESSION = %VALUE% * ([ENTITY].[E_NONE],[TIME].[%VAR1%.DEC],[AUDITTRAIL].[CALC]),CURRENCY=LC,AUDITTRAIL=STD_CAL,TIME=%TIME_SET%)

    *ENDWHEN

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

    LOG:

    FILE:\ROOT\WEBFOLDERS\REPORTING \ADMINAPP\BFPlan\TEST.LGF

    USER:*****

    APPSET:REPORTING

    APPLICATION:BFPlan

    [INFO] GET_DIM_LIST(): I_APPL_ID="BFPlan", #dimensions=7

    ACCOUNT,AUDITTRAIL,CURRENCY,MEASURES,TIME,VERSION,ENTITY

    #dim_memberset=2

    TIME:2015.MAY,2016.JUN,2 in total.

    ENTITY:E_DUMMY,1 in total.

    REC :%VALUE% * ([ENTITY].[E_NONE],[TIME].[.DEC],[AUDITTRAIL].[CALC])

    CALCULATION BEGIN:

    QUERY PROCESSING DATA

    QUERY TIME : 1.00 ms. 6 RECORDS QUERIED OUT.

    QUERY REFERENCE DATA

    UJK_VALIDATION_EXCEPTION:Member ".DEC" not exist

    Thanks,

    Naidu

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 10:47 AM

    Hi Valdim,

    We want to run this script from default logic.

    Our requirement is to calculate Cost using Rate and Demand and the calculation will be Rate*Demand.

    Rate will always will be in last month of eh year at ENTITY NONE.

    demand is an user input for all 12 periods where it will use rates to calculate cost.(for all 12 periods we will using last month rates)

    Example:

    Demand Combination

    ENTITY1

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 10:54 AM

    Hi Valdim,

    We want to run this script from default logic.

    Our requirement is to calculate Cost using Rate and Demand and the calculation will be Rate*Demand.

    Rate values stores at last month (DEC) of the every year with Entity member ENTITY_NONE Where as Demand values are user input values for all 12 periods with all entities.

    Example:

    Demand Combination

    ENTITY1 2016.MAY 100

    ENTITY2 2017.NOV 200

    Rate Combination:

    ENTITY_NONE 2016.DEC 10

    ENTITY_NONE 2017.DEC 20

    Result Cost:

    ENTITY1 2016.MAY 1000

    ENTITY2 2017.NOV 4000

    Regards,

    Naidu

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 10:58 AM

    Solution - will work for data input for single year!

    //%TIME_SET%=2016.MAY,2016.JUN,2016.JUL
    *SELECT(%Y%,"[YEAR]",TIME,[ID]=%TIME_SET%) //%Y%=2016,2016,2016
    *SELECT(%LM%,"[ID]",TIME,[YEAR]=%Y% AND PERIOD=DEC) //%LM%=2016.DEC
    *WHEN AUDITTRAIL
    *IS INPUT
    *REC(EXPRESSION = %VALUE% * ([ENTITY].[E_NONE],[TIME].[%LM%],[AUDITTRAIL].[CALC]),CURRENCY=LC,AUDITTRAIL=STD_CAL)
    *ENDWHEN
    
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 11:35 AM

    Hi Valdim,

    As you said its working for single year but we have to input 3 years at a time from input template.

    any work around for this?

    Regards,

    Naidu

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 01, 2016 at 05:17 AM

    Hi Valdim,

    Thank you very much. We followed the same approach.

    Regards,

    Naidu

    Add comment
    10|10000 characters needed characters exceeded