Show TOC
Maintain
Formulas
When updating key figures, it is often
necessary to define complex update rules.
These include the definition of formulas for
determining the key figures.
The definition of formulas is subject to widely
differing conditions; for this reason, a flexible medium is necessary for the
defining them.
The maintenance of formulas is subdivided
according to application.
Activities
Choose the application for which you want to
maintain formulas.
An overview of all the existing formulas for
the selected application is displayed.
1. If you want
to define a new formula, enter a new number for the formula in the field
Routine number .
Note
A specific name
range is reserved for standard SAP formulas.
For that reason,
please use numbers 600 through 999 for your formulas.
2. Enter an
explanatory text for your formula.
3. If you would
like to save a long text to describe your formula, proceed as
follows:
a) Position the
cursor on the formula.
b) Select the
function Documentation.
You branch to the
SAP editor.
c) Enter the
text.
d) Save your
text.
e) Return to
the overview screen.
Create/Change
1. To change a
formula, place the cursor on the line of the respective formula.
2. Select the
function Source text.
The system branches
to the ABAP/4 editor.
Caution
A name is
automatically predefined for the FORM routine when the formula is
defined.
You may
not change this name.
3. Now define
your formula using ABAP language elements.
To define the
formula, you can use all the source fields that are valid for the event which
you have selected for the respectve update rule and to which the formula is to
apply.
Note
If you use
transaction SM30 to evaluate the
view V_QUTAB, the system displays an overview of the source
tables permitted for each event.
4. If you
define formulas for key figures with numerical data type (type F, N, P, or X),
you must assign the result of the formula calculation to the field
formula_value.
If you define
formulas for characteristics or key figures with alphanumeric data type, you
need to use the field
formula_value_object.
You can use the
field returncode, to specify the validity of value
determination via the formula.
You should
always define the return code (for example, CLEAR
RETURNCODE).
The fields
formula_value,
formula_value_object and returncode
have already been defined in a common data range.
5. Save the
formula definition.
6. Return to
the overview screen of the formulas.
Example of the
Formula Definition
For the event "Billing document", you want to
determine the profit margin I.
The profit margin I is the difference between
the net value of the billing document and the corresponding cost.
FORM
MCV2_600.
FORMULA_VALUE =
MCVBRP-NETWR - MCVBRP-WAVWR.
RETURNCODE =
0.
ENDFORM.
Activate
A formula definition can only be used in
updating if it is active.
To activate a formula, proceed as
follows:
1. Position the
cursor on a line.
2. Select the
function Edit -> Activate.
Delete
You can only delete a formula if it is
inactive.
If you want to delete a formula, proceed as
follows:
1. Position the
cursor on the line of the formula you wish to delete.
2. Select the
function Edit -> Deactivate.
3. Select the
function Edit -> Delete line.
The formula is then
deleted.