cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Validation and set creation

Andrea_Gr
Explorer
0 Likes
499

Hi,


I need assistance with three related configuration tasks.


We need to define a new custom message to be used within our validation rules. How I can make it?

We need to implement a validation rule when there is the control that the posting date of a document mustn’t greater than the acquition date. How I can make it?

We need to define  Sets to manage dynamic value lists and assign them within the validation rules. How I can make it?

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

dawid90
Active Participant
0 Likes

Dear @Andrea_Gr,

How can we define a new custom message for validation rules?

Answer:

  1. Open Fiori app “Manage Substitution/Validation Rules”
  2. Open an existing Validation rule or create a new one.
  3. In General Information:
    • Set Control Level = Error or Warning.
    • Click value help on the Message field.
  4. In the popup:
    • Message ID/number
    • Short text (what user will see)
    • Severity (error/warning)
    • Choose Create
    • Enter:
    • Save.
  5. Back in the rule, select this new message in Message.

Now this custom text will appear when the validation fails.

More details below:

https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps('F4406')/S35

https://help.sap.com/docs/SAP_S4HANA_CLOUD/e6175604fc874bfe84aa14d2f9ae1fbd/5c8c2825535f4e3aa9b7f716...

https://help.sap.com/docs/SAP_S4HANA_CLOUD/a376cd9ea00d476b96f18dea1247e6a5/ac7785b7870344a8998c8492...

How can we implement a validation: Posting Date must not be greater than Acquisition Date?

Answer:

  1. In the same app Manage Substitution/Validation Rules click Create Rule.
  2. Choose:
    • Business Context (e.g. Journal Entry Item / asset-related context).
    • Rule Type = Validation Rule.
  3. In General Information:
    • Set Control Level = Error.
    • Assign the custom message from point 1.
  4. (Optional) In Precondition, restrict where it runs (company code, doc type, etc.).
  5. In the Validation section, add a condition:
    • Field: Posting Date
    • Operator: Less than or equal to (<=)
    • Value/Field: Acquisition Date

If Posting Date > Acquisition Date -> rule fails -> error message is shown.

       6. Save and Activate the rule.

How can we define Sets (dynamic value lists) and use them in validation rules?

Answer:

  1. Open Manage Substitution/Validation Rules
  2. In any rule (Precondition or Validation), add a new condition line.
  3. Choose a field (e.g. Document Type, Company Code).
  4. Choose operator IN / NOT IN.
  5. Click value help on the Value field.
  6. In the popup:
    • Set ID (e.g. Z_DOC_TYPES_INV)
    • Description
    • Values
    • Switch to Set / Set ID view.
    • Choose Create (new set).
    • Enter:
    • Save.
  7. Back in the condition:
    • Select your Set ID as the value.

More details below from SAP Community and SAP Note:

https://community.sap.com/t5/enterprise-resource-planning-blog-posts-by-sap/how-to-extend-a-custom-f...

https://community.sap.com/t5/enterprise-resource-planning-q-a/how-to-create-sets-for-validation-in-s...

https://userapps.support.sap.com/sap/support/knowledge/en/3583820

Best Regards,

Dawid

Andrea_Gr
Explorer
0 Likes
Thank for you answer.
Andrea_Gr
Explorer
0 Likes
Thank for you answer. I try to create the substution, but the public cloud don't allow to insert the condition <= to a field.
Andrea_Gr
Explorer
0 Likes

Thank for you answer. I try to create the validation rule, but the public cloud don't allow to insert the condition <= to a field. In addiction, between the fields there isn't the acquisition date, but the user local date. So, I haven't been able to solve the problem yet.

HenrikeGrtecke
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Andrea,

Thanks very much for your question!

Please refer to the following documents:

Setting Up Messages for Validation Rules

Create Validation Rules

Developer Extensibility

Best regards,

Henrike

Verena_Stuetz
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Andrea,
in addition to the SAP Help Portal sources mentioned above, here are some more answers to your questions:

Q: We need to implement a validation rule when there is the control that the posting date of a document mustn’t greater than the acquition date.
A: For the creation of your validation rule, you need to select and compare the relevant date fields.

Q: We need to define  Sets to manage dynamic value lists and assign them within the validation rules. How I can make it?
A: For a dynamic value list, it’s recommended to create a Custom Business Object. This custom BO needs to include a value list which you can access from the Substitution/Validation Rule app using Table Lookup. For table lookups, you can also refer to the following blog post: How to use table lookup in Substitution and Validation rules.

I hope this helps.
Best regards,
Verena