You are on page 1of 28

Advanced decision modeling with Decision

Model and Notation (DMN)

SIG151

Collection: 23
Material number: 50160940
Advanced Decision Modeling with DMN 1.2
Training agenda
– conducted onsite (1 day) or remotely (2 sessions for 4 hours)

Advanced modeling of decisions

9 am – Data usage and modeling concepts


• Transfer decision logic from BPMN to DMN
• Dealing with complexity
• Use of data objects

9:30 am – List iterations


• Multi instance decisions
• Hands-on exercise (multi instance decision)

Advanced creation of decision logic

11 am – Advanced logic [part 1]


• Functions in decisions
• Numeric functions
• Text functions
• Hands-on exercise (checking text and numerical values)

12 pm to 1 pm – LUNCH BREAK

1 am – Advanced logic [part 2]


• Functions in decisions
• Functions for date/time
• Use of literal expressions
• Hands-on exercise (calculate insurance premium)
• Forecast and usage

4:30 pm – End of the training

Copyright/Trademark
Dictionary and data modeling concepts

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 3

Complex data types

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 4
Complex data types

ඵ Contains relationships to other data types

ඵ Allows to summarize input data which have the same context

• Street (as text)


• Zip code (as number)
• Country (as enumeration)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 5

Complex data types

ඵ Can even contain other complex data

ඵ Keeps a diagram with a lot of input data comprehensible

• Street (as text)


• Zip code (as number)
• Country (as enumeration)
• Address (as complex data type)
• Active contract? (as boolean)
• Age (as number)
• Customer status (as enumeration)
• Name (as text)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 6
Dictionary usage: Complex (composed) data types

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 7

Dictionary usage: Business knowledge sources

ඵ Allows traceability
ඵ Ensures naming consistency
ඵ Enable impact analysis

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 8
Advanced decision logic modeling
– Multi instance decisions

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 9

Use cases for list iterations

The (currently) Consider all The first 5 people An order is valid, if


highest bid on an persons in will be awarded all its items are
auction manager position valid

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 10
Multi instance decisions

ඵ Input Data (simple or complex) must be a list


ඵ e.g., list of customers, orders, employees, products

ඵ Purpose: iteration over list values


ඵ Iteration is automatic, from top to bottom

ඵ Output can be single or complex type


ඵ If output has one column = single type
ඵ if output has multiple columns = complex type (e.g., name + age)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 11

Multi instance decisions


How to work with multi-instance decisions?

Use Case: Sum up all numbers on a list, which are greater than 10

What happens with all the


checked values?

What needs to be checked for


each single value?

Choose the Input list for the


Multi Instance Decision

What list Input is needed?

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 13
Multi-instance decisions
Other forms

ඵ Can contain any number of decisions

ඵ Can be nested (e.g., list of lists)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 14

Practical Exercise

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 15
Exercise: Executives for a
business flight
For a lot of managers and consultants, business flights are part of their daily job.
To prevent the company risk in case of an air crash, only a certain number of
executives are allowed to be on the same plane at the same time. The actual
allowed number depends on the destination.

Destination:
Middle East max. 1 executive
Europe no further restrictions
For all other countries max. 2 executives

Use the complex data type List of Travellers from the dictionary in combination
with a multi-instance decision to count all the executives on the list. Use the
simulation to check your result.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 16
1 6

Advanced decision logic modeling:


Functions
– Useful functions for numeric data

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 17
Statistical functions for numeric lists

ඵ Analysis of numeric values, e.g., measurements

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 18

Arithmetical functions for numeric data

ඵ Calculation of different input data (input as well as result)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 19
Arithmetical functions for numeric data

ඵ Comparison of calculated values

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 20

Advanced decision logic modeling:


Functions
– Useful functions for text data

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 21
Functions for text
Parsing

ඵ Analysis of strings such as model codes or lading numbers for specific characters

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 22

Functions for text


Concatenating

ඵ Can be used to create dynamic (error) messages/hints

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 23
Functions for text
Validation

ඵ Can be used to validate text Inputs for further processing

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 24

Functions for text


Converting

ඵ Text can be split up to parse for specific characters

ඵ Use Number (string) to convert a part of a string to a number

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 25
Practical Exercise

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 26

Exercise: Functions on numbers


and text
A valid model code for a product consists of 7 digits. The first part defines the
product type, the second part determines the model number. The product type
consists of the first 2-3 digits and the model number correspondingly consists of
the last 5 or 4 digits. Was verstehen
E.g.: SPX1234 or U154321
Sie unter einem
Use a proper function to split the model number from the product type and show
them, together with the status as the result of the decision. Prozess?
• If the model code starts with SPX or EXP, the last 4 numbers are needed -
status is code valid.
• If the model code starts with U1 or U2, the last 5 numbers are needed –
status is code valid.
• If none of the codes hit or the code has not exactly 7 digits,
return -99 and code invalid.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 27
2 7
Advanced decision logic modeling:
Functions
– Useful functions for dates

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 28

Use cases for Date functions

ඵ Payment within 30 days of approved invoices

ඵ Inspection by 3 business days

ඵ Latest delivery after 3 days of an incoming order

ඵ All Orders which are older than 2 weeks

ඵ All applications of the last month

