BI-337708827-060614-1444-846 3 Variable Functions Explained Examples

2
Three variable functions ( VARV, VARC, VARI ) in FOX formula. In Fox formula (planning funtion type 0RSPL_FORMULA), there are three functions for variable: VARV, VARC, VARI. Let's use some examples to know how to use it. 1. VARV Meaning: Get a variable value. : Usage example PLANT = VARV(0S_PLANT). The PLANT will get the BW variable 0S_PLANT value. VARV cannot get more than 1 values. When 0S_PLANT contains a range which includes 2 or more than 2 values, the following kind of error will be seen: Variable 0S_PLANT has to be restricted to a single value Message no. RSPLF004 2. VARC Meaning: Get the number of values of a variable. Usage example: N_PLANT = VARC(0S_PLANT). The N_PLANT will receive the number of variable 0S_PLANT values. VARC can calculate the combination of multiple single values and ranges.If 0S_PLANT contains the combination 0001 - 0002; 0003 - 0004; 0005; 0006, the N_PLANT will contain 6. 3. VARI Meaning: Get the N-th variable value. Usage example: I_PLANT = VARI(0S_PLANT, 2). The I_PLANT will receieve the 2nd value of variable 0S_PLANT. VARI also can calculate the combination of multiple single values and ranges like VARC. The system sorts all of the variable values before selecting. If 0S_PLANT contains the combination 0001 - 0002; 0003 - 0004; 0005; 0006, the I_PLANT will contain 0002. These three variable can also work for hierarchy node variable. Usage example: HN_PLANT = VARV( ZHN_PLANT, HIENM = ZH_PLANT, DATETO = ZDATETO ). CT_PLANT = VARC( ZHN_PLANT, HIENM = ZH_PLANT, DATETO = ZDATETO ). N_HN_PLANT = VARI( ZHN_PLANT, HIENM = ZH_PLANT, DATETO= ZDATETO, 2 ).

description

SAP FOX

Transcript of BI-337708827-060614-1444-846 3 Variable Functions Explained Examples

  • Three variable functions ( VARV, VARC, VARI ) in FOXformula.

    In Fox formula (planning funtion type 0RSPL_FORMULA), there are threefunctions for variable: VARV, VARC, VARI. Let's use some examples to knowhow to use it.

    1. VARVMeaning: Get a variable value.

    : Usage example

    PLANT = VARV(0S_PLANT).

    The PLANT will get the BW variable 0S_PLANT value.

    VARV cannot get more than 1 values. When 0S_PLANT contains a range which includes 2 or more than 2 values, the following kind of error willbe seen:

    Variable 0S_PLANT has to be restricted to a single value

    Message no. RSPLF004

    2. VARCMeaning: Get the number of values of a variable.

    Usage example:

    N_PLANT = VARC(0S_PLANT).

    The N_PLANT will receive the number of variable 0S_PLANT values.

    VARC can calculate the combination of multiple single values and ranges.If 0S_PLANT contains the combination 0001 - 0002; 0003 - 0004; 0005;0006, the N_PLANT will contain 6.

    3. VARIMeaning: Get the N-th variable value.

    Usage example:

    I_PLANT = VARI(0S_PLANT, 2).

    The I_PLANT will receieve the 2nd value of variable 0S_PLANT.

    VARI also can calculate the combination of multiple single values and ranges like VARC. The system sorts all of the variable values beforeselecting.

    If 0S_PLANT contains the combination 0001 - 0002; 0003 - 0004; 0005; 0006, the I_PLANT will contain 0002.

    These three variable can also work for hierarchy node variable.Usage example:

    HN_PLANT = VARV( ZHN_PLANT, HIENM = ZH_PLANT, DATETO = ZDATETO ).CT_PLANT = VARC( ZHN_PLANT, HIENM = ZH_PLANT, DATETO = ZDATETO ).

    N_HN_PLANT = VARI( ZHN_PLANT, HIENM = ZH_PLANT, DATETO= ZDATETO, 2 ).

  • ZHN_PLANT is a hierarchy node variable.

    ZH_PLANT is a hierarchy variable.

    ZDATETO is a single value variable for characteristic 0DATE.

    There is a time-dependent hierarchy named , which is valid from to .ZPLAN_1 01.01.2013 31.12.2013

    Hierarchy structure is:

    0001 -> 0002

    -> 0003 ->0004

    ->0005

    When ZHN_PLANT is node 0003, ZH_PLANT is ZPLAN_1 and ZDATETO is 31.12.2013, the result will be:

    1) There is error RSPLF004 for ZHN_PLANT and HN_PLANT cannot get any value, because there are three values for node 0003(value 0003, 0004, 0005).

    2) CT_PLANT = 3.

    3) N_HN_PLANT = 0004.

    Related Contenthttp://help.sap.com/saphelp_nw73ehp1/helpdata/en/4c/af19c70cf30780e10000000a42189b/content.htm?frameset=/en/4c/af19c70cf30780e10000000a42189b/frameset.htm

    SAP Note 1050740 - Planning functions: Hierarchy node variables in formulas

    Three variable functions ( VARV, VARC, VARI ) in FOX formula.