Ansicht
Dokumentation

OKCM_KCVA - Maintain/activate validations

OKCM_KCVA - Maintain/activate validations

TXBHW - Original Tax Base Amount in Local Currency   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

There are two different types of Validations:

  • Single record validations
  • Matrix validations

With the Single record validation, every new or changed data record is individually checked. A test can be executed, for example, as to whether the sum of 2 key figures is smaller or the same as a third.

With the Matrix validation, however, the entirety of the data records is checked. You can, for example, check whether the sum of the credit is the same as the debit.

After the validations have been defined, they can be activated for the following points in time:

  • Before the update in the manual data entry
  • After the summarization and before the update in the data transfer

If serious errors occur, the data cannot be updated. However, if only warnings or information appear the data is updated, but the messages are written in the log which you can check later.

Create your validations and rules.

Preparations

  1. Enter an aspect, for which you wish to maintain validations. Validations are always valid for one aspect. It is possible to copy validations, in order to use them in other aspects.
    If you are using the transaction for the first time for an aspect the validation environment (table entries and program code for the validation) is generated. This process can take some time but is omitted with the next start of the transaction.
  2. For the desired type of validation, select the function 'Maintain validation'. Then select 'Validation -> Create' and enter a name for the validation.
    The system then asks which message classes you wish to use in the aspect (or Boolean class). You can maintain 1000 messages per message class, which are then given in the case of an error in the validation.
  3. Define a new message class with the function 'Create', it should start with a 'Z'. You can use various areas for various aspects in this message class (e.g. Message 1 ... 50 for aspect 900, 51 ... 100 for aspect 901 and so on). In this way, you only have to create a new message class once. The assignment of the message class only takes place when you are maintaining a validation or rule for the first time for a particular aspect.
  4. Select 'ENTER' to leave the dialog window. You then get to the maintenance of validations.

Maintaining validations

Each Validation consists of several steps (up to 1000) and each validation step consists of a prerequisite, a check, and a message. The steps are worked through with one check after another. The message is always given if the prerequisite is fulfilled but the check is not.

Enter a name and select 'Edit -> Insert entry' in order to get to the editor.

Expert mode
If you know the syntax of the Boolean rules, you can enter the formulas directly on this screen in the so-called expert mode.
You can list the permitted fields of the aspect using the key 'Fields for cond.' and transfer them to the rows.
You can get an exact overview of the syntax and the possibilities if you put the cursor on a row of the validation and press F1.

Formula Builder
Using the formula builder you can create formulas without having to learn the syntax. You can select the characteristics and key figures of the data records and calculate with these fields and set up comparisons. In addition, you can access the following system fields:

  • User (SYST-UNAME)

  • Date (at time of validation) (SYST-DATUM)

  • Time (at time of validation) (SYST-UZEIT)

  • Logon language (SYST-LANGU)

  • Transaction code (SYST-TCODE)

  • You can select the operators and formula symbols using pushbuttons. If you wish to use a number in your formula, choose the 'Constant' function.
    You can find an exact description for creating a formula under 'Edit -> User information'.

In the following example with the prerequisite, a check is made as to whether sales are greater than zero. This check ensures that the sales are greater than the sum of the volume-based rebate and sales provision. The formulas are written here with the technical name of the expert mode.

Prerequisite:
CF001-REVEN > '0'
"Check only if sales are greater than zero!"

Check:
CF001-REVEN > ( CF001-BONUS + CF001-VPROV )
"Revenue must be greater than volume-based rebate and sales prov."

Message:
Type E No. 003 Text Division &1: Revenue is smaller than rebates and
sales prov.
Output fields: 1 CF001 - DIV

Among others, you should note the following rules:

Please note the following:

  • Currencies and decimal places
    If you use amounts (e.g. CF001-REVEN > '1000'), the number 1000 is interpreted as an amount with 2 places behind the decimal point. If the revenue is given in Lira, which has no places after the decimal point, you must enter CF001 -REVEN > '1000 (ITL)'. Caution: If you use reference currencies, which depend on the values of a characteristic and different places after the decimal point occur, several validation levels must be defined, which keep apart the cases with the different places after the decimal point using the validation condition. The same goes for the units.

Maintaining messages

By choosing the 'Maintain messages' button, you go to the editor for messages. Here you can enter message texts in the message classes you created. Then you can use them in the validation steps.
You can define up to four variables with the placeholders &1 to &4. These variables are filled and displayed using the fields from the data record, that is, the value of a characteristic, in the validation. So, in the example above the column in which the error appeared is displayed in the message. These message variables only make sense in the single record validation, as in the matrix validation the fields from the last record are set in the message variables. There are four types or grades of messages:

  • Type 'A': Termination
  • Type 'E': Error
  • Type 'W': Warning
  • Type 'I': Information

Messages of type 'A' and 'E' are real errors that prevent the posting of the data. Messages of type 'W' and 'I' are only extra information that is logged. The posting of the data is still allowed.

In Rules, you can store parts of validations that you use more regularly or want to use in several validations at the same time.

Example

You often ask if the value type equals '1' and whether the division only takes the values '00000001' to '00000010' and '00000020' to '00000030'. So that you do not have to always enter this condition (or even longer ones) each time, define the corresponding rule.

