Customizing Field Values with a Logical Formula

Objective

After completing this lesson, you will be able to use a logical formula to customize field values.

How to Use a Logical Formula to Customize Field Values

You’ve learned how to customize field values with mathematical formulas. Next, you’ll learn how to use a logical formula to customize field values.

Note

Logical formulas support logical operators and brackets: (, <, >, !, ==, &&, ||, )

You can also include the Date and Time API in the logical formula.

The previous video showed only one lookup field. However, you can define more than one lookup field for a specific object. For example, when a sales person creates a new sales order for an item and wants to know if this item was already promoted to this customer, you will:

  1. Add a UDF to the master Data – Activities category "Item_Promoted". UDF Master Data – Activity category, Data Type: Linked to Entity – System Object – OITM Items. Type: Alphanumeric. Structure: Regular.
  2. Add another UDF to the master Data – Activities category "Promoted".UDF Master Data – Activity category, Type: Alphanumeric. Structure: Checkbox.
    The sales person can create an activity for each call with the customer and use these fields to update that this specific item was promoted. User-Defined Fields tab in an activity phone call type with 2 UDFs.
  3. Add a UDF to the Marketing Documents – Rows "Promoted". UDF in Marketing Document – Rows category. Type: Alphanumeric. Structure: Checkbox.
  4. Add a UDV to the "Promoted" UDF. UDV formula based including database fields with one trigger and two lookup fields from the one lookup object.

This will inform the sales person who is creating the sales order if the item was already promoted.

Sales Order – detailed view - Contents tab – UDF checkbox.

In addition, you can define more than one lookup object. For example, if the user needs to check whether the shipping type in a sales order row is identical to the shipping type of the Item master data, and to the shipping type of the Business Partner. If all of the shipping types are not identical, you want to turn on a checkbox "Ship Different". This will alert the user who is filling the order.

  1. Add a UDF to Marketing Documents – Rows "Ship Different".UDF in Marketing Document – Rows category. Type: Alphanumeric. Structure: Checkbox.
  2. Add a UDV to this UDF. UDV formula based including database fields with one trigger and two lookup Objects.
    This will inform the user if there is a difference in the shipping type. Sales Order – detailed view - Contents tab – UDF checkbox.

How to Create a Conditional Formula Using Logical Functions

In this video, you’ll learn how to build a conditional formula using logical functions that automatically adjusts a freight charge on a sales order based on the order's total value. Key steps include:

  • Identifying the necessary database fields using the Desktop client.
  • Writing an IF statement in the formula editor.
  • Configuring both manual and automatic refresh triggers to update the values.

Note

For more information on logical functions, refer to Logical Functions | SAP Help Portal.

For more information on unique names (or unames) and where to find them, refer to Finding the uname for a UI Field | SAP Help Portal.

Summary

  • Logical formulas support logical operators and brackets (, <, >, !, ==, &&, ||, ).
  • Customize field values using logical formulas to automatically check conditions, such as customer balance thresholds.
  • Use lookup functions to retrieve data from database fields for logical formula conditions.
  • Define multiple lookup fields and objects to enhance data customization and validation.
  • Logical formulas can trigger actions based on specific conditions, aiding in decision-making processes.