Manufacturing Scenario:
When does the next order of material have to be triggered? (Delivery
time, daily consumption, etc.)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 29
Functions for dates
Compare differences

ඵ Difference between today and an Input date is the most common use case

ඵ Use Today () for the current date and Now () for the current time (timestamp)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 30

Functions for dates


Calculating

ඵ Often specific dates need to be calculated in advance

ඵ For instance: latest possible date for payment, future orders, estimated delivery dates etc.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 31
Practical Exercise

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 32

Exercise: Calculate the annual


premium | 1
The total premium for a car insurance is calculated as the sum of two different
basic premiums. One of them is the car premium, which is based on the
following rules:
Model year:
Max. 1 year premium of $500
Between 1 and 5 years premium of $300
Between 5 and 10 years premium of $250
Older than 10 years no influence to the premium
Type:
Compact car premium of $300
Sedan premium of $300
Luxury car premium of $500
Airbag equipment:
No Airbag no discount
Drivers Airbag (only) lower the premium by 12%
Front Airbag (only) lower the premium by 15%
Front- and Side Airbags lower the premium by 20%
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 33
33
Exercise: Calculate the annual
premium | 2
The second part is the driver premium. The amount depends on the driver’s risk
score, which will be determined by following criterias:
Gender:
Female 5 Points
Male 10 Points
Age:
Younger than 21 30 Points
Between 21 and 27 20 Points
Between 28 and 60 10 Points
Older than 60 30 Points
Status of relationship:
Married -10 Points
Single 0 Points
If the score is greater than 30 premium of $500
If the score is between 20 and 30 premium of $300
If the score is less than 20 premium of $200
Bonus: Raise the premium by $150 per accident.
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 34
34

Advanced decision logic modeling


– Literal expressions

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 35
Literal expressions instead of decision tables

ඵ Can use all functions and complex expressions

ඵ Logic, which cannot be expressed in decision tables (e.g., function calls, temporary values, manipulating
lists)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 36

Literal expressions
Manipulating lists

ඵ Use Append (list, string) to add values to a provided list

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 37
Literal expressions
Manipulating lists

ඵ Use AppendAll (list1, list2) to append all list values to a provided list

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 38

Literal expressions
Zip function

ඵ Use Zip (attributes, values, class)


to combine values of different lists for creating a new list

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 39
Literal expressions
Zip function

ඵ The new list can be provided to a multi instance decision

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 40

Decisions in business processes


– and their impact

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 41
Decision modeling questions

Responsibility
p • Who is responsible for the next task?

Next steps • What is the next step of the process?

Pathway
Pathw • Which path of the process needs to be taken?

Data and access • Is the information valid?

Event • Does any subprocesses need to be triggered?

© 2022 SAP SE or an SAP


P affiliate company. All rights reserved. | INTERNAL – SAP and Custom
Customers only 43

Impact of decisions on business processes

Participant
Partic

Decisio can decide who or what system


Decision
should do something or who is qualified
for it

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 44
Impact of decisions on business processes
Participant

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 45

Impact of decisions on business processes

Next steps
s

Decisio can dynamically decide what


Decisions
next steps of a process should be
the nex

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 46
Impact of decisions on business processes
Next steps

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 47

Impact of decisions on business processes

Process pathway
Proce

Decisio dictate the paths taken by a


Decisions
proces
process

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 48
Impact of decisions on business processes

Data and
a access

Decisio dictate the data requirements


Decisions
who has access to the data
and wh

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 49

Impact of decisions on business processes


Data and access

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 50
Impact of decisions on business processes

Events detector
Event

Decisio detect the internal


Decisions
and external
ex events

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 51

Impact of decisions on business processes


Events detector

© 2022 SAP SE or an SAP affiliate company. All rights reserved. | INTERNAL – SAP and Customers only 52
Thank you.
SAP Copyrights and Trademarks

© 2022 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or


for any purpose without the express permission of SAP SE or an SAP
affiliate company.

SAP and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP
SE (or an SAP affiliate company) in Germany and other countries.
Please see http://global12.sap.com/corporate-en/legal/
copyright/index.epx for additional trademark information and notices.

Some software products marketed by SAP SE and its distributors


contain proprietary software components of other software vendors.

National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for


informational purposes only, without representation or warranty of any
kind, and SAP SE or its affiliated companies shall not be liable for errors
or omissions with respect to the materials. The only warranties for SAP
SE or SAP affiliate company products and services are those that are set
forth in the express warranty statements accompanying such products
and services, if any. Nothing herein should be construed as constituting
an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue


any course of business outlined in this document or any related
presentation, or to develop or release any functionality mentioned
therein. This document, or any related presentation, and SAP SE’s or its
affiliated companies’ strategy and possible future developments,
products, and/or platform directions and functionality are all subject to
change and may be changed by SAP SE or its affiliated companies at any
time for any reason without notice. The information in this document is
not a commitment, promise, or legal obligation to deliver any material, code,
or functionality. All forward-looking statements are subject to
various risks and uncertainties that could cause actual results to differ
materially from expectations. Readers are cautioned not to place undue
reliance on these forward-looking statements, which
speak only as of their dates, and they should not be relied upon in
making purchasing decisions.

You might also like