Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

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 ).

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 ZPLAN_1, which is valid from 01.01.2013 to 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 Content

http://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