You can either do this directly in maintenance of the validation (function 'Maintain rules') or going from the start screen of the transaction.

Then you can combine this rule in validations or in further rules from the rule list. The rules are valid for one aspect respectively and and cannot be used in other aspects. Furthermore, a rule that has been defined for single record validations cannot be used in a matrix validation and vice versa. There is, however, a tool for copying rules to other aspects or from matrix to single record validation.

The following example shows a matrix validation that uses two rules and in which a check is made as to whether plan data for 2017 does not vary by more than 20% from actual data for 2016. Here, the total volume of the record is limited using the where-condition on the actual values for 2016 or plan values for 2017. It is because of the Group statement that the variance of the respective total sums is not checked, rather the sum of the revenue for each combination of division and period is formed and the variance checked. The group statements should, therefore, be identical on both sides of the comparison operator.

  • Rule 'ACT16':
    CF001-PLACTI = '0' "Act." AND CF001-YEARB = '2016'
  • Rule 'PLAN17':
    CF001-PLACTI = '1' "Plan" AND CF001-YEARB = '2017'
    AND CF001-VERSIO = '001' "(Version 1)"
  • Validation 'PREVYEAR':
    SUM ( CF001-REVEN ) WHERE ACT16
    "Use of rule 'ACT16'"
    GROUP_BY CF001-PERIO CF001-DIVIS
    <= '1.20' * SUM ( CF001-REVEN ) WHERE PLAN17
    "Use of rule 'PLAN17'"
    GROUP_BY CF001-PERIO CF001-DIVIS
    "For all combinations of period and division, the sum of
    the actual revenue '16 of all data records is calculated
    with this period and this column and compared with 1.2-
    times the corresponding plan revenue sum '17."

    AND
    SUM ( CF001-REVEN ) WHERE ACT16
    GROUP_BY CF001-PERIO CF001-DIVIS
    >= '0.80' * SUM ( CF001-REVEN ) WHERE PLAN17
    GROUP_BY CF001-PERIO CF001-DIVIS

Caution: With such a check, you must guarantee that the data for the previous year is available. This means, there must be display columns with the previous year's values in the data entry layout or that the actual data from the previous year is transferred with the data transfer. If you do not desire the latter, you can run the aspect summarization after the actual data transfer and select the actual data of the previous year and the plan data of the current year. The aspect summarization would then update the data 1:1 again, but before the update the validation would run and check the plan data against the actual data from the previous year. You can only compare corresponding periods using this method. If, for example, you wish to compare the previous quarter you can only do it if you stay in the same fiscal year. If the last three periods should be accessed anyway for all years you will need the help of a user exit.

After you have created the validations, you must then establish when and which validation should be used for checking. From the start screen of the transaction, you select 'Validation -> Activate for -> 'Data entry / Planning / Data transfer'.

Activating the validations for the data entry and planning

When activating for the data entry or planning, you can assign a validation and/or a matrix validation to each data entry layout of the current aspect. The validations that are assigned to the entry layout or planning layout then run in the layout entry before the data is saved. Thereby, only the new and changed data records are transferred to the single record validation as opposed to all data records in the matrix validation.

Caution: Only period values are checked. If you enter values on the overview screen that are distributed across periods, the numbers of the period screen are checked rather than the visible ones.

Saving is only executed if there is, at worst, a message of type 'W' (Warning) or 'I' (Information). In this case, a log is written with the messages. If only a message of type 'A' (Termination) or 'E' (Error) is available, then the data cannot be saved. In order to test the running of the validation during the data entry, select 'Transaction data -> Validation'. In this way you can view the messages and correct them where necessary before saving.

You display the validation log in the application menu using 'Transaction data -> Data entry -> Display logs' or on the initial screen of the maintenance screen using 'Extras -> Log display -> Data entry or planning'.

Activating the validations for the data transfer

With the activation for the data transfer, you can assign a validation and/or a matrix validation to each sender program that updates data in the current aspect. If data is then transferred with this sender program, the validation is executed after the summarization of the data, meaning with the receiver records. Here, both the single record validation and the matrix validation transfer all data records.

If messages of type 'A' or 'E' are present, the data is not updated and it is noted in the transfer log that the validation has announced some errors. If no messages, or only those of type 'W' and 'I', are present then the data is updated. In both cases, the messages that the validation has produced are written to the validation log. You display the validation log in the application menu using 'Transaction data -> Transfers -> Transfer log' or on the initial screen of the maintenance transaction using 'Extras -> Log display -> Data transfer'.

If you wish to use the same validations for several aspects, you can do so under 'Goto -> Rules/Validations -> Copy' (please see Validations/Copying rules).

You can find a list of the authorizations that are checked in connection with the validations under Authorizations.

If the functionality of the validations does not suffice, you can use User exit and program the necessary functions yourself. You can find further information about this under User exits for the validation.

Due to erroneous validations or inconsistencies, syntax errors can occur in the generated program. The data transfer and saving is then terminated, in as far as the validations are run. You can read more about this in Correcting errors.






BAL_S_LOG - Application Log: Log header data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 15074 Date: 20240524 Time: 011557     sap01-206 ( 261 ms )