In SAP Asset Accounting, a validation rule may be used to prevent entering a blank field value. The assumption here is the screen layout rule is set to optional for the fields, yet we want the system to prevent a blank entry. For example, a sample validation rule and application behavior to prevent entering a time-dependent field value (e.g. Cost Center or WBS) is shown below.
Defining a validation rule:
The first step involves creating a validation rule using the formula builder (via t-code GGB0) provided by SAP. The transaction code GGB0-Maintain validations can be accessed via the following menu path:
Financial Accounting(New) > Special Purpose Ledger >Tools > Maintain Validation/Substitution/Rules > Maintain Validation
Upon execution of the t-code GGB0, the following screen is displayed. Navigate to the Asset Accounting application area > Master Data node and click on new validation icon as shown in the below picture. Populate validation name and description on the right. In the below example, I have created the validation rule ZCCWBS as shown in the picture.
In this case, the validation rule is mapped to the Asset Accounting application area as shown in the above screen print. The example explained in this document is a simple validation rule and hence doesn’t involve any call-up points such as user exit, functional module, etc. However, if the validation rule is complex, both the application area and call-up point may be used together which may involve programming.
After the validation rule folder created, click on Step to define the rule.
- On the Prerequisite screen, add company code <> blank as shown below.
2. On the Check screen, add the rule WBS Element <> ” OR Cost Center <> ” as shown below.
3. On the Message screen, add/link the custom message# maintained via SE91. A new message or an existing message can be used. In our example, I have picked up message#127.
The custom messages can also be maintained via t-code SE91 by clicking on next free number as shown below. Maintain message short text here. In the above example, the following message is maintained.
In this example, we picked up a message which has the message type “E”. This message is a hard error and it will not let user to proceed further until a valid value is entered in the field value. Alternatively, a message type “W”, “I”, or “S” can be picked, which allows to proceed with a warning message.
Next, go to the transaction code OACV to activate the validation rule.
The system checks the validation conditions when creating/or changing an asset master record. If a check rule is violated, the system displays the error message. The next step involves testing the validation rule built above. Execute the t-code AS01/AS02 to go to Time-depended tab. Do not fill in either WBS or Cost Center. Hit Enter button or navigate to a different tab. The validation rule will be invoked and error message is displayed as shown in the below picture.