Validation and Substitution in SAP
Validation and Substitution in SAP
Validation and Substitution in SAP
In the SAP R/3 System, nearly all input values are validated by a program or against tables or master files. Since some types of validations cannot be standardized, you can use the validations program to create validations for your specific requirements. The validation function enables you to check values and ranges of values as they are being entered in the SAP R/3 System. Validation rules are stored in the Rule Manager. As data is entered into the system, the Integration Manager validates the data against the validation rules. Because data is validated before it is actually posted, only valid information is posted to the FI-SL application component. The system validates account numbers against a master file or checks that a ledger is assigned to a local company code. You use validations when you want to create a user-defined Boolean statement to validate an entry in a way that is not defined for the standard system . A validation can consist of up to 999 steps. You can therefore validate data against any number of Boolean statements before the data is posted. Creating a Validation: 1. Go to transaction GGB0 and select the application area-Financial accounting from the tree menu. Select the node: Line item. Click on the Validation button available on the application toolbar to create the validation and enter the following details: Validation name: VB15_V2 Description: Validation for the tax code Message ID: ZFGL Call up Point: 2 Application area: FI Click on Save.
Note: Validations can be created for all the application areas of FI available on the screen of GGB0 as shown above.
2.
Now click on Step button on the application toolbar to create the validation step with the below details: In the prerequisites sub node enter the below condition: (This validation rule should trigger only for transaction FB01,FB60,FB65,FB02,MIRO,FV60,FV65,FVB0,FBM2,FBV0,FBV2,F-01,F-44,and only for vendor line items(KOART= K) (BKPF-TCODE = 'FB01' OR BKPF-TCODE = 'FB60' OR BKPF-TCODE = 'FB65' OR BKPF-TCODE = MIRO OR BKPF-TCODE = 'FB02' OR BKPF-TCODE = 'FBM2' OR BKPF-TCODE = 'FBV0' OR BKPF-TCODE = 'FBV2' OR BKPF-TCODE = 'FV60' OR BKPF-TCODE = 'FV65' OR BKPF-TCODE = 'F-01' OR BKPF-TCODE = 'F-44) AND (BSEG-KOART = K)
3.
In the message sub node, enter the details of the error message that needs to be displayed.
4.
Go to transaction OB28 to activate the Validation, Click on new entries and enter the following details and save: CoCd (Company code) = VB15. CallPnt = 0002 (Line Item).
Now Test if the validation created will trigger. Go to Transaction FB01 and try to create a vendor credit memo(With One vendor Line item: Posting Key : 21)
5.
Since we have created a validation rule to trigger for company code: VB15 and only for the vendor Line item (KOART = K), the error message is displayed as below.
Give necessary Description for the Substitution and Create a Step as shown below.
Once the Continue Button is clicked the following Screen appears. Specify the type of Substitution. User Exit is chosen when coding needs to be done i.e., Value needs to be derived based on some Logic. Specify the Prerequisites i.e., only when the prerequisites are met the Substitution will work else it will skip.
Now the following section explains how to create the User Exit name. The program ZRGGBS000 should be copied from RGGBS000.
Enter the Following code in the form GET_EXIT_TITLES. DELETE exits WHERE name = 'UFP04'. exits-name = 'UFP04'. exits-param = c_exit_param_field. exits-title = text-prb. APPEND exits. Write the Above piece of code before the statement REFRESH etab. Here UFP04 is the User Exit name (can give any Name).
In the above Report, the Following code also needs to be entered. The Form name should be the User Exit name that was declared above. As the Value gets substituted to the field BSEG-BVTYP we should have the exporting field suffixed by 'E_' i.e., E_BVTYP as shown below.
Next Settings should be done in OBBH for this Substitution as shown below:
Mandatory Fields Vendor Number, Invoice Date, Reference and Currency needs to be entered.Then Select the Payment Tab to see if the Value for Partner Bank Type gets substituted. But you can notice that Partner Bank Type has not been derived in the below screen.
The Reason is "Sometimes for the Substitution to work, all the necessary fields (not only Mandatory Fields, other Fields as well) should be entered with Values".
In the Above Screen the Substitution was not called as the Amount field was Empty.In the below Screen the Amount field is entered, so the Partner Bank type value is substituted automatically.