You are on page 1of 15

3/27/2020 Formula Extension (FOX) - SAP Help Portal

Table of Contents   
Highlighting results for "Formula Extension (FOX)" 
US/ffd2865315b86359e1000000

Formula Extension (FOX)
License Usage Con rmation

(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000

License Sales Contract (Rights-R


Send feedback

(/viewer/d26cb97cca534166b0cd
US/dcd2865315b86359e100000

License Acquisition Contract (Bil Use


(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000 You use the SEM-BPS formula extension FOX within the formula function, in order to

Service Contract (Billing Items)


access transaction data of the planning package more exibly than when you sequentially,
uniformly process all data records with the help of available operators. In addition to the
(/viewer/d26cb97cca534166b0cd
US/eed3865315b86359e100000
formula operators, the formula extension offers you the possibility to make statements
dependent on conditions, to run through loops, and issue messages.
Service Contract (Rights-Relevan

(/viewer/d26cb97cca534166b0cd Formula extensions contain a few, easy to learn language elements, with which you can
US/6cd2865315b86359e100000
solve almost all planning tasks, which occur in practice. The syntax of this language
Outgoing Royalties for the Licens element is very similar to the SAP programming language ABAP. Therefore, you can use
(/viewer/d26cb97cca534166b0cd any existing ABAP knowledge, without having to concern yourself with the complexity of a
US/c6d1865315b86359e1000000 full programming language (for example memory management, database access).
Outgoing Royalties for the Service

(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000 Integration
Revenues (Accrual Engine)
The formula extensions are not an independent SEM-BPS function type, they are an
(/viewer/d26cb97cca534166b0cd enhancement to the formulas. You can continue to create formulas in the usual way,
US/83d3865315b86359e100000
without having to make use of the formula extensions.
Paid Con rmations

(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000 Features
Product Sales

(/viewer/d26cb97cca534166b0cd General
US/b3d3865315b86359e100000

Contract All formula extension statements must be completed with a period “.” A statement can
extend across multiple lines in the formula builder, and several statements can be in the
(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 1/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
same line. No distinction is made between upper and lower case. The system automatically
Table of Contents   converts lower case entries into upper case entries. 
US/ffd2865315b86359e1000000
Comments

License Usage Con rmation

(/viewer/d26cb97cca534166b0cd
You can create comments in the formula builder to explain the statements you
Aa
US/abd2865315b86359e100000
programmed, and to make the code easier to read. To do this, set the indicator * in the rst
License Sales Contract (Rights-R
column of a row. This means that the row is ignored by the syntax check, and is skipped
(/viewer/d26cb97cca534166b0cd
when executing the function.
US/dcd2865315b86359e100000

License Acquisition Contract (Bil


 Note
(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000
It is important that you write the indicator * in the rst column of a row. Otherwise the
Service Contract (Billing Items)
system will interpret the indicator as a multiplication operator and report a syntax
(/viewer/d26cb97cca534166b0cd
error.
US/eed3865315b86359e100000

Service Contract (Rights-Relevan

(/viewer/d26cb97cca534166b0cd Syntax
US/6cd2865315b86359e100000

Outgoing Royalties for the Licens


* comment text

(/viewer/d26cb97cca534166b0cd
Explanations
US/c6d1865315b86359e1000000

Outgoing Royalties for the Service


comment text:
(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000
Any character string, which is not interpreted by SEM-BPS as a statement. The character
Revenues (Accrual Engine) string cannot extend over several lines.
(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000 Data Declaration (Local Variables)
Paid Con rmations

(/viewer/d26cb97cca534166b0cd You can declare local variables for a parameter group in the formula builder. You use these
US/09d2865315b86359e100000 variables for example to check the dynamic conditions at the runtime of the planning
Product Sales function, which are dependent on the current key gure values. First you could determine

(/viewer/d26cb97cca534166b0cd the largest or smallest posted value of a key gure within a loop using the transaction data.
US/b3d3865315b86359e100000 Then you can save this value in a variable and then generate new plan data independently
Contract of the variable value. The system initializes variables of the types F and I with the value 0.

(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 2/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal

Table of Contents  
 Note 
US/ffd2865315b86359e1000000
For the language elements FOREACH and MESSAGE it is absolutely necessary that 
License Usage Con rmation reference to characteristics take place via the variables declared before. A direct
(/viewer/d26cb97cca534166b0cd reference to a characteristic using its name is not possible with these language Aa
US/abd2865315b86359e100000 elements.
License Sales Contract (Rights-R

(/viewer/d26cb97cca534166b0cd
Syntax
US/dcd2865315b86359e100000

License Acquisition Contract (Bil


DATA varname TYPE typname .
(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000
Explanations
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd varname:
US/eed3865315b86359e100000

Service Contract (Rights-Relevan Name of the variable. The name can contain letters and gures, but must always begin
with a letter. The name must differ from the reserved words of the formula extension. All
(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000 language elements belong to this (for example DATA, IF) and all formula operators (for
example SIN, CEIL, DECL).
Outgoing Royalties for the Licens

(/viewer/d26cb97cca534166b0cd
typname:
US/c6d1865315b86359e1000000

Outgoing Royalties for the Service


Name of the data type for the data saved in the variables. The permitted types are divided
(/viewer/d26cb97cca534166b0cd into two classes: prede ned types and context-speci c types.
US/f4d3865315b86359e1000000

Revenues (Accrual Engine) Prede ned types:


(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000 I: integer Used to save whole number values. For example, you use this type for the
Paid Con rmations declaration of control variables with which you can count the number of iterations in a loop
(/viewer/d26cb97cca534166b0cd construct.
US/09d2865315b86359e100000

Product Sales

(/viewer/d26cb97cca534166b0cd F: Floating point. Used to save decimals with up to three decimal places; decimal point is
US/b3d3865315b86359e100000 the period “.”. You use this type for all calculation operations.
Contract
Context-speci c types:
(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 3/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal

Table of Contents   Context-speci c types are types, which refer to the key gures and characteristic in the 
US/ffd2865315b86359e1000000 planning level to which the formula function belongs. Which types are allowed depends on
which characteristics of the planning level were included in the list of elds to be changed

License Usage Con rmation
of the formula function. The correct type name is then identical with the technical name of
(/viewer/d26cb97cca534166b0cd
a characteristic. A variable whose type refers to a characteristic of the planning level, can
Aa
US/abd2865315b86359e100000
accept all values which are maintained for this characteristic.
License Sales Contract (Rights-R

(/viewer/d26cb97cca534166b0cd
The KEYFIGURE_NAME type is an exception: This type is only allowed, when you have
US/dcd2865315b86359e100000
included the generic entry "key gure name" in the list of elds to be changed. You can
License Acquisition Contract (Bil
program a loop with a variable of this type, which iterates over all key gures of the
(/viewer/d26cb97cca534166b0cd planning level. In such a loop, you can for example assign all key gures the same value, or
US/8ed2865315b86359e100000
you can de ne conditions on which the value assignment should depend.
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd Example
US/eed3865315b86359e100000

Service Contract (Rights-Relevan In the following example, the system loops through all key gures of the planning level
(/viewer/d26cb97cca534166b0cd using the KeyFigure variable. Key gures, which contain the value 0, are assigned the value
US/6cd2865315b86359e100000 1. The other key gures remain unchanged.
Outgoing Royalties for the Licens
DATA KeyFigure TYPE KEYFIGURE_NAME. FOREACH KeyFigure. ..IF { KeyFigure } = 0. ....
(/viewer/d26cb97cca534166b0cd
US/c6d1865315b86359e1000000 { KeyFigure } = 1. ..ENDIF. ENDFOR.

Outgoing Royalties for the Service


Conditional Statement
(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000
Here you determine that a statement block is only executed if the speci ed condition is
Revenues (Accrual Engine) ful lled. The conditional statement is always introduced by the language element IF and
(/viewer/d26cb97cca534166b0cd closed with ENDIF. You can include as many alternative conditions in a conditional
US/83d3865315b86359e100000 statement as you like with the language element ELSEIF. As soon as one of the speci ed
Paid Con rmations conditions is correct, the statement block belonging to it is executed, and then the
(/viewer/d26cb97cca534166b0cd statement is exited. With the language element ELSE, you can plan one statement block,
US/09d2865315b86359e100000 which is then executed if none of the conditions speci ed before apply.
Product Sales

(/viewer/d26cb97cca534166b0cd Syntax
US/b3d3865315b86359e100000

Contract IF expression1 .

(/ ie er/d26cb97cca534166b0cd
t t t1
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 4/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
.. statement1 .
Table of Contents   
US/ffd2865315b86359e1000000 [ ELSEIF expression2 .

License Usage Con rmation
.. statement2 . ]
(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000
[ ELSE.
License Sales Contract (Rights-R

(/viewer/d26cb97cca534166b0cd .. statement3 . ]
US/dcd2865315b86359e100000

License Acquisition Contract (Bil ENDIF.


(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000 Explanations
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd expression n:
US/eed3865315b86359e100000

Service Contract (Rights-Relevan Logical expression. If expression n results in the value True, then the appropriate
statement block statement n is executed. Otherwise the next logical expression is checked
(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000 (if available), or the statement block assigned to the language element ELSE is executed (if
available). Then processing is continued behind the language element ENDIF.
Outgoing Royalties for the Licens

(/viewer/d26cb97cca534166b0cd
You can use the usual comparison operators in a logical expression (=, <>, <, >, <=, >= or
US/c6d1865315b86359e1000000
EQ, NE, LT, GT, LE, GE) as well as the following additional operator:
Outgoing Royalties for the Service

(/viewer/d26cb97cca534166b0cd NOT: Inverts the logical value of the subsequent expression.


US/f4d3865315b86359e1000000

Revenues (Accrual Engine) IS NIL: Delivers the value True, if it was attempted to read over and above the last data
(/viewer/d26cb97cca534166b0cd record.
US/83d3865315b86359e100000

Paid Con rmations IS INITIAL: Delivers the value True, if a key gure or characteristic contains the initial
value.
(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000

Product Sales

(/viewer/d26cb97cca534166b0cd The operators AND and OR are available for the interlinkage of several logical expressions
US/b3d3865315b86359e100000 to a complex expression. You make the grouping of subexpressions within a complex
Contract expression with round brackets.

(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 5/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
statement n:
Table of Contents   
US/ffd2865315b86359e1000000 Statement block, which is then executed, when the check of the previous logical statement
results in the value True. Otherwise the statement block is skipped.

License Usage Con rmation

(/viewer/d26cb97cca534166b0cd
Example
Aa
US/abd2865315b86359e100000

License Sales Contract (Rights-R


In the following example sales per customer are planned. The size of the planned sales
(/viewer/d26cb97cca534166b0cd
increase depends on the size of previously made sales: The sales with customers, to which
US/dcd2865315b86359e100000
a sales revenue of more than EUR 50000 is already allotted, should increase by 10%, while
License Acquisition Contract (Bil
the increase with customers under this threshold should amount to 20%. The formula
(/viewer/d26cb97cca534166b0cd operand used in the example has the form { key gure name, customer, version }. Version 0
US/8ed2865315b86359e100000
contains the actual data, version 1 the plan data.
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd DATA Customer TYPE 0CUSTOMER. FOREACH Customer. ..IF { REVENUE, Customer, 0 }
US/eed3865315b86359e100000 >= 50000. ....{ REVENUE, Customer, 1 } = { REVENUE, Customer, 0 } * 1.1. ..ELSEIF {
Service Contract (Rights-Relevan REVENUE, Customer, 0 } < 50000. ....{ REVENUE, Customer, 1 } = { REVENUE,
(/viewer/d26cb97cca534166b0cd Customer, 0 } * 1.2. ..ENDIF. ENDFOR.
US/6cd2865315b86359e100000

Outgoing Royalties for the Licens Loop Constructs

(/viewer/d26cb97cca534166b0cd
The formula extensions offer two different language elements for the programming of
US/c6d1865315b86359e1000000
loops: DO ... ENDDO and FOREACH ... ENDFOR. Both language elements are used for
Outgoing Royalties for the Service
different purposes:
(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000
The statement DO ... ENDDO executes a statement block between the language
Revenues (Accrual Engine) elements until a termination condition is ful lled. When this condition is ful lled,
(/viewer/d26cb97cca534166b0cd processing must be explicitly terminated with the command EXIT. Processing is
US/83d3865315b86359e100000 continued in this case with the statement which follows ENDDO.
Paid Con rmations
The statement FOREACH ... ENDFOR executes an iteration over the values of a
(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000 characteristic sorted in ascending order (restricted by selection conditions from
planning level or package, if required), or over the key gures contained in the
Product Sales

(/viewer/d26cb97cca534166b0cd planning level. The reference to the characteristic or list of key gures must always
US/b3d3865315b86359e100000 take place via a previously declared local variable. The termination criterion is
Contract implicitly speci ed when the last characteristic value or last key gure is reached.

(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 6/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
Syntax
Table of Contents   
US/ffd2865315b86359e1000000 1. DO ... ENDDO

License Usage Con rmation
DO.
(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000
.. statement1 .
License Sales Contract (Rights-R

(/viewer/d26cb97cca534166b0cd
.. IF expression1 .
US/dcd2865315b86359e100000

License Acquisition Contract (Bil .. . [statement2 . ]


(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000 .... EXIT.
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd .. ENDIF.
US/eed3865315b86359e100000

Service Contract (Rights-Relevan ENDDO.

(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000 2. FOREACH ... ENDFOR

Outgoing Royalties for the Licens


FOREACH varname [, varname] .
(/viewer/d26cb97cca534166b0cd
US/c6d1865315b86359e1000000
.. statement1 .
Outgoing Royalties for the Service

(/viewer/d26cb97cca534166b0cd ENDFOR.
US/f4d3865315b86359e1000000

Revenues (Accrual Engine) Explanations


(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000 expression1:
Paid Con rmations
Logical expression, which de nes the termination criterion for loop processing. When
(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000 expression1 results in the value True, then the appropriate statement block statement2 is

Product Sales

(/viewer/d26cb97cca534166b0cd executed (if available). In any case, the EXIT command must be used when the termination
US/b3d3865315b86359e100000 condition is reached, as otherwise there is no possibility to exit the loop.
Contract
statement1:
(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 7/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal

Table of Contents   Statement block, which is executed in every loop pass. 


US/ffd2865315b86359e1000000
statement2: 
License Usage Con rmation

(/viewer/d26cb97cca534166b0cd
Optional statement block, which is executed when the termination condition is reached. Aa
US/abd2865315b86359e100000

License Sales Contract (Rights-R


varname:
(/viewer/d26cb97cca534166b0cd
US/dcd2865315b86359e100000
Variable, which refers to a characteristic contained in the planning level, or to the quantity
License Acquisition Contract (Bil of key gures contained in the planning level (type KEYFIGURE_NAME).
(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000
 Note
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd With the FOREACH loop you can not only iterate over the values of an individual
US/eed3865315b86359e100000
characteristic, but also over characteristic combinations, which are contained in the
Service Contract (Rights-Relevan transaction data of the package. For this you should include the characteristics
(/viewer/d26cb97cca534166b0cd involved in a list separated by commas in the FOREACH statement (for example
US/6cd2865315b86359e100000 FOREACH var1, var2, var3.). In this way, in most cases, you achieve a considerably
Outgoing Royalties for the Licens quicker processing than with several FOREACH statements nested in each other,
(/viewer/d26cb97cca534166b0cd which only iterate over one of the characteristics.
US/c6d1865315b86359e1000000

Outgoing Royalties for the Service


Example
(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000
1. DO ... ENDDO
Revenues (Accrual Engine)

(/viewer/d26cb97cca534166b0cd The example shows how you can calculate the factorial of a number (here the factorial of
US/83d3865315b86359e100000 5) with the statement DO ... ENDDO. It is very important that the loop passes are counted
Paid Con rmations in the variable Counter, and the loop is exited with the EXIT statement when the
(/viewer/d26cb97cca534166b0cd termination criterion is reached.
US/09d2865315b86359e100000

Product Sales

(/viewer/d26cb97cca534166b0cd DATA Factorial TYPE I. DATA Counter TYPE I. DATA Result TYPE I. Result = 1. Counter =
US/b3d3865315b86359e100000 0. Factorial = 5. DO. ..Counter = Counter + 1. ..IF Counter <= Factorial. ....Result = Result
Contract * Counter. ..ELSE. ....EXIT. ..ENDIF. ENDDO.

(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 8/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
2. FOREACH ... ENDFOR
Table of Contents   
US/ffd2865315b86359e1000000 In the following example, the system loops through all key gures of the planning level. Key
gures, which contain the value 0, are assigned the value 1. The other key gures remain

License Usage Con rmation
unchanged.
(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000
DATA KeyFigure TYPE KEYFIGURE_NAME. FOREACH KeyFigure. ..IF { KeyFigure } = 0. ....
License Sales Contract (Rights-R
{ KeyFigure } = 1. ..ENDIF. ENDFOR.
(/viewer/d26cb97cca534166b0cd
US/dcd2865315b86359e100000
Messages
License Acquisition Contract (Bil

(/viewer/d26cb97cca534166b0cd You can issue messages to point out errors and special features to users when executing a
US/8ed2865315b86359e100000
formula function, or to give information about processing progress with time-consuming
Service Contract (Billing Items) operations.
(/viewer/d26cb97cca534166b0cd
US/eed3865315b86359e100000 Syntax
Service Contract (Rights-Relevan

(/viewer/d26cb97cca534166b0cd
MESSAGE Tnnn ( class ) [WITH var1 [[[ var2 ] var3 ] var4 ]].
US/6cd2865315b86359e100000
Explanations
Outgoing Royalties for the Licens

(/viewer/d26cb97cca534166b0cd
T:
US/c6d1865315b86359e1000000

Outgoing Royalties for the Service


Type of message. Allowed values are E (error) and I (information).
(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000
 Note
Revenues (Accrual Engine)

(/viewer/d26cb97cca534166b0cd
If you issue a message of type E, then the results of the planning function are not
US/83d3865315b86359e100000
written in the internal transaction data buffer, and can therefore not be posted (see
Paid Con rmations
Saving Concept).
(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000

Product Sales
nnn:

(/viewer/d26cb97cca534166b0cd Three- gure number of the message to be issued within the message class.
US/b3d3865315b86359e100000

Contract class:

(/ ie er/d26cb97cca534166b0cd
E t f th l l di db k t t hi h th
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX)
t b i d 9/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
Entry of the message class enclosed in round brackets, to which the message to be issued
Table of Contents   belongs. 
US/ffd2865315b86359e1000000

License Usage Con rmation  Recommendation
(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000 As far as possible, use messages from a message class you created in the ABAP
License Sales Contract (Rights-R Workbench. In this way, you make sure that your messages are independent of
(/viewer/d26cb97cca534166b0cd possible changes to delivered message classes. However, you must transport the
US/dcd2865315b86359e100000 message class you created, from the test system into the production system.
License Acquisition Contract (Bil

(/viewer/d26cb97cca534166b0cd WITH var1 [[[ var2 ] var3 ] var4 ]:


US/8ed2865315b86359e100000

Service Contract (Billing Items) Optional extra, to issue up to four text variables in the message text. You can use local
(/viewer/d26cb97cca534166b0cd variables, which reference characteristics or the list of key gures, as text variables, or text
US/eed3865315b86359e100000 constants. The text variables are inserted into the static message text (short and long text)
Service Contract (Rights-Relevan in the places, which were prepared for it with the placeholder &.
(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000 Example

Outgoing Royalties for the Licens


In this example, the planned price of an article is increased by 10% for all customers. If the
(/viewer/d26cb97cca534166b0cd
price for a customer is with the value 0 in the data basis, then an error message is issued,
US/c6d1865315b86359e1000000
which also contains the name of the customer. Because of the system behavior described
Outgoing Royalties for the Service
above with messages of the type E, no key gure values at all are changed in this case (also
(/viewer/d26cb97cca534166b0cd not for data records in which the price has a value different to 0). To execute the price
US/f4d3865315b86359e1000000
increase, you must rst change the data records with the value 0 or remove it from the
Revenues (Accrual Engine) selection.
(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000 The formula operand used in the example has the form { key gure name, customer,
Paid Con rmations version }. Version 0 contains the actual data, version 1 the plan data.
(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000 DATA Customer TYPE 0CUSTOMER. FOREACH Customer. ..IF { Price, Customer, 0 } = 0.
Product Sales ....MESSAGE E001(/MSG01) WITH Customer. ..ELSE. ...{ Price, Customer, 1 } = { Price,

(/viewer/d26cb97cca534166b0cd Customer, 0 } * 1.1. ..ENDIF. ENDFOR.


US/b3d3865315b86359e100000

Contract Special Data Access Functions

(/ ie er/d26cb97cca534166b0cd
A t Ti Ch t i ti
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 10/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
Access to Time Characteristics
Table of Contents   
US/ffd2865315b86359e1000000 You can access time characteristics with the function TMVL. The function returns the
current value of the speci ed time characteristic, if necessary, marked up with an offset, 
License Usage Con rmation
which is also speci ed. The entry of an offset offers the advantage that in this way such
(/viewer/d26cb97cca534166b0cd
characteristics can also be delivered, which are not contained in the transaction data of
Aa
US/abd2865315b86359e100000
the current planning package.
License Sales Contract (Rights-R

(/viewer/d26cb97cca534166b0cd
Syntax
US/dcd2865315b86359e100000

License Acquisition Contract (Bil


TMVL (characteristic name, offset )
(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000 Explanations
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd characteristic name:


US/eed3865315b86359e100000

Service Contract (Rights-Relevan Technical name of the time characteristic, whose value should be calculated.

(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000 offset:

Outgoing Royalties for the Licens


Whole number offset, with which the current value of the time characteristic is marked up.
(/viewer/d26cb97cca534166b0cd
The entry of the offset is obligatory. If you want to transfer the value of the time
US/c6d1865315b86359e1000000
characteristic unchanged, then enter an offset of 0.
Outgoing Royalties for the Service

(/viewer/d26cb97cca534166b0cd Example
US/f4d3865315b86359e1000000

Revenues (Accrual Engine) In the following example, the net book values of an asset are calculated with straight-line
(/viewer/d26cb97cca534166b0cd depreciation over a ve year duration of depreciation. Cost price is 1000, net book value
US/83d3865315b86359e100000 100, depreciation percentage rate 20%. The function TMVL determines the value of the
Paid Con rmations time characteristic FYEAR and adds an offset of 1. The value increased by 1, is assigned to

(/viewer/d26cb97cca534166b0cd FYEAR within the DO...ENDDO loop, so that the calculation of the net book value is
US/09d2865315b86359e100000 executed for a sequence of ve scal years. After that the iteration is terminated. The

Product Sales operand for this formula has the form { key gure name, scal year }.

(/viewer/d26cb97cca534166b0cd DATA YEAR TYPE I. DATA FYEAR TYPE 0FISCYEAR. FYEAR = VARV('ACTYEAR'). DO.
US/b3d3865315b86359e100000 .YEAR = YEAR + 1. .FYEAR = TMVL(FYEAR, 1). .{0AMOUNT, FYEAR} = DECL(1000, 100,
Contract 20, YEAR}. .IF YEAR = 5. . .EXIT. .ENDIF. ENDDO.

(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 11/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
Access to Attributes
Table of Contents   
US/ffd2865315b86359e1000000 With this function, you can access data, which neither concerns characteristics or key
gures, but master data attributes, which can be assigned to a characteristic.

License Usage Con rmation

(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000  Note
License Sales Contract (Rights-R

(/viewer/d26cb97cca534166b0cd The attribute value of a characteristic that is compounded to a superordinate


US/dcd2865315b86359e100000 characteristic, can only be determined with the ATRV function, if the superordinate
License Acquisition Contract (Bil characteristic is not included in the list of characteristics to be changed.

(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000
Syntax
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd ATRV( attributname, varname )


US/eed3865315b86359e100000

Service Contract (Rights-Relevan Explanations

(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000 attributname:

Outgoing Royalties for the Licens


Technical name of the attribute, whose value should be calculated.
(/viewer/d26cb97cca534166b0cd
US/c6d1865315b86359e1000000
varname:
Outgoing Royalties for the Service

(/viewer/d26cb97cca534166b0cd Variable, which refers to the characteristic, to which the attribute belongs.
US/f4d3865315b86359e1000000

Revenues (Accrual Engine) Example


(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000 In this example, the prices are conducted as attributes for the characteristic article. You
Paid Con rmations use the ATRV function to determine the attribute value. The function expects the technical

(/viewer/d26cb97cca534166b0cd
name of the attribute to be read (for example 0PRICE) as parameter, and a variable, which
US/09d2865315b86359e100000 refers to the characteristic, to which the attribute belongs (for example 0ARTICLE). The

Product Sales
operand for this formula has the form { key gure name, article }.

(/viewer/d26cb97cca534166b0cd DATA ARTICLE TYPE 0ARTICLE. FOREACH ARTICLE. .{REVENUE, ARTICLE} =


US/b3d3865315b86359e100000 ATRV('0PRICE', ARTICLE) * {QUANTITY, ARTICLE}. ENDFOR.
Contract
Access to Variables
(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 12/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal

Table of Contents   With this function, you can determine the value of a (global) Variable , which was de ned in 
US/ffd2865315b86359e1000000 the context of the current planning area.

License Usage Con rmation

(/viewer/d26cb97cca534166b0cd  Note Aa
US/abd2865315b86359e100000

License Sales Contract (Rights-R In the context of formula extensions, only such variables can be used, which are
(/viewer/d26cb97cca534166b0cd restricted to single value. Otherwise the system cannot clearly determine the value of
US/dcd2865315b86359e100000 the variables.
License Acquisition Contract (Bil
Direct access to a global variable using its name (in a value assignment with the form "
(/viewer/d26cb97cca534166b0cd
US/8ed2865315b86359e100000 {Operator} = varname.") is not possible. Always use the VARV function for this
purpose.
Service Contract (Billing Items)

(/viewer/d26cb97cca534166b0cd
US/eed3865315b86359e100000 Syntax
Service Contract (Rights-Relevan
VARV( varname )
(/viewer/d26cb97cca534166b0cd
US/6cd2865315b86359e100000
Explanations
Outgoing Royalties for the Licens

(/viewer/d26cb97cca534166b0cd
varname:
US/c6d1865315b86359e1000000

Outgoing Royalties for the Service


Technical name of the variable.
(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000
Example
Revenues (Accrual Engine)

(/viewer/d26cb97cca534166b0cd In the following example two variables of the type 0CUSTOMER are declared. One of them
US/83d3865315b86359e100000 is used as a control variable for an iteration over all customers. The other one is reserved
Paid Con rmations using the VARV function with the value of the global variable VCUST, as it was de ned in

(/viewer/d26cb97cca534166b0cd the context of the planning area. In the iteration, as soon as the customer de ned by the
US/09d2865315b86359e100000 variable is reached, the planned revenue for all articles is increased by 10%. Subsequently,

Product Sales

(/viewer/d26cb97cca534166b0cd the iteration is terminated with the EXIT statement. The operand for this formula has the
US/b3d3865315b86359e100000 form { key gure name, article }.
Contract
DATA ARTICLE TYPE 0ARTICLE. DATA CUSTOMER TYPE 0CUSTOMER. DATA
(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 13/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
VCUSTOMER TYPE 0CUSTOMER. VCUSTOMER = VARV('VCUST'). FOREACH
Table of Contents   CUSTOMER. .IF CUSTOMER = VCUSTOMER. . .FOREACH ARTICLE. . . .{REVENUE,

US/ffd2865315b86359e1000000 ARTICLE} = (REVENUE, ARTICLE) * 1.1. ..ENDFOR. . .EXIT. .ENDIF ENDFOR.

License Usage Con rmation
Determination of the Current Characteristic Value
(/viewer/d26cb97cca534166b0cd Aa
US/abd2865315b86359e100000
With this function, you can transfer the current value of a characteristic to a variable, and
License Sales Contract (Rights-R
in this way nd out which data was currently edited. The function OBJV is called up
(/viewer/d26cb97cca534166b0cd
without entering parameters. First the type of the variable (and with it the characteristic,
US/dcd2865315b86359e100000
to which the variable refers) is determined, to which the function result should be
License Acquisition Contract (Bil
assigned. Then the function determines the current value of the characteristic referenced
(/viewer/d26cb97cca534166b0cd by the variable, and returns the value as function result.
US/8ed2865315b86359e100000

Service Contract (Billing Items) Above all, the function is used to keep the list of elds to be changed as small as possible.
(/viewer/d26cb97cca534166b0cd This has the following advantages:
US/eed3865315b86359e100000

Service Contract (Rights-Relevan The complexity of the formula operands decreases.


(/viewer/d26cb97cca534166b0cd
Iterations, which are super uous in content, but syntactically necessary can be
US/6cd2865315b86359e100000
reduced using characteristic values. The performance improves through this.
Outgoing Royalties for the Licens

(/viewer/d26cb97cca534166b0cd
US/c6d1865315b86359e1000000  Note

Outgoing Royalties for the Service


The result of the function OBJV can only be assigned to such variables, which were
(/viewer/d26cb97cca534166b0cd
declared with reference to one of the characteristics, which are not contained in the
US/f4d3865315b86359e1000000
list of elds to be changed of the formula function.
Revenues (Accrual Engine)

(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000 Syntax
Paid Con rmations
varname = OBJV()
(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000
Explanations
Product Sales

(/viewer/d26cb97cca534166b0cd varname:
US/b3d3865315b86359e100000

Contract Technical name of the variable.

(/ ie er/d26cb97cca534166b0cd
E l
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 14/15
3/27/2020 Formula Extension (FOX) - SAP Help Portal
Example
Table of Contents   
US/ffd2865315b86359e1000000 In the following example, the example used above for the VARV function is enhanced in the
following way: An additional variable is declared of the type 0COUNTRY, to which the

License Usage Con rmation
current value of the characteristic is transferred within the FOREACH loop. Revenue
(/viewer/d26cb97cca534166b0cd
planning is executed as in the example above, however, not for articles that were sold in
Aa
US/abd2865315b86359e100000
Germany. Prerequisite for calling up the OBJV() function is that the characteristic
License Sales Contract (Rights-R
0COUNTRY is not contained in the quantity of elds to be changed.
(/viewer/d26cb97cca534166b0cd
US/dcd2865315b86359e100000
DATA ARTICLE TYPE 0ARTICLE. DATA COUNTRY TYPE 0COUNTRY. DATA CUSTOMER
License Acquisition Contract (Bil
TYPE 0CUSTOMER. DATA VCUSTOMER TYPE 0CUSTOMER. VCUSTOMER =
(/viewer/d26cb97cca534166b0cd VARV('VCUST'). FOREACH CUSTOMER. .IF CUSTOMER = VCUSTOMER. . .FOREACH
US/8ed2865315b86359e100000
ARTICLE. . . .COUNTRY = OBJV(). . . .IF COUNTRY = 'DE'. . . . .{REVENUE, ARTICLE} =
Service Contract (Billing Items) (REVENUE, ARTICLE) * 1.1. . . .ENDIF. ..ENDFOR. . .EXIT. .ENDIF ENDFOR.
(/viewer/d26cb97cca534166b0cd
US/eed3865315b86359e100000 See also:
Service Contract (Rights-Relevan

(/viewer/d26cb97cca534166b0cd Formula Extension:Examples


US/6cd2865315b86359e100000

Outgoing Royalties for the Licens  Previous (/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/42f9895360b93d58e10000000a174cb4.html) Next 

(/viewer/d26cb97cca534166b0cd
US/c6d1865315b86359e1000000

Outgoing Royalties for the Service

(/viewer/d26cb97cca534166b0cd
US/f4d3865315b86359e1000000

Revenues (Accrual Engine)

(/viewer/d26cb97cca534166b0cd
US/83d3865315b86359e100000

Paid Con rmations

(/viewer/d26cb97cca534166b0cd
US/09d2865315b86359e100000

Product Sales

(/viewer/d26cb97cca534166b0cd
US/b3d3865315b86359e100000

Contract

(/ ie er/d26cb97cca534166b0cd
https://help.sap.com/viewer/d26cb97cca534166b0cd52f94e935524/7.57.25/en-US/a9f9895360b93d58e10000000a174cb4.html?q=Formula Extension (FOX) 15/15

You might also like