Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 4 of 5

Custom logic and custom analytical queries

9 min

Fields and screens are about data and layout. Sometimes the requirement is about behavior: check this value, default that one, warn the user. Sometimes it is about insight: show me open fleet orders by contract. Key user extensibility has tools for both, and both need more governance than a field.

Custom logic

The Custom Logic app lets a key user write a small implementation for an extension point that SAP has released for this purpose (technically, a Business Add-In). Each extension point has a defined moment (for example, when a sales document is checked before saving) and a defined set of data it can read and change. The key user writes the logic in a web-based editor using a restricted, safe subset of ABAP and can test it with sample data before publishing.

Business ruleFleet orders must carry a fleet contract number
Extension pointA released check point in sales document processing, chosen in the Custom Logic app
ImplementationA few lines of restricted ABAP: if the customer is a fleet customer and the field is empty, return a message
ActivationPublished and transported like other key user extensions
From a business rule to custom logic.
The Sign-Off Table · thesignofftable.com/academy/sap-bku-205
Typical useExample
ValidationWarn or stop when a fleet order has no contract number
Default valuePropose the fleet segment from the customer's classification
Derivation or substitutionFill a custom field from other values; SAP also offers extension points such as journal entry substitution in finance
Field controlMake a field read-only in certain situations, where the extension point supports it

What custom logic is typically used for.

To see whether logic actually runs, SAP provides a Custom Logic Tracing app, which records when an implementation is called and with which values. It is a key user's best friend when a validation "does nothing".

Custom analytical queries

The Custom Analytical Queries app lets a key user build a query on a released analytical data source (a CDS view that SAP has prepared for analytics), choosing fields, filters, measures and calculations. The result can be used in analytical apps and on the launchpad. Custom fields enabled for the relevant data source can be included.

Custom logicCustom analytical query
Changes process behavior?YesNo; it reads data
Main riskStopping or altering transactionsWrong numbers leading to wrong decisions
Typical testPositive and negative transactions in the scenarioReconcile the query result with a known total
OwnerProcess owner of the affected processOwner of the report and its users
Custom logic and custom queries carry different risks.
The Sign-Off Table · thesignofftable.com/academy/sap-bku-205

Governance

  • A request and approval. Each extension starts from a requirement approved by the process owner.
  • An inventory. Keep a register of every field, logic implementation and query: purpose, owner, business context, transport status.
  • Naming rules. Agree how fields and queries are named so they can be found and understood later.
  • Limits. Decide what key users may do alone and what needs a developer or architect review, for example logic in finance postings.

What would you do?

After Contoso publishes a custom validation for fleet contract numbers, the order desk reports that orders for a non-fleet customer are also being stopped. What should Maria do first?

Key points
  • Custom logic implements released extension points with restricted ABAP for validations, defaults and derivations.
  • Treat logic as code: specification, review, positive and negative tests, owner.
  • Custom Logic Tracing shows when logic runs and with which values.
  • Custom analytical queries read released data sources; reconcile them before use.
  • Keep an inventory of all extensions with owners and approval.

Check your understanding · not graded

Lesson check

  1. 1. What does a key user implement in the Custom Logic app?

  2. 2. Which app helps you see whether custom logic was called and with which values?

  3. 3. What is the main risk of a custom analytical query?

  4. 4. How should a validation be tested?