Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Hima_Paluri
Advisor
Advisor
17,574

Why is Validation and Substitution rule important?


As the user sets the Validation rule, it checks the validation rule defined on specific fields data. When user is trying to post the transaction and enters data in that specific field, which violates the validation rule, system throws an error message for the user and it will not allow the transaction to post.


It will succeed to post the transaction only when the data is posted in that specific field as defined in the validation rule. It helps to avoid wrong entry at initial stage of posting the transaction.


Whereas Substitution rule is set up to substitute the data immediately upon the entry made. As the user enters the value, system validates according to the prerequisite defined by the user. If the prerequisite rule is met, the system replaces the value entered with other values.


With SAP S/4HANA Cloud 2005, The Manage Substitution/Validation Rules app for JVA is enhanced with the new comparison operator Matches and the new substitution type Table Lookup.


The Matches operator can be used to match a string-type field value against a regular expression.


The Table Lookup substitution type allows user to choose a source field from a custom business object and uses its value to fill in the target field.


Let’s see how it looks and how to configure in the Cloud System with 2005 upgrade:


Apps involved:


Ø Manage Substitution/Validation Rules


Ø Post General Journal Entries


Business Roles :


Unrestricted read/write for:


Ø Configuration Expert - Business Process Configuration: BR_BPC_EXPERT


Ø General Ledger Accountant: BR_GL_ACCOUNTANT


Example:


1. Define Validation Rule


Login with the role Configuration Expert - BPC_EXPERT


Go to “Manage Substitution/Validation Rules”




Click on “Create Rule”.



Enter the following:


Context: Coding Block


Event: Coding Block


Rule Type: Validation Rule


Click on “Create”



Under General Information enter the following:



Under Precondition, enter the following:



Under Validation, enter the following:



Click on “Save”.


Click on “Activate”.



2. Post Journal Entry



Login with the role General Leder Accountant: GL_ACCOUNTANT




Enter the following Header details.




Line Item 1: Enter the following details




Line Item 2: Enter the following details




Click on “Post”.


You should receive the below error message.



Click on OK and go to Line Item 1.



Change the Cost Center to CC_CON



Click on “Post”




3. Create Substitution Rule


Login with the role Configuration Expert - BPC_EXPERT



Go to “Manage Substitution/Validation Rules”



Click on “Create Rule”



Enter the following


Context: Coding Block


Event: Coding Block


Rule Type: Substitution Rule



Click on “Create”



Under General Information, enter the following:



Under Precondition, Enter the following:



Under Substitution, Enter the following:


Substitute Type: Substitute with Constant



Click on Save.


Click on Activate.




4. Post Journal Entry


Login with the role General Ledger Accountant: GL_ACCOUNTANT



Enter the following Header details.



Line Item 1: Enter the following details



Line Item 2: Enter the following details



Click on Post.


Click on Display.



Click on Settings



Select Functional area and click on OK.




Functional Area is YB20 which proves Substitution Rule has been triggered correctly.


With this the user can successfully create and validate the rules as per business requirements.


Please find help link for the feature: https://help.sap.com/viewer/0fa84c9d9c634132b7c4abb9ffdd8f06/2005.500/en-US/5c8c2825535f4e3aa9b7f716...



Thanks & regrads,


Hima.



29 Comments
Nadja_Medeiros
Advisor
Advisor

Thanks for sharing Hilma!

OwenLiu
Product and Topic Expert
Product and Topic Expert

Great content. Thanks for sharing.

Hima_Paluri
Advisor
Advisor
0 Kudos

Thank you Liu.

Hima_Paluri
Advisor
Advisor
0 Kudos

Thank you Medeiros.

Ana_Moreira
Product and Topic Expert
Product and Topic Expert

Very useful Hima. Thanks

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert

h.paluri very informative, thanks for sharing.

Vijayendra
Product and Topic Expert
Product and Topic Expert

Thanks for sharing!

Hima_Paluri
Advisor
Advisor
0 Kudos

Thank you Sandeep.

Hima_Paluri
Advisor
Advisor
0 Kudos

Thank you Moreira.


Hima_Paluri
Advisor
Advisor

Thank you Vijayendra.

LilingJia
Product and Topic Expert
Product and Topic Expert

thanks for sharing. there is customer asking about similar feature and i would like to refer this blog to them.

Norbert_Birtala
Product and Topic Expert
Product and Topic Expert

It is really useful, also easy to follow. thanks

Hima_Paluri
Advisor
Advisor
0 Kudos

Sure, that's great to know..

Hima_Paluri
Advisor
Advisor
0 Kudos

Thanks Birtalan..

GraceZou
Product and Topic Expert
Product and Topic Expert

Hi Hima, thanks for the post! Would you mind adding the help link for the feature: https://help.sap.com/viewer/0fa84c9d9c634132b7c4abb9ffdd8f06/2005.500/en-US/5c8c2825535f4e3aa9b7f716.... I am the docu author and want to promote the help and collect feedback. Thanks!

Hima_Paluri
Advisor
Advisor
0 Kudos

Hi Grace,


Thanks for that, i have added the link now..

Anshu1
Product and Topic Expert
Product and Topic Expert

Great post 🙂

Former Member
0 Kudos

Hi Hima,



Great post.



I'm trying to create a Validation rule slightly more complex (screenshot attached):



For a certain GL account, we would like to enable a profit center OR a range of WBS



The "or" is key here, it would be either one or the other depending of the scenario.



Currently it looks like if I add a line in the Validation rule, the system takes it as a additional condition. "AND". It wont allow me to post my transaction if both condition are not met.



I was wondering if one of you was able to setup a similar Validation rule already ?



Same problem when trying to create a validation rule when for a specific GL account, we would like to enable a Cost Center OR a range of WBS.



Best regards,



Laurent

Hima_Paluri
Advisor
Advisor
0 Kudos

Thanks Anshu..

0 Kudos

Hello Laurent,



Currently the rule maintenance doesn’t provide the option of multiple validations connected by an OR. Though there is a work around by creating two instead of one rule.



What you are trying to achieve:


Precondition:


GL_Accounting EQ 63010300


Validation:


Profit Center BETWEEN [abc] and [def] OR


WB EQ 503040



Instead you can create two rule as follows:


Rule 1:


Precondition:


GL_Accounting EQ 63010300


WB NOT EQ 503040


Validation:


Profit Center IN [abc]



Rule 2:


Precondition


GL_Accounting EQ 63010300


Profit Center NOT IN [abc]


Validation:


WB EQ 503040



This is a little more work, but would serve the same purpose. I’d be happy to get to know in case this suggestion doesn’t work for you.



Regards,


Sandra.


MarNow
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you!


Bhaskar11
Associate
Associate
0 Kudos

I am seeing the overwrite option is disabled in the partner system for cost center. How can I enable the overwrite function for cost center ?

Yang09
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks for sharing Hilma! It is really helpful.

Thorina_Wolf
Explorer
Great explanation! Thank you very much!

It would be great if we could use custom fields and CDS views in the substitution. E.g. I want to put the employee service cost level in a custom field on the entry item.
gieb28
Explorer
0 Kudos
Hello all, is the Substitution & Validation creation also available in the Public Cloud starter system? I have the problem that I can access the app, but cannot edit the conditions or rules. Thanks in advance.
kklow
Explorer
0 Kudos

Hi Hima,

We would like to explore more on the script rather than the steps you mentioned above.

However, we could not find ways to enter the logic based on script.

 

For example, we would like to achieve something similar to /0SAP/SetProfitCenter with codes below where our reference of the profit center is based on SAP standard CDS View I_ServiceDocumentItemEnhcd:

 

SAP sample:

case when not( posting-SoldProduct is initial ) and not( posting-Plant is initial ) then
initialize posting-profitCenter := I_ProductPlantBasic[ where Product = posting-SoldProduct and Plant = posting-Plant ]-ProfitCenter.

Our wish:

case when not( POSTING0-ServiceDocumentType IS INITIAL )
and not( NOT( POSTING0-ServiceDocument IS INITIAL )
and not( NOT( POSTING0-ServiceDocumentItem IS INITIAL)
then initialize posting-profitCenter := I_ServiceDocumentItemEnhcd-ProfitCenter.

Could you please advise how could we code this in scripting function.

We desparately need this feature by end of this week.  If it is available for SAP to code it for us in back-end, we are fine with it.

Thank you.

 

Best regards

KK Low

JayPaul
Explorer
0 Kudos

Thank you sharing the knowledge. 

In HANA Public cloud , how we can this precondition ( Sum ) For .eg sum of total amount ?

Pls help us 

SHEILA4
Newcomer
0 Kudos

 

Thank you for the example. Our team is looking to use this application to update a target field based on preconditions for Subitem and Subitem Category. If the substitution rule is set with Context and Event as GR Journal Entry Item, which data source will be updated: ACDOCA or ACDOCU?

Is there documentation on context or events to see the process flow from precondition to target field?

For reference, we are updating from the field list in the following link:
https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/4ebf1502064b406c964b0911adfb3f01/3e7ac57d3fc64ba78fd...

 

ArogyaAra
Explorer
0 Kudos

Hi Hima,

I was following your step for validation, and it works for journal posting but it's not working for Create Purchase Request and Purchase Order. Is it Apps Manage Substitution and Validation Rules work in the cloud also for Purchase Request and Purchase Order? In my case using FIN_SUBSTNVALDTNCODINGBLOCK and event Coding Block for GL Account. 

 

Best Regards,

 

Arogya K.