You are on page 1of 144

PLANNING AND DESIGN | PUBLIC

SAP Logistics Business Network, global track and trace option


Document Version: LBN 2.0 – 2019-12-24

Creating and Deploying GTT Models


Using the MM App (Global Track and Trace Plugin for SAP Web IDE)
© 2019 SAP SE or an SAP affiliate company. All rights reserved.

THE BEST RUN


Content

1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1 About this Document. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Target Audience. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Creating and Deploying Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5


2.1 Prerequisites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Simple and Standard Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Create a GTT Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
2.4 Change the Project Settings (Optional). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5 Design-time Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Model a Tracked Process or Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Set up Services and UI Annotations (Standard Mode Only). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6 Multi-Language Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Use of Internationalization Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Modify a Model for Multi-Language Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Enable Multi-Language Support for an Old Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.7 Deploy a GTT Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.8 Notes on Changing a Deployed Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.9 Troubleshooting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3 Structure of Track and Trace Metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18


3.1 Basic Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Representation as Entity Relationship Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4 GTT Metadata Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4 Modeling Language Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23


4.1 Introduction to CDS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Architecture and Design Principles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
CDS Definition Language (CDL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Language Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.2 GTT Metadata Model with CDS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Overall Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Core Model Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
UI Annotations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Application Model Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

5 Upgrade Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Creating and Deploying GTT Models


2 PUBLIC Content
5.1 Upgrading GTT Models from Core Model Version 10.0.0 to 11.0.0. . . . . . . . . . . . . . . . . . . . . . . . . . 139
5.2 Upgrading GTT Models from Core Model Version 9.0.0 to 10.0.0. . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Creating and Deploying GTT Models


Content PUBLIC 3
1 Introduction

Before an end user can track and trace with the global track and trace option for SAP Logistics Business
Network, a GTT metadata model must be created to define the metadata of tracked processes or objects. This
can be done in the Metadata Modeling app (MM app), a plugin of SAP Web IDE, also known as the Global Track
and Trace plugin for SAP Web IDE.

You can use the MM app to create GTT metadata models and save them either in the temporary workspace or
in a GIT repository they define. After finishing the metadata definition, you deploy and activate the model in the
runtime repository. This is a microservice on the target runtime environment and provides data access APIs to
other components or microservices.

Each GTT metadata model is in a specific GTT project associated with a specific namespace. One namespace
belongs to one specific user and may have multiple versions. GTT models are defined in the format of CDS
Definition Language.

1.1 About this Document

 Recommendation

Before you start working through this document, ensure that you have the most recent version of this
document that is available from the SAP Help Portal at:

help.sap.com/gtt

This document guides you through creating and deploying user-defined GTT metadata models. It also details
the structure of GTT metadata and includes a CDS modeling language guide for your reference. The upgrade
guide at the end provides instructions and tips for upgrading existing GTT models to a new version.

1.2 Target Audience

Role Activity

Modeling Expert or Solution Administrator Create, maintain, deploy, and activate GTT metadata mod­
els.

Creating and Deploying GTT Models


4 PUBLIC Introduction
2 Creating and Deploying Models

The MM app provides you with an easy-to-use development interface to model tracked processes or objects.
The tasks are as follows:

● Create a GTT Project with a Wizard


A wizard guides you through the process of creating a GTT project.
● Change the Project Settings
You can change the GTT project settings in the project settings panel.
● Model Tracked Process or Object
In a GTT project, model tracked process or object in CDS format.
● Set up Services and UI Annotations
Working in a GTT project, you can set up services and UI annotations for tracking processes or objects.
● Deploy a GTT Project
After the modeling, deploy the GTT model to the runtime repository.

2.1 Prerequisites

Ensure that you have selected the Global Track and Trace plugin on the Features page. This is a one-time
activity.

1. Log in to the SAP Web IDE for Full-Stack Development application.


2. In the Tools menu, choose Preferences.
3. Select Features on the left pane.
4. In the Features view that displays on the right pane, switch on Global Track and Trace and choose Save.
5. Reload the SAP Web IDE Full-Stack application by refreshing the browser.

 Note

If you cannot log on to SAP Web IDE for Full-Stack Development application, ask your onboarding assistant
or system administrator for help. For details, see Troubleshooting [page 16].

2.2 Simple and Standard Modes

You must create a GTT model in either simple mode or standard mode, the default.

 Recommendation

Simple mode is useful for getting started and for initial testing.

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 5
But we strongly recommend standard mode for all production usage. Standard mode is fully featured and
allows considerably more flexibility in modeling.

The major differences between the two modes are explained in the following table:

Simple Mode Standard Mode

Simplifies modeling by defining your metadata model with Defines your metadata model in detail with full model and UI
model information and basic UI layout information layout information

Only uses one model file Uses four model files

Does not support some functionality, for example it only Supports full functionality and is always where new function­
supports showing a map view on a process’ details page ality is introduced

 Note

You can convert a model from simple to standard mode, but it is complicated and must be done manually.

For more information on the:

● application model and the differences between simple and standard modes, see: Overall Structure [page
42]
● model files and the differences between simple and standard modes, see: Application Model Details [page
112]

2.3 Create a GTT Project

Context

A wizard guides you through the process of creating a GTT project.

Procedure

1. Choose File New Project from Template . The Template Selection page appears.
2. In the Category list, choose Global Track and Trace and then choose Next.
3. Type a Project Name for your GTT project.
4. Choose Next. The Project Customization page appears.
5. Choose Standard or Simple mode.
6. Type Namespace and Version. You can add .<your_input> after the default namespace to make it
unique.

Creating and Deploying GTT Models


6 PUBLIC Creating and Deploying Models
7. Choose Template and type Description. Then choose Next or Finish.

 Note

Here a template means a sample implementation pre-defined in a group of sample files. You can also
choose None if you want to model a tracked process or object without using a template. In that case,
you can also specify a dependency metadata model in the Dependency box. Then your new metadata
model can use the entities and attributes defined in the dependency metadata model.

The EPCIS Model option is automatically disabled if you choose a template that uses a non-EPCIS
model. The option is automatically enabled if you choose the EPCIS template for object tracking. It is
only selectable when you choose None for Template.

8. If you choose Next in the previous step, choose Finish.

Results

A GTT project is created. Below shows an example of a standard mode project with a delivery template.

2.4 Change the Project Settings (Optional)

Context

GTT project settings are the information gathered from the project customization step when the project was
created. These settings can be changed.

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 7
Procedure

1. Choose Development ( ) in the left-hand pane and navigate to the Workspace folder.
2. Select the folder for your GTT project.

3. In the context menu of the folder, choose Project Project Settings . The project settings pane
appears.
4. In the project settings pane, choose Global Track and Trace.
5. Modify your GTT project settings information on the right-hand pane.

6. Choose Save .

2.5 Design-time Modeling

GTT metadata models include tracked processes or objects. You can define models using the CDS Definition
Language.

2.5.1 Model a Tracked Process or Object

Working in a GTT project of simple or standard mode, you can model a tracked process or object in CDS
format.

 Note

For information on the structure of GTT metadata and the CDS modeling language, see the "Structure of
Track and Trace Metadata" and "Modeling Language Guide" sections in this document.

Procedure

1. Choose Development ( ) in the left pane and navigate to the Workspace folder.
2. Under Workspace your project model , do one of the following:
○ If your GTT project is created with the Delivery, Shipment, Purchase Order or EPCIS template, open the
DeliveryModel.cds, ShipmentModel.cds, PurchaseOrderModel.cds or EPCISModel.cds file and modify
the template.
○ If your GTT project is created without a template, open the <project_name>Model.cds file and model
the tracked process or object in the editor in CDS format.

Creating and Deploying GTT Models


8 PUBLIC Creating and Deploying Models
 Note

It is recommended that you do not change the file name of <project_name>Model.cds. If you do want
to change the file name, you can only change the <project_name> part, not the Model.cds part,
otherwise the deployment of the model fails.

3. In the File menu, choose Save .

Related Information

Structure of Track and Trace Metadata [page 18]


Modeling Language Guide [page 23]

2.5.2 Set up Services and UI Annotations (Standard Mode


Only)

Working in a standard-mode GTT project, you can set up services and UI annotations for tracking processes or
objects.

 Note

For details on how to define services or UI annotations in CDS Definition Language, see the "Modeling
Language Guide" section in this document.

Procedure

1. Choose Development ( ) in the left pane and navigate to the Workspace folder.
2. To set up services, for example, configure the fields to be exposed for display in the GTT app, do the
following:
1. Under Workspace your project service , open the <project_name>Service.cds file.
2. Modify the file in the editor in CDS format.

 Note

It is recommended that you do not change the file name of <project_name>Service.cds. If you do
want to change the file name, you can only change the <project_name> part, not the Service.cds
part, otherwise the deployment of the model fails.

3. In the File menu, choose Save .

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 9
3. To set up UI annotations, do the following:
1. Under Workspace your project service , open the <project_name>UI.cds file.
2. Modify the file in the editor in CDS format.

 Note

It is recommended that you do not change the file name of <project_name>UI.cds. If you do want
to change the file name, you can only change the <project_name> part, not the UI.cds part,
otherwise the deployment of the model fails.

3. In the File menu, choose Save .

Related Information

Modeling Language Guide [page 23]

2.6 Multi-Language Support

The global track and trace option for SAP Logistics Business Network has a user interface that supports 7
languages: English (default), German, Simplified Chinese, Spanish, Brazilian Portuguese, French and Russian,
according to the language setting in the user's web browser.

Some UI text displayed in the GTT and GMM apps comes from related items defined in a GTT metadata model.
For example, process name and description displayed in these apps are read from the corresponding settings
in the GTT Model. Field names and table column headings are copied from related UI annotations. If you want
such texts to display in a language other than English in the apps, you need to modify your GTT model at design
time to support that language.

 Note

You cannot support a language other than the languages mentioned above.

2.6.1 Use of Internationalization Files

The MM app uses internationalization files (i18n files) to realize multi-language support for GTT models.

Creating and Deploying GTT Models


10 PUBLIC Creating and Deploying Models
The default i18n.properties file is used to provide the UI text for the English version of your GTT metadata
models. Each of the other supported languages has its own i18n file, as shown in the following table:

File Name Supported Language

i18n.properties (default) English (default)

i18n_de.properties German

i18n_es.properties Spanish

i18n_fr.properties French

i18n_pt_BR.properties Brazilian Portuguese

i18n_ru.properties Russian

i18n_zh_CN.properties Simplified Chinese

 Note

The global track and trace option for SAP Logistics Business Network only supports the above languages. If
you add an i18n file for another language, it won't be supported.

All the i18n files contain key/value sets. As explained in the following, the default values are already translated
in the i18n files of the supported languages. If you wish to provide your own UI text for any of the supported
languages, you may overwrite the values for that language in the specific i18n file for that language.

 Note

You must never change the keys. They must remain in English.

The following types of key/value sets are available in an i18n file:

● Process name. The value is read from your setting in the project-creation wizard. For example:

com.sap.gtt.core.Process_Name=Outbound Delivery

If you use the default process name suggested by the project-creation wizard, the value is in English in the
default i18n file, and already translated into the appropriate languages in the other i18n files.
If you have changed the default process name during project creation, the value is in English in all language
versions of the i18 files. You need to manually translate the value in the non-English i18n files. For example,
in i18n_de.properties, change the value to German.
● Process description. The value is read from your setting in the project-creation wizard. For example:

com.sap.gtt.core.Process_Description=Outbound Delivery in SAP ERP

If you use the default process description suggested by the project-creation wizard, the value is in English
in the default i18n file, and already translated into specific languages in the other i18n files.
If you have changed the default process description during project creation, the value is in English in all
language versions of the i18 files. You need to manually translate the value in the non-English i18n files. For
example, in i18n_de.properties, change the value to German.
● All the UI annotations are predefined in the template model that your GTT project uses.
To support multiple languages, a template model includes UI annotations as i18n keys instead of exact
values. The exact values are maintained in i18n files. In each i18n file, the values are already in the specific
language that the i18n file supports. You do not need to manually maintain them.

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 11
For example, if a template model includes 2 UI annotations as follows:

entity ShippingStatus {
key Code: String(10) @title:'{@i18n>Status_Code}' @Common:{ Text:Text,
TextArrangement:#TextOnly };
Text : String(50) @title:'{@i18n>Status_Name}';
};

Then the default i18n file includes the following key/value sets.

Status_Code=Status Code
Status_Name=Status Name

In a non-English i18n file, the values are in the specific language that the file supports.
Thus, when these 2 UI annotations are displayed as field labels in the GTT app, the values are displayed in a
supported language if the browser language is set to that language.
Sometimes you want to add UI annotations to your GTT model apart from the predefined ones in the
template model. In that case, you need to add the annotations as i18n keys and then add the key/value sets
to the i18n files.
If you didn't choose any template when creating your GTT project, the i18n files do not contain any UI
annotation key/value sets. To support multiple languages, you need to define UI annotations using i18n
keys in your GTT model, and then add related key/value sets to the i18n files.

2.6.2 Modify a Model for Multi-Language Support

Context

Some items defined in a GTT metadata model, such as process name, description, and UI annotations, are
displayed as user interface text in apps like GTT and GMM.

If you want such text to display in a language other than English in the apps, you need to modify your model in
the MM app.

Procedure

1. Choose Development ( ) in the left pane and navigate to the Workspace folder.

In your workspace, your GTT project folder includes a model folder that contains one or more model files
and an i18n folder that contains five i18n files.
2. Modify your model as follows:
○ If you have set a process name or description other than the default during project creation, translate
the value for com.sap.gtt.core.Process_Name or com.sap.gtt.core.Process_Description,
respectively, in the non-English i18n files for the languages that you want to support. You don't need to
update the default i18n.properties file.

Creating and Deploying GTT Models


12 PUBLIC Creating and Deploying Models
○ If you want to add a UI annotation to your GTT model other than the predefined ones in the template
model, add it as i18n keys in the format of {@i18n><key_name>, where <key_name> must start with
a letter and only contains letters, digits, and underscores. For example:

plantNumber : String(4) @title:'{@i18n>Plant_Num}';

Then add the key and its value to both the default English-version i18n file and the non-English i18n
files for the languages that you want to support. The following is the example in the English-version
i18n file:

Plant_Num=Plant Number

○ If you didn't use any template model for your GTT project, add your UI annotations as i18n keys in the
format of {@i18n><key_name>, where <key_name> must start with a letter and only contains letters,
digits, and underscores. Then add these keys and their values to both the default English-version i18n
file and the non-English i18n files for the languages that you want to support.
○ If you used the default process name and description during project creation, and don't want to add
any UI annotations to your GTT model, do nothing.

Results

When you track and trace processes or objects based on the deployed GTT model, the process name, process
description, and related UI labels are displayed in a supported language according to the language setting of
your web browser.

2.6.3 Enable Multi-Language Support for an Old Model

Context

Some items defined in a GTT metadata model, such as process name, description, and UI annotations, are
displayed as user interface text in apps like GTT and GMM.

If you want such text to display in a language other than English in the apps, but your GTT project was created
prior to the 2018.09a delivery, you need to modify and redeploy your model in the MM app.

Procedure

1. Choose Development ( ) in the left pane and navigate to the Workspace folder.
2. Select the folder for your GTT project.

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 13
3. In the context menu of the folder, choose Edit Enable Localization .
4. Clear the option Add namespace as part of the key, and choose Continue.

After the enablement, the UI annotations in your model file were changed from using exact values to using
i18n keys in the format of {@i18n><key_name>.

Meanwhile, a new folder, i18n, appears in your project folder with a default English-version
i18n.properties file in it. The file contains the key/value sets for the process name and description you
have set, and the i18n key names for all the UI annotations included in your GTT model.

5. In the context menu of the i18n folder, choose New File to create non-English i18n files for the
languages that you want to support.

The file name conventions are as follows:

File Name Language Support

i18n_de.properties German

i18n_es.properties Spanish

i18n_fr.properties French

i18n_pt_BR.properties Brazilian Portuguese

i18n_ru.properties Russian

i18n_zh_CN.properties Simplified Chinese

 Note

The global track and trace option for SAP Logistics Business Network only supports English and the
above languages. If you add an i18n file for another language, it won't be supported.

6. In each non-English i18n file, copy and paste all the key/value sets from the default i18n.properties file,
translate the values to the specific language that the file supports, and then save the file.
7. Re-deploy the GTT project.

Results

The modified model now supports multiple languages. When you track and trace processes or objects based
on the model, the process name, process description, and related UI labels are displayed in a supported
language according to the language setting of your web browser.

Creating and Deploying GTT Models


14 PUBLIC Creating and Deploying Models
2.7 Deploy a GTT Project

Context

After the modeling, you can deploy your GTT model to the runtime repository.

Procedure

1. Choose Development ( ) in the left pane and navigate to the Workspace folder.
2. Select the folder for your GTT project.

3. In the context menu of the folder, choose Deploy Activate GTT Model .

This starts the model deployment process. Messages pop up in the upper-right corner of the window,

showing the step-by-step deployment progress. You can also choose (Console) on the right edge of the
window to open the Console to view the messages. When the deployment completes, the status of the
deployed model becomes Active.

 Note

If you only want to compile your metadata model and may deploy it at a later time, choose Deploy
Compile GTT Model .

You can also preview a compiled or deployed metadata model by choosing Deploy Preview GTT
Model . The preview shows mock data only, not the real data.

 Note

If you cannot compile or deploy your GTT model, refer to Troubleshooting [page 16].

2.8 Notes on Changing a Deployed Model

After a GTT metadata model is deployed to the runtime repository, you can make limited changes to the model
and deploy it again.

The following lists the changes that are allowed and forbidden for a deployed metadata model.

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 15
Allowed Changes

The following changes are allowed for a deployed metadata model. Making these changes does not require the
creation of a new version of the namespace. Allowed changes do not lead to any data conversion.

● Adding fields
Adding fields to an entity is allowed if there is a canonic default value for all instances not being created
with this field. For integer such a value would be 0, for associations NULL, and for strings the empty string.
● Increasing length and precision
Increasing the length of a string and the precision of a decimal are allowed because the original type is not
changed.
● Changing UI annotations
UI changes are allowed because UI is rendered during the runtime following the Fiori Elements approach.
● Changing enum values
Similar to UI annotations, enum defines a set of possible values with symbolic names. Changing enum
values does not lead to any data conversion.

Forbidden Changes

All changes that are not included in the Allowed Changes list above are forbidden for a deployed metadata
model. Such changes may lead to data loss or inconsistencies.

Some examples of forbidden changes are as follows:

● Deleting entities or views/projections


Once an entity or view is being released, it must not be deleted. The deletion leads to inconsistent models
and data loss on consumer side.
● Deleting fields from an entity
This leads to data loss and must be prevented.
● Demoting a primary key field to functional field
This changes the structure of the object and access patterns, storages and uniqueness constraints.
● Changing field type and length with value narrowing
Changing the type or length of a field may narrow the allowed values in the field and lead to data loss or
inconsistencies. For example, if you change a field type from string to integer, the previously allowed value
“ABC” becomes invalid. For associations, the associated type must not be changed.

2.9 Troubleshooting

● Issue: I tried to log on to SAP Web IDE Full-Stack Development, but got an error message "You are not
authorized to access SAP Web IDE from this account."
Workaround: Ask your onboarding administrator or system administrator to grant you the required
authorization. To use the Global Track and Trace plugin for SAP Web IDE, you need either the Solution
Administrator or the Modeling Expert role in GTT solution.
● Issue: When compiling a GTT model in SAP Web IDE Full-Stack Development, I got an error message
"Insufficient scope for this resource."

Creating and Deploying GTT Models


16 PUBLIC Creating and Deploying Models
Workaround: If your GTT onboarding settings are correct, this may result from a cache clearing issue in the
destination service of your Neo subaccount. Please contact your onboarding administrator or system
administrator to try the following:
1. In the SAP Cloud Platform Cockpit, go to your Neo subaccount for the global track and trace option.
2. In the menu pane, choose Connectivity Destination .
3. Rename your Neo Web IDE subaccount destination (e.g. gttmetadata), save the setting, and then
name it back to the original name. This clears the cache in the destination service.
4. In SAP Web IDE Full-Stack Development, try compiling your GTT model again.

Creating and Deploying GTT Models


Creating and Deploying Models PUBLIC 17
3 Structure of Track and Trace Metadata

The global track and trace option for SAP Logistics Business Network tracks processes or objects that are
influenced by business events. All tracked processes, objects, and business events have a common core
behavior and share a common set of basic attributes.

Therefore, the overall GTT solution consists of a generic track and trace core engine and applications
leveraging the core engine, as follows:

● The core engine provides generic functionality to track processes or objects, to handle business events and
provides the modeling environment described in this document.
● GTT applications enrich the generic functionality by adding domain specific semantics in terms of data,
behavior, and user experience using SAP Web IDE.

Both the core engine’s data model and the application’s data model are described by metadata as a classical
entity relationship model with various enhancements like annotations and extension concepts.

3.1 Basic Definitions

Track and trace applications deal with the following central objects and terms:

● Tracked Process
A tracked process comprises the following:
○ Involved parties acting in or being affected by the process;
○ Multiple tracked objects;
○ A set of planned events that are expected to happen within the tracked process. The planned events
are also named as milestones.

 Note

“Milestones” is the term used in SAP ERP applications like SAP Event Management.

○ A set of events that actually happened against the process. This could be a realization of a planned
event or also an unplanned event
● Events
Events can be planned events or unplanned events that might occur against a process. When an event
happens, an actual event needs to be matched against a planned event of that process or get an unplanned
event in case no suitable planned event can be identified. Otherwise if no suitable planned event can be
identified it becomes an unplanned event.
○ Planned Event
○ Has a fixed semantic.
○ Has a planned date and time (with time zone) + tolerance window, planned location, and other
planned data.

Creating and Deploying GTT Models


18 PUBLIC Structure of Track and Trace Metadata
Examples:
○ goods issued (planned date 2016-07-06; planned location gate 1)
○ goods received (planned date 2016-07-07; planned location packstation 801)
● Unplanned Event
○ Has a fixed semantic as well
○ Is not planned, but can be foreseen that it occurs with a certain likelihood, but cannot be planned thus
has no planned data
○ Examples include: delay in delivery, damage of goods
○ Or is a piece of information at an arbitrary point in time, such as the current position and temperature
of a container
● Actual Event
○ Is an event that actually happened
○ Is either matched against a planned event of a process and complements planned data with actual
data or becomes an unplanned event of the process
○ Triggers changes of attributes of a tracked process or object
○ Updated data depends on message payload or specific unplanned event types for specific updates
● Event Message
Event message is the transmitter that reports the occurrence of an actual event. An event message
contains the actual data of an event and the information of the event to which a tracked process or object
is related.
An event message may trigger the update and creation of tracked processes or objects.

3.2 Example

To illustrate the structure of metadata and modeling language, an outbound delivery process is provided as an
example.

Example: Outbound Delivery Process

An outbound delivery process within a business network comprises at least three involved parties: A supplier
as sender, a carrier and a customer as receivers of the delivery. The customer orders goods from the supplier.
The supplier starts a delivery process and hands over the goods to the carrier. The carrier delivers the goods to
the customer and the customer confirms the completed delivery.

The example includes one process and at least the following three events:

● Picking completed
● Goods issued
● Proof of delivery

These events describe the planned process flow and therefore are called planned events, but there might be
unplanned events that we may foresee in the delivery process tracking. For example, the truck of the carrier
has an accident which leads to loss of goods. The supplier has to react to that and send the goods again as the
customer requires it. Financial compensation for damaged goods and the delay is another process.

Creating and Deploying GTT Models


Structure of Track and Trace Metadata PUBLIC 19
3.3 Representation as Entity Relationship Model

The core engine knows these central terms and objects from a generic perspective. In terms of an entity
relationship model the core engine provides entities for generic abstract tracked processes and generic events.
These generic entities contain data that is common to all applications and used within the core engine. The
core engine does not provide any definition of event messages, as the message is only the carrier for the event
itself, hence the message content is derived from the event that is reported.

Generic Tracked Process

A generic tracked process consists of the following:

● A universal unique ID that is issued internally as a technical key


● A description of the process, which is some free text to describe and identify the tracked process
● A process type that technically distinguishes the different tracked processes defined by applications
● A set of tracking IDs that externally identify a tracked process
● A set of events that are planned with the tracked process and/or have already occurred, combined with a
set of unplanned events

Generic Event

A generic event contains the following:

● A universal unique ID that is issued internally as a technical key


● An event code that allows you to distinguish between different event types and the data assigned to these
event types
● A status of an event, such as “delayed” or “open”
● A location where the event happened
● In case of a planned event, a date by when the event is expected to happen or expected to be reported
● Actual data, including when the event actually happened and when the event was reported

The core engine offers generic functionality, such as overdue event monitoring and unplanned events alerting,
by leveraging these generic set of attributes.

Application Enhancements

Track and trace applications enhance the generic parts with their domain specifics. This could be any simple
attributes, structures or even additional entities in the sense of ERM (Entity-Relationship Modeling). This
enhancement can be considered as an “is a” relationship between the application specific process/event and
the generic process/event.

Creating and Deploying GTT Models


20 PUBLIC Structure of Track and Trace Metadata
Example:

In our outbound delivery example, a delivery process is a tracked process, whereas the tracked process can be
a delivery.

Customer Enhancements

Sometimes pre-configured applications delivered by SAP do not cover all requirements from customers. Hence
customers need possibility to enhance the delivered applications. The entity relationship model allows multiple
levels of extension to fulfill customer requirement.

Entity Relationship Model

The following figure shows the structure of the entity relationship model in UML notification.

3.4 GTT Metadata Model

As described in previous topics, tracked processes and events are entities in terms of ERM (Entity-Relationship
Modeling). Entities are described by annotations and properties: Properties model the content of events and
tracked processes, whereas annotations describe use case specific static behavior like UI texts. Both are either
scalar values, complex structures or (deep) table types. The latter would be a separate weak entity in classical
ERM. A GTT metadata model describes how tracked processes and events are being modeled so that the core
engine and applications can leverage the definitions.

The following figure shows the GTT metadata model and its relation to the ERM model.

Creating and Deploying GTT Models


Structure of Track and Trace Metadata PUBLIC 21
When you start a new GTT project within SAP Web IDE, the generic definitions for tracked processes and
events are immediately available. and can be enhanced with application specifics. These generic definitions
must not be changed, otherwise the core engine doesn't work reliably. To avoid unintentional modifications to
the generic part, the core engine definitions are not editable for users. The application specific definitions can
be added in new files that are combined with the imported core engine definitions.

Creating and Deploying GTT Models


22 PUBLIC Structure of Track and Trace Metadata
4 Modeling Language Guide

The language used for GTT metadata modeling is the CDS Definition Language (CDL). It is based on the Core
Data Services (CDS) concept and format. CDS follows the principles of entity relationship models with
annotations and can easily be interpreted by compilers and thus transferred in other formats following ERM
principles, such as the metadata document describing OData services.

Before describing the usage of CDS for the global track and trace option for SAP Logistics Business Network,
we briefly give a general overview of CDS and describe those portions of CDS that are currently used for the
track and trace solutions.

4.1 Introduction to CDS

Data models represented in CDS Definition Language (CDL) are written in a more or less human readable
language, compiled and transferred into other machine readable formats like JSON or XML. This makes CDS
an optimal format to share and interpret models with minimal footprint and dependencies, independent of
source or target environments.

4.1.1 Architecture and Design Principles

This section outlines the key building blocks of a conceptual reference architecture for CDS implementations
as well as the key design principles of CDS.

4.1.1.1 Key Building Blocks

The following figure shows the key building blocks for CDS implementations.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 23
Compiler

The compiler accepts metadata model definitions in source format (i.e. CDL) and processes them in these
(logical) steps:

Step Description You can now...

Compile The compiler frontend compiles sour­ persist them, share/import them to
ces into an internal format. This internal other systems, or process them in 'diy'
format can be represented in CDM mode.
(Common Data Model).

Import The definitions from compiled models browse and introspect definitions, re­
are written to the catalog, containing solve annotations, add extensions, etc.
annotations to the annotation service.

Activate The compiler backend generates run­ run queries to read/write data using the
time artifacts for the given definitions, usual CRUD operations.
i.e. SQL tables and views.

Implementations are not required to offer these steps individually. If they do, this allows you to deal with
models transiently, for example, to dynamically create local temporary models at runtime.

Catalog

The catalog stores compiled models, i.e. the defined types and entities as well as extensions thereof. Note that
extensions are not applied by the catalog. They are just stored as is.

Introspection APIs – Each CDS implementation is expected to provide a REST-based introspection API that
allows you to browse models, filtered by certain metadata, and return complete model excerpts in CDM
(Common Data Model) format. In addition, implementations may offer other forms to introspect models, for
example, through the like of SQL catalog views.

Model Import APIs – CDS implementations should provide a REST-based API to import models in CDM
format. This allows you to easily share models between CDS implementations in different stacks within
heterogeneous landscapes. As opposed to the source/compiler-based way to add models, only essential
checks are required.

Runtime

The runtime executes queries based on activated models, i.e. generated runtime artifacts. In case of the
standard implementations, these are SQL tables and views. Upon generation, potential extensions are applied
to the base definitions' runtime artifacts.

Given the standard SQL persistence, CDS needs only a minimal runtime on top of SQL, if any at all. For
example, queries can be pre-compiled and no additional runtime is required.

Creating and Deploying GTT Models


24 PUBLIC Modeling Language Guide
Annotations

Annotations are not a core feature of CDS and should be managed separately from the types and entities in the
catalog. On one hand, this is because activation through the catalog/SQL is likely an expensive operation as
compared with adding annotations which are not evaluated at all. On the other hand, annotations are
independent from the actual data models (and vice versa). A separate annotation service can allow you to
annotate anything which can be identified by unique names.

4.1.1.2 Key Design Principles

1. CDS Is Not an Abstraction!

CDS does not abstract from the underlying database features or “shield” developers from SQL, which is in
contrast to most persistence frameworks, especially object-relational mappers. We do want developers to use
SQL and hence leverage its strengths instead of seeking refuge in abstractions. This applies to models as well
as runtime.

The canonic mapping to SQL is part of the specification and applies common practices: Generated tables/
views are as close as possible to how one would have done it manually.

Everything being defined through CDS can always be consumed through native SQL! (i.e. including any vendor-
specific extensions)

2. Zero Runtime Overhead

CDS does not introduce a data access layer, neither with respect to how queries are expressed, nor to how
results are represented. Queries are expressed in SQL, to which CDS adds only careful extensions, which can
be unfolded to plain SQL in pre-compilers and/or implemented natively in SQL engines.

3. Zero Lock-in

CDS does not assume a certain environment or depend on any platform technology or programming language.
You can use it with the technology stacks you choose. We thereby want to promote interoperability and reduce
fragmentation in landscapes with increasingly heterogeneous technology stacks.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 25
4. Non-Intrusive Use

CDS does not impose a programming model or force you into an all-or-nothing game. Its features are largely
independent from each other and can be used individually and easily be combined with other technologies. For
example, you can import CDS data models into a JPA-based application, while not using CDS QL/SQL,
annotations or the other features at all.

5. Applying Proven Standards

CDS does not invent anything new or enforce new paradigms. It is primarily based on and borrows from proven
standards and methods like SQL and entity-relationship modeling. The interesting thing is that this even more
allows CDS to be combined with technologies that do invent new paradigms, definitely more than if CDS came
with its own.

4.1.2 CDS Definition Language (CDL)

The CDS Definition Language allows you to define conceptual data models in the form of Entity-Relationship
Models.

A typical example might look like this:

entity Orders {
key ID : Integer;
product : Association to Products;
price : Amount;
tax : Decimal(2,2);
total = price.value * (1+tax);
}
type Amount {
value : Decimal(10,3);
currency : Currency;
}
entity Currencies {
key code : String(3);
name : String(44);
}
type Currency : Association to Currencies;
entity Products as SELECT from Material mixin {
campaign : Association to Campaigns on category = campaign.pcat
} into {
*, unitPrice * (1 - campaign.discount) as price
}

Overview

We use a derivate of Extended Backus–Naur form (EBNF) for syntax definitions (see Syntax Notation for more
information).

Creating and Deploying GTT Models


26 PUBLIC Modeling Language Guide
CDS data models consist of a number of definitions which can be one of the following kinds:

● Entity Definitions – representing queryable sets of data (including views)


● Type Definitions – for reuse in elements of entities
● Aspects/Extensions – applied to entities or types as mixins
● Annotation Vocabularies – to declare and validate typed annotations

Entities are structured types with named and typed elements. The type of elements can in turn be the
following:

● Scalar – derived from one of the Built-in Types


● Structured – for example, Orders:price in the example above
● Associations – capturing relationships to other entities

In total, these concepts constitute the CDS Type System as depicted below:

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 27
Names and Contexts

Each top-level definition is globally identified by a unique absolute name. To avoid always typing fully-qualified
names, the following can be used:

● context a.b.c {...} prefixes names of nested definitions with a.b.c.


● context a.b.c; directive at the beginning applied to the whole file
● using x.y.z as z declares z as a shorthand alias for x.y.z.

For example:

context foo.bar; //> like context foo.bar {...} for all below
using some.other.context as soc;
using some.other.Entity as soe;
entity Foo { ... } //> foo.bar.Foo { ... }
type Zoo : soc.Zoe; //> foo.bar.Zoo : some.other.context.Zoe
context sue {
entity Car as //> foo.bar.sue.Car as
SELECT from soe; //> SELECT from some.other.Entity
}

Name Resolution

(Relative) names are always looked up in the inner-most lexical {...} scope first and then up to the file scope,
but not beyond. This combined with the restriction, that using does not support a using x.y.* mode,
guarantees, that bindings are not accidentally impacted through 'remote' changes/additions in other modules.

Some examples:

context foo;
type Foo : String;
type Boo : Integer;
context bar {
type X : Foo; //> resolves to foo.bar.Foo (below)
type Y : :Foo; //> resolves to foo.Foo (above)
type Z : Boo; //> resolves to foo.Boo (above)
entity Foo { ... }
}

The colon-prefix in :Foo is an operator that forces name resolution to start in the next outer scope.

Definitions

Definitions are expressed through statements like define entity Foo <details>, in which the leading keyword
define is the default and can be omitted.

The specified name is relative in the current context and can itself be qualified, for example:

context foo.bar;
context boo {
entity full.Moon {...} //> foo.bar.boo.full.Moon
}

Creating and Deploying GTT Models


28 PUBLIC Modeling Language Guide
See Entity Definitions for further details.

Expressions

In general, CDL inherits expressions from SQL of underlying databases. That is, depending on the occurrence,
you can use all functions and operators your database supports.

In addition, all implementations of CDS are expected to support the following operators (in order from highest
to lowest precedence):

NOT
||
* /
+ -
< <= > >=
= == != <> IS IS NOT IN LIKE
AND
OR

Lexical Conventions

Keywords and Identifiers

CDS is case-insensitive re keywords and (unquoted) identifiers, i.e. FOO, Foo and foo would all refer to the same
thing.

Literals

CDL supports the following literals:

Strings as in SQL, i.e. in single(!) quotes 'a String'

Numbers as in SQL -7.99e3

Arrays as in JavaScript [ 11, 'car']

Records as in JavaScript { foo:11, bar:'car'}

Enumeration symbols prefixed with # #asc, #desc

Global constants null, true, false

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 29
Comments

CDL supports C-style comments, as well as SQL-style:

/*...*/ block comment (can span multiple lines)

//... line-end comment

--... line-end comment

Punctuation

The following elementary symbols in CDL are used as in, for example, JavaScript:

● Curly braces { ... } enclose record-like structures, for example, an entity’s elements.
● Round parenthesis ( ... ) enclose lists of parameters/arguments.
● Square brackets [ ... ] are used for array literals.
● Colons : precede type specifications, such as in element definitions.
● Semicolons ; delimit definitions.

Colons before and semicolons after {...} blocks are optional. Moreover, colons directly before the = in
calculated fields are optional.

Syntax Notation

4.1.3 Language Elements

The following sections describe CDS language elements.

Creating and Deploying GTT Models


30 PUBLIC Modeling Language Guide
4.1.3.1 Built-In Types

You can use the following built-in types in your definitions:

● The native SQL types of your underlying database (for example, varchar, ...)
● The CDS built-in types listed below

Constructor Description

String(n) Variable-length unicode string with a maximum length of


5000

Binary(n) Variable-length binary data with a maximum length of 5000

Decimal(p,s) Number with fixed precision in range 1 to 34 and a scale of 0


to p

Integer Alias for integer32; may be redirected to a larger integer in


the future

Integer32 Signed 32-bit integer with a value range of -2^31 to 2^31-1.

Integer64 Signed 64-bit integer with a value range of -2^63 to 2^63-1.

Date Local date with values ranging from Jan 1, 0001 through Dec
31, 9999

Time Time values with second precision and values ranging from
00:00 to 23:59:59

DateTime UTC date and time with seconds precision and values rang­
ing from Jan 1, 0001 00:00:01 through Dec 31, 9999
23:59:59

Timestamp UTC date and time with micro seconds precision and values
ranging from January 1, 0001 00:00:00 through December
31, 9999 23:59:59.9999999

4.1.3.2 Entity Definitions

Entities are the primary subjects of your metadata model, representing queryable sets of data.

Examples:

context cds.xmples;
type Currency : Association to Currencies;
entity Payslip {
key ID : Integer;
employee : Association to Employees;
netAmount : {

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 31
value : Decimal;
currency : Currency;
}
taxrate : Decimal(3,2) default 0.19;
grossAmount : type of netAmount = {
value = (1.0 + taxrate) * netAmount.value,
currency = netAmount.currency
}
kind : String(7) enum { regular; bonus; }
}
entity org.Employees { name: String, ... }

The following is the relevant excerpt from the Definition Language syntax:

All entities have a signature of a structured type with named and typed elements. They can be defined as
follows:

● By declaring their type structure explicitly, and/or


● As projections, that is views on underlying entities

One or more elements can be qualified with key to specify an entity's primary key.

Entity Types = Structured Types

Entities—and structured types in general—contain zero or more element definitions enclosed in {...}. Each of
which can start with the prepended keyword element, but that is optional.

entity Payslip { //> an entity


key ID : Integer;
employee : Association to Employees;
netAmount : { //> an inline structured type
value : Decimal;
currency : Currency;
}
taxrate : Decimal(3,2) default 0.19;
grossAmount : type of netAmount = (1.0 + taxrate) * netAmount;
kind : String(7) enum { regular; bonus; }
}

In general, an element definition always has the following simplified form:

[modifiers] name : Type Declaration [tail clauses]

Creating and Deploying GTT Models


32 PUBLIC Modeling Language Guide
with the Type Declaration as described below, and modifiers and tail clauses as follows:

Modifier Marks an element as...

key (part of) the entity’s primary key

const always having the specified constant value

masked hidden, i.e. being ignored by select *

virtual a virtual element

Tail Clauses Description

= expr For calculated elements: applied on select

default expr Same as in standard SQL: applied on insert

enum {...} Specifies a set of possible values with symbolic names

Type Declarations
Most frequently an element’s type is derived from one of the built-in types or from a custom-defined one.
Some of the built-in types accept parameters. Examples are:

entity Foo {
name : String(44);
netAmount : Amount; //> referring to custom-defined type Amount (a struct)
taxrate : Decimal(3,2);
}

Elements can also be specified with inline structured types as in:

entity Foo {
netAmount { value: Decimal; currency: Association to Currencies; }
}

See Path Expressions about how to address nested elements in queries

Finally you can use the type of operator to infer the type from another element’s type:

entity Foo {
grossAmount : type of netAmount;
}

 Note

The type names after type of are resolved from the inner most {...} scope. Use a : prefix, in case a
name in that scope shadows the definition in an outer scope you want to refer to. For more information, see
Name Resolution in the CDS Definition Language (CDL) topic.

Virtual/Calculated Elements
Virtual elements have no data stored in the database but are always calculated at runtime, that is query
execution time. They are read-only in a sense that no other values can be written to them.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 33
CDL supports two levels as shown here:

entity Foo {
virtual pure : Integer; // to be filled by application logic on top
virtual calc : Date = now(); // filled by SQL queries (not persisted)
}

Pure virtual elements are marked with the virtual modifier but do not have a calculation expression specified.
They are used to declare elements that have values to be calculated by application logic on top of SQL/CDS. On
database level, they do not exist at all and are never returned in result sets of queries. The reason to still declare
them in models is to provide hooks for annotations, for example, for use in generic clients.

Calculated elements have a calculation expression specified through = expr, which is evaluated by the query
runtime in SQL/CDS. They may optionally be marked with the virtual modifier, which does not have any
additional effect, though. The calculation expressions can be applied to scalar elements as well as to structs as
shown in this example:

entity Payslip { ...


today : Date = now();
amount1 : {
value : Decimal(10,2);
currency : String(3);
};
amount2 : = amount1;
amount3 : type of amount1 = { currency: amount1.currency }
}

Note the following:

● today is a scalar calculated element.


● amount2 is a structured one that always has the same value(s) as amount1.
● amount3 is also structured but only amount3.currency is calculated, while amount3.value is a
standard, persisted element.

Type Inference – Explicit type declarations may be omitted for calculated fields, if, and only if, a type –
including relevant details, e.g. dimension of a string, precision/scale of a decimal – can unambiguously be
inferred from a given expression. Note that this is not possible for string types used in entity definitions as the
maximum length parameter for the string would not be possible to infer through expressions.

Constants
Constants are similar to calculated elements but with a guaranteed constant value. They can be defined using
the same syntax as for calculated fields prepended with the modifier const. For example:

const female = 'female';


const male = 'male';

Constants are essentially just named symbols for literals, which can be used by name wherever a literal value
can show up in CDL. They do not show up in persistence or in runtime structures. They are merely symbols
used by the compiler; no value can be assigned at runtime. The expressions must be resolvable to a literal value
at compile time.

Enumerated Values
Enumerated values are defined using key word enum followed by a list of values. For example:

type gender : String(10) enum {


male = ‘male’,

Creating and Deploying GTT Models


34 PUBLIC Modeling Language Guide
female = ‘female’
}

Default Values

The default expr clause is a 1:1 pass-through of the same clause in standard SQL.

Corresponding default values are inserted if no other value is specified upon inserting a new row. Most often
single literals are specified, but the expression can also contain function calls and/or references to other
elements within the same entity.

Views = Projections

Views are entities defined as projections on other entities – basically the equivalent of SQL views, and as those
using SQL SELECT statements, including CDS QL enhancements. From a consumer’s perspective a view’s
signature is indistinguishable from an entity’s signature.

Example:

entity EmployeesView as SELECT from Employees {


id, name, salary, orgunit.{
manager,
name as orgunit,
}
}

As in to SQL you can use view instead of entity – both are equivalent.

Inferred Signatures – Views are entities, with their signature usually inferred from the given projection. The
inferred signature of the example above would resolve to that equivalent:

entity EmployeesView {
id: Integer; name: String; salary: Amount;
manager : Association to Employees; //> from orgunit.manager
orgunit : String; //> from orgunit.name as orgunit
}

Explicit Signatures – If required, you can explicitly specify the (expected) signature. In that case, the inferred
signature is checked against the expected one, and an activation error is thrown if they would not match. For
example:

entity EmployeesView {
id: Integer; name: String; salary: Amount; //> expected signature
} as SELECT from Employees {
id, name, salary //> inferred signature
}

Key Elements, etc. – Within the projection clause of view definitions you can prepend element clauses with the
element modifiers key, virtual and/or masked. For example:

entity EmployeesViewWithKey as SELECT from Employees {


key id, ...
}

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 35
 Note

In contrast to entities, keys in views do not imply any uniqueness constraint. When defining a view,
potentially required key elements must always be marked explicitly in the view; they are never implicitly
derived from the underlying entities.

Primary Keys

In general, each entity must specify a primary key, that is, an attribute combination that uniquely identifies
instances. The order of appearance of key elements within an entity definition determines the order of the
primary key attributes.

For example, this entity definition:

entity Address {
key streetAddress : String(77);
key zipCode : String(11);
city : String(44);
}

is equivalent to the following standard SQL definition:

CREATE TABLE "ADDRESS" (


"STREETADDRESS" nvarchar(77) not null,
"ZIPCODE" nvarchar (11) not null,
"CITY" nvarchar (44)
constraint $primaryKey primary key ("STREETADDRESS", "ZIPCODE")
)

If a struct-typed element is denoted as key, all database columns representing the nested fields of this
structure are part of the primary key.

Reuse Types

You can define global, named types for reuse as in this example:

context cds.xmples;
type Currency : Association to Currencies;
type Amount : {
value : Decimal;
currency : Currency;
}
entity Payslip {
...
netAmount : Amount;
}

The same options are available as described above for element types, except for the element modifiers.

Creating and Deploying GTT Models


36 PUBLIC Modeling Language Guide
4.1.3.3 Associations

In CDS-based models, we add associations by adding an element to a source entity with an Association type
that points to a target entity. The most basic form expects a fully specified join condition. We call this form
unmanaged associations.

Examples:

entity Employees { ...


key ID : Integer; address_id : Integer;
address : Association to one Address on address.ID = address_id;
addresses : Association to many Addresses on addresses.owner = ID;
}

Syntax:

Association =
| Association to [one|many] target [joinspec]
| Association [cardinality] to target [joinspec]
cardinality = [ [ maxs, ][ min .. ][ max ] ]
joinspec = on <expr>
target = QualifiedName -- expected to resolve to an entity

Analysis:

As explained above, associations are elements with an Association type. Hence, Association is not a
keyword but the name of a built-in type, similar to String or Decimal. And as with those, it accepts the
following parameters in SQL-like parameter clauses style:

● to [one | many] target


Specifies the association’s target. A qualified name referring to an entity is expected. This is the only
mandatory parameter. In case the target is a table function or a view with parameters, arguments can be
appended in parenthesis ([args]).
● [ on expr ]
Is a standard SQL join condition. Names in the on condition are always resolved from the source entity’s
scope; all references to elements in the target must be prefixed with the association name, for example,
address.ID.
● [one | many] or [cardinality]
Allows you to optionally specify the relationship’s cardinality. Essential for CDS is only whether it is to
one / [*,0..1] (= the default) or to many / [0..*]. Usually only the target-side cardinality is
specified. Source-side can be specified as a hint to the optimizer if required, for example, [1,0..*]. []
== to many == [0..*]

4.1.3.4 Compositions

Compositions are associations representing contained-in relationships, such as in SalesOrder(Header) and


OrderItems. While the effective concepts are those of associations, a specific and more concise syntax
variant is offered to better capture the semantics.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 37
Examples:

entity SalesOrders {
description: varchar(111);
Items : Composition of many {
product : Association to Products;
quantity : Integer;
}
}

Syntax:

Association +=
| Composition [ cardinality ] of (target)
| Composition of [ one|many ] (target)

Analysis:

The Composition of syntax is a convenient shortcut for defining individual entities with involved
associations. The example above would be expanded to:

entity SalesOrders {
description: varchar(111);
Items : Composition of many SalesOrders.Items on Items.parent=$self;
}
entity SalesOrders.Items {
parent : Association to SalesOrders;
product : Association to Products;
quantity : Integer;
}

The anonymous type in the nested definition is expanded to a type with the qualified name <name of
parent entity>.<name of composition element>. Alternatively, the non nested option can be used as
in the expanded version above. In that case, the alternative keywords merely result in the association being
flagged as a composition association in the model’s metadata.

Associations to self

The pseudo variable $self refers to the current entity and can be used wherever an association to the own
entity (current instance) is required. For example, $self is frequently used to define one-to-many
associations:

entity Employees { ...


key ID : Integer;
addresses : Association to many Addresses on addresses.owner=$self;
}
entity Addresses { ...
owner : Association to Employees;
}

Think of $self as an implicitly defined self-join association for each entity as follows:

entity <Entity> { ...


masked self : Association to <Entity> on self.<primarykey> = <primarykey>;
}

Creating and Deploying GTT Models


38 PUBLIC Modeling Language Guide
4.1.3.5 Redirecteds

Redirecteds define the association or composition in the service the same way as they are defined in the
models.

entity DeliveryItem as projection on DeliveryModel.DeliveryItem {


*,
storageLocation.locationId as storageLocation @title:'Storage Location',
delivery : redirected to DeliveryProcess
};

4.1.3.6 Annotations

Annotations allow you to augment data models with additional metadata, which can be introspected at
runtime. They are triples of the following:

● A property – the key or name identifying a specific piece of metadata


● A target – i.e. types, entities, views and elements thereof
● A value – the actual metadata

In the context of CDS, targets are entities or views and elements thereof. For example:

@Some.header.property: ‘SomeValue’
entity SomeTarget {
element someElementInTarget @<Some.element.property: 4711;
}

Annotation vocabularies declare typed schemas for annotations which allow you to check annotations and
provide tool support such as hints and code completion in editors. Whether to use or mandate vocabularies
can be decided on project level. The core annotation service also allows annotations without vocabularies in
place.

Assigning Annotations

Within CDS metadata model definitions, types, entities and views as well as individual elements thereof
can be annotated as shown in the following examples.

@UI.label: ‘Customer’
entity Customer {
name : String(44) @<UI: { label: ‘Customer Name’, localized: [
{ lang: ‘de’, label: ‘Kundenname’ }
]};
...
}
@UI.label: ‘Customers’
view SalesView as SELECT from SalesOrders {
buyer.name as customer @<UI.label: ‘Customer’, ...
}
// or in a separate metadata extension:
@UI.label: ‘Customers’

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 39
annotate SalesView with {
customer @<UI.label: ‘Customer’; ...
}

Syntax:

Hooks into SDL syntax rules

TypeDefinition = [@pre] type typeName <…> [@post] [";"]


EntityDefinition = [@pre] entity entityName <…> [@post] [";"]
ViewDefinition = [@pre] view viewName <…> [@post] [";"]
ElementDefinition = [@pre] [ key ][ masked ][ element ] elementName <…> [@post]
[";"]
ParameterDefinition = [@pre] parameterName <…> [@post]

Annotations syntax

@pre = ( "@" Annotation )*


@post= ( "@<" Annotation )*
Annotation = PropertyName [ ":" AnnotationValue ]
AnnotationValue = Literal | null
PropertyName = QualifiedName [ "#" VariantQualifier ]
VariantQualifier = Identifier

Analysis:

Annotations can be applied to definitions within SDL documents. Possible targets are the signature of all kind
of definitions, such as types, entities and views on header level, as well as individual elements and parameters
in structured types, entity and view definitions. Two syntax options are supported: either before a target
definition each prefixed with a “@”, or in case of elements after the definition, immediately before the delimiter
– i.e. “;” in case of type and entity definitions and “,” in case of query elements in view definitions (except the
last one). Suffixed annotations start with a “@”, followed by a “<” (no space in between). For example:

@Some.annotation: 4711
entity Foo {
@Field.annotation: 'bar'
foo : String(44);
}

is equivalent to:

@Some.annotation: 4711
entity Foo {
foo : String(44) @<Field.annotation:'bar';
}

Allowed values for annotations are as follows:

● Literals, i.e. strings, numbers, true, false, enum symbols, records and arrays
● The atoms null
● Expressions

Most frequently literal values or null are assigned statically. Assigning expressions are used to express
conditions which lead to dynamically resolved values. If no value is specified at all, true is implicitly assigned.
This is a shorthand to allow for intuitive annotations such as:

entity Foo {
foo : String(44) @<mandatory;
}

Creating and Deploying GTT Models


40 PUBLIC Modeling Language Guide
Assigning Records

The annotation service ultimately stores only scalar values. Yet, we can assign records, which is a syntactical
shortcut for annotations with common prefixes. For example, the following three annotations are equivalent,
with the former two simply being shortcut notations for the third one:

@UI: { field: { label: ‘Customer’, width: 22 }}


-----
@UI.field: { label: ‘Customer’, width: 22 }
-----
@UI.field.label: ‘Customer’
@UI.field.width: 22

Among others this is important to keep in mind when overriding annotations in derived types, views or
extensions. For example, the following annotation on a derived type would override the width while the label
would still remain 'Customer':

@UI.field: { width: 33 }

That is, this annotation does not override the complete record for @UI.field, as it is just a shortcut notation
for @UI.field.width: 33.

Assigning Arrays

The annotation service ultimately stores only scalar values. The assignment of record and array literals are
syntactical shortcuts for annotations with common prefixes. For example, the following three annotations are
equivalent, with the former two simply being shortcut notations for the third one:

@UI: { label: ‘First Name’, localized: [


{ lang: ‘fr’, label: ‘Prénom’ },
{ lang: ‘de’, label: ‘Vorname’ }
]}
@UI.localized.lang: ‘fr’
@UI: {
localized: [
{ lang: ‘fr’ },
]
}

is equivalent to:

@UI.label: ‘First Name’,


@UI.localized.1.lang: ‘fr’,
@UI.localized.1.label: ‘Prénom’,
@UI.localized.2.lang: ‘de’,
@UI.localized.2.label: ‘Vorname’

See Introspecting Annotations for further information on obtaining annotation records and arrays at runtime.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 41
4.2 GTT Metadata Model with CDS

Track and Trace leverages CDS to provide the generic tracked process or object metadata model and to allow
applications to model their own, domain specific processes, objects, and events. To do so, CDS is used in a
specific way which is described in this chapter.

4.2.1 Overall Structure

The generic tracked processes and events are provided as entities with a set of common fields which are ready
to be included via extension in application specific models.

Namespaces and Files

The generic metadata is provided in a set of separated CDS files that have content to be referenced within
application specific metadata definitions. In addition, some reusable data types from SAP IoT Application
Enablement are being reused and provided within the generic metadata part.

The figure below shows the file structure.

Creating and Deploying GTT Models


42 PUBLIC Modeling Language Guide
The core model uses some data types and entities from the SAP IoT Application Enablement. An application,
for example, a delivery application or shipment application provides the following:

● A model definition that defines the metadata model of tracked processes and events for a particular
application
● A service definition that exposes the metadata model to be consumed by OData services
● A UI annotation file that allows usage of SAP Fiori Elements as generic UI for applications. The advantage is
that applications do not need to write their own user interfaces but can leverage proven SAP technology.

To distinguish entities and types we have to have namespaces. For the core model, the namespace is fixed and
set to com.sap.gtt.core. SAP applications use application specific namespaces below structuring
namespace com.sap.gtt.app, for example, com.sap.gtt.app.deliverysample. Custom specific
applications have to use a custom owned namespace, for example, com.<customer name>.gtt.app.

Core Model

The core model can be represented with the following graphic.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 43
Within the core model the tracked process defines the necessary core properties that make a process a
tracked process. Each tracked process has a set of qualified tracking ids linked. Whenever an event is
reported with a particular tracking ID, all instances that have that particular tracking ID assigned are
considered to be affected by the event. Assignment of tracking IDs is time dependent.

The entity event is a generic entity without specific business semantic beside the event itself with actual data
when the event happened.

The link between tracked processes and events is the process event directory, which actually serves two
purposes. First, to store a map of planned events and second, to store actual events that either match a
planned event or become an unplanned event.

The core service exposes the necessary core entities to consumers like OData. The Core UI provides UI
annotations usable for SAP Fiori Elements to ensure consistent user experience across all applications within
the global track and trace option for SAP Logistics Business Network.

Creating and Deploying GTT Models


44 PUBLIC Modeling Language Guide
Application Model

Based on the core model, an application can define its own model that consists of the following parts (a simple
mode application model only consists of the first part):

1. The metadata model itself that extends tracked processes and events with additional business domain
specific data
2. The application service that exposes the metadata model to OData consumers like UI
3. The UI annotations for SAP Fiori Elements
4. The write service that's exposed for processes and events ingestion.

Continuing the example of the delivery application, this results in the following structure:

The delivery process extends the abstract core tracked process by adding new fields for business related data.

The delivery service extends the core service and exposes the newly defined entities as required to the UI. The
UI annotation file may include the core UI definition file to re-use certain default configurations for entities from
the core model to ensure proper and common user experience across applications.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 45
4.2.2 Core Model Details

Core Model consists of five files:

File Name Name Space Context/Service Purpose

CoreModel.cds com.sap.gtt.core CoreModel Defines the annotations and


entities used by the core en­
gine.

CoreServices.cds com.sap.gtt.core CoreServices Exposes the necessary enti­


ties as service and provides
the UI annotations for SAP
Fiori Elements.

CoreTypes.cds sap.appcore.cs.i CoreTypes Defines the types used by the


core model and other meta­
data models.

CoreAnnotations.cds Not applicable Multiple contexts Defines the general annota­


tions used by the core engine
and application layer model.

CoreWriteServices.cds com.sap.gtt.core CoreServices Exposes the necessary enti­


ties as a service for proc­
esses and events ingestion.

Sample Core Model Files

CoreModel.cds

namespace com.sap.gtt.core;
// Reuse IoT AS data types
using sap.appcore.cs.i.CoreTypes;
using sap.appcore.bp.p.BusinessPartner;
using sap.appcore.loc.p.Location;
using sap.appcore.prod.p.Product;
context CoreModel {
// Remarks for naming:
// According to API rules names have to follow field names from Global Field
Catalog
// This has to be done for all fields once a common naming is agreed on
/////////
// Annotations
// ----------------------------------------------------------------------
annotation ObjectIdentifierType : String(255) enum { // object identifier
type code as given in key mapping
// ObjectIdentifierType for Business Partner
customer = 'customer';
vendor = 'vendor';
businessPartner = 'businessPartner';
others = 'others';
// ObjectIdentifierType for Location

Creating and Deploying GTT Models


46 PUBLIC Modeling Language Guide
customerLocation = 'customer location';
vendorLocation = 'vendor location';
shippingPoint = 'shipping point';
plant = 'plant';
// ObjectIdentifierType for Product
product = 'product';
};
annotation UsageType : array of String(255) enum { // type of
usage of an view
inboundMessage = 'inboundMessage';
userInterface = 'userInterface';
search = 'search';
searchResult = 'searchResult';
};
annotation MainEntity : Boolean;
annotation StatusProperties : array of String;
@inherit: false
annotation Indexable : Boolean;
annotation BaseType : String(255) enum {
TrackedProcess = 'TrackedProcess';
AllTrackedProcess = 'AllTrackedProcess';
Event = 'Event';
BusinessPartner = 'BusinessPartner';
Location = 'Location';
Product = 'Product';
};
// Annotations for map
// ----------------------------------------------------------------------
context Map {
context CurrentProcessLocation {
annotation Longitude : Boolean;
annotation Latitude : Boolean;
annotation UpdateTimestamp : Boolean;
}
};
// Annotations for EPCIS
// ----------------------------------------------------------------------
annotation EPCTrackedObject : Boolean;
context EPCIS {
annotation Event : Boolean;
annotation ObjectEvent : Boolean;
annotation AggregationEvent : Boolean;
annotation TransactionEvent : Boolean;
};
// Annotations for simple mode project
// ----------------------------------------------------------------------
annotation SemanticKey : Boolean;
annotation MapEnabled : Boolean;
annotation ShowCriticality : Boolean;
context SortOrder {
annotation ByField : String;
annotation Descending : Boolean;
};
context SearchFields {
annotation FilterFields : array of String;
annotation ResultFields : array of String;
};
annotation LayoutGroups : array of {
GroupName : String;
Label : String;
Data : array of String;
};
context LayoutFacets {
annotation Header : array of String;
annotation Main : array of String;
annotation Sublists : array of String;
annotation ShowFacetLabel : String;
};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 47
// Most generic data without any business semantics
// ideally part of some IoT AS Core Services
// ----------------------------------------------------------------------
type UnitOfMeasure : String(6);
type TimeZoneCode : String(50);
entity TimeZone {
key timeZoneCode : TimeZoneCode @title:
'{@i18n>com.sap.gtt.core.Time_Zone}' @Common:{ Text: description,
TextArrangement: #TextFirst };
description : String(255) @title:
'{@i18n>com.sap.gtt.core.Description}';
};
type ValidityStartTimestampUTC : Timestamp;
type ValidityEndTimestampUTC : Timestamp;
type LogicalSenderSystem : String(10);
// tracked entity as abstract subsumption of Tracked object / tracked
process data
// ----------------------------------------------------------------------
type TrackedProcessId : CoreTypes.Uuid;
type TrackedProcessType : String(255);
// Integration with SAP Event Management
// ----------------------------------------------------------------------
type EventId : CoreTypes.Uuid;
type EventCode : String(20);
type EventType : String(255);
// Object identification via tracking ID and external ID
// ----------------------------------------------------------------------
type TrackingId : String(50);
type TrackingIdType : String(40);
entity QualifiedTrackingId {
key trackedProcess : Association to one TrackedProcess;
scheme : String(255) @title:
'{@i18n>com.sap.gtt.core.Scheme}';
sender : Association to one
BusinessPartner.BusinessPartner @title: '{@i18n>com.sap.gtt.core.Sender}';
logicalSenderSystem : LogicalSenderSystem @title:
'{@i18n>com.sap.gtt.core.Sender_System}';
key trackingIdType : TrackingIdType @title:
'{@i18n>com.sap.gtt.core.Tracking_ID_Type}';
key trackingId : TrackingId @title:
'{@i18n>com.sap.gtt.core.Tracking_ID}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
validFromUTC : ValidityStartTimestampUTC @title:
'{@i18n>com.sap.gtt.core.Valid_From}';
validToUTC : ValidityEndTimestampUTC @title:
'{@i18n>com.sap.gtt.core.Valid_To}';
isPrimaryId : Boolean @title:
'{@i18n>com.sap.gtt.core.Primary_ID}';
};
// Status Values in General
// ----------------------------------------------------------------------
annotation KeepStatusSequence : Boolean;
annotation UpdateStatus : array of {
pathToStatus : String(255);
newValue : String(255);
};
// Event Map and unplanned events
// ----------------------------------------------------------------------
type EventSequence : Integer;
entity EventStatus {
key Code : String(10)
@title:'{@i18n>com.sap.gtt.core.Status_Code}' @Common:{ Text: Text,
TextArrangement: #TextOnly };
Text : String(50)
@title:'{@i18n>com.sap.gtt.core.Status_Name}';
Criticality : Integer
@Common.FieldControl:#Hidden;

Creating and Deploying GTT Models


48 PUBLIC Modeling Language Guide
EditEnabled : Boolean
@Common.FieldControl:#Hidden;
};
type EventReasonText : String(255);
entity PersonalDataProtectionStatus {
key Code : String(10)
@title:'{@i18n>com.sap.gtt.core.Status_Code}' @Common:{ Text: Text,
TextArrangement: #TextOnly };
Text : String(50)
@title:'{@i18n>com.sap.gtt.core.Status_Name}';
};
entity EventAction {
key Code : String(10)
@title:'{@i18n>com.sap.gtt.core.Status_Code}' @Common:{ Text: Text,
TextArrangement: #TextOnly };
Text : String(50)
@title:'{@i18n>com.sap.gtt.core.Status_Name}';
};
// The annotation used to assign planned events to a tracked process
annotation PlannedEvents : array of {
eventType : EventType;
matchLocation : Boolean;
technicalToleranceValue : String(50);
businessToleranceValue : String(50);
periodicOverdueDetection : String(50);
maxOverdueDetection : Integer;
};
annotation AdmissibleUnplannedEvents : array of {
eventType : EventType;
};
annotation ManuallyReportableUnplannedEvents : array of {
eventType : EventType;
};
// Entities used for object tracking
entity HierarchyNode {
key process : Association to one TrackedProcess;
@sap.hierarchy.node.for: 'nodeid'
@title: '{@i18n>com.sap.gtt.core.Node}'
key node : Association to one
AllTrackedProcess;
@sap.hierarchy.parent.node.for: 'nodeid'
@title: '{@i18n>com.sap.gtt.core.Parent_Node}'
parent : Association to one
AllTrackedProcess;
validFrom : Timestamp @title:
'{@i18n>com.sap.gtt.core.Valid_From}';
validTo : Timestamp @title:
'{@i18n>com.sap.gtt.core.Valid_To}';
@sap.hierarchy.level.for: 'nodeid'
@title: '{@i18n>com.sap.gtt.core.Level}'
hierarchyLevel : Integer;
@sap.hierarchy.drill.state.for: 'nodeid'
@title: '{@i18n>com.sap.gtt.core.Drill_State}'
drillState : String(10) enum {
collapsed = 'collapsed';
expanded = 'expanded';
leaf = 'leaf';
};
};
entity ObjectReference {
key id : CoreTypes.Uuid;
key event : Association to one Event;
obsType : String(50) @title:
'{@i18n>com.sap.gtt.core.Observation_Type}' enum {
//parentStart = 'parentStart';
//parentEnd = 'parentEnd';
//childStart = 'childStart';
//childEnd = 'childEnd';

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 49
parent = 'parent';
child = 'child';
};
objKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Object_Key}';
};
// Tracked Process as one and only tracked "something"
// ----------------------------------------------------------------------
@CoreModel.BaseType: #TrackedProcess
entity TrackedProcess {
// Unique identifier - common for T&T and also for IoT AS it's a UUID
key id : TrackedProcessId;
masked tenant : CoreTypes.Tenant not null;
name : CoreTypes.Name @title:
'{@i18n>com.sap.gtt.core.Name}';
description : CoreTypes.Description @title:
'{@i18n>com.sap.gtt.core.Description}';
// fields for T&T
trackedProcessType : TrackedProcessType @title:
'{@i18n>com.sap.gtt.core.Tracked_Process_Type}';
trackingIds : Composition of many
QualifiedTrackingId on trackingIds.trackedProcess = $self @title:
'{@i18n>com.sap.gtt.core.Qualified_Tracking_IDs}';
scheme : String(255) @title:
'{@i18n>com.sap.gtt.core.Scheme}';
sender : Association to one
BusinessPartner.BusinessPartner @title: '{@i18n>com.sap.gtt.core.Sender}';
logicalSenderSystem : LogicalSenderSystem @title:
'{@i18n>com.sap.gtt.core.Sender_System}';
trackingIdType : TrackingIdType @title:
'{@i18n>com.sap.gtt.core.Tracking_ID_Type}';
trackingId : TrackingId @title:
'{@i18n>com.sap.gtt.core.Tracking_ID}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
processEvents : Composition of many
ProcessEventDirectory on processEvents.process = $self;
lastProcessedEvent : Association to one
ProcessEventDirectory { processEventDirectoryId };
hierarchy : Association to many HierarchyNode
on hierarchy.process = $self @title: '{@i18n>com.sap.gtt.core.Hierarchy}';
personalDataProtectionStatus : String(20) @title:
'{@i18n>com.sap.gtt.core.Data_Retention_Status}' enum {
businessActive = 'BA' @title:
'{@i18n>com.sap.gtt.core.Business_Active}';
endOfBusiness = 'EOB' @title:
'{@i18n>com.sap.gtt.core.End_of_Business}';
endOfPurpose = 'EOP' @title:
'{@i18n>com.sap.gtt.core.End_of_Purpose}';
endOfRetention = 'EOR' @title:
'{@i18n>com.sap.gtt.core.End_of_Retention}';
} default 'BA';
// Administrative Data
//systemAdminData : CoreTypes.SystemAdminData;
CreatedByUser : String(64) @title:
'{@i18n>com.sap.gtt.core.Created_By}';
CreationDateTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Created_At}';
LastChangedByUser : String(64) @title:
'{@i18n>com.sap.gtt.core.Last_Changed_By}';
LastChangeDateTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Last_Changed_At}';
};
@CoreModel.BaseType: #AllTrackedProcess
entity AllTrackedProcess {
// Unique identifier - common for T&T and also for IoT AS it's a UUID
key id : TrackedProcessId;
//masked tenant : CoreTypes.Tenant not null;

Creating and Deploying GTT Models


50 PUBLIC Modeling Language Guide
name : CoreTypes.Name @title:
'{@i18n>com.sap.gtt.core.Name}';
description : CoreTypes.Description @title:
'{@i18n>com.sap.gtt.core.Description}';
// fields for T&T
trackedProcessType : TrackedProcessType @title:
'{@i18n>com.sap.gtt.core.Tracked_Process_Type}';
trackingIds : Composition of many
QualifiedTrackingId on trackingIds.trackedProcess = $self @title:
'{@i18n>com.sap.gtt.core.Qualified_Tracking_IDs}';
scheme : String(255) @title:
'{@i18n>com.sap.gtt.core.Scheme}';
sender : Association to one
BusinessPartner.BusinessPartner @title: '{@i18n>com.sap.gtt.core.Sender}';
logicalSenderSystem : LogicalSenderSystem @title:
'{@i18n>com.sap.gtt.core.Sender_System}';
trackingIdType : TrackingIdType @title:
'{@i18n>com.sap.gtt.core.Tracking_ID_Type}';
trackingId : TrackingId @title:
'{@i18n>com.sap.gtt.core.Tracking_ID}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
processEvents : Composition of many
ProcessEventDirectory on processEvents.process = $self;
//lastProcessedEvent : Association to one
ProcessEventDirectory { processEventDirectoryId };
hierarchy : Association to many HierarchyNode
on hierarchy.process = $self @title: '{@i18n>com.sap.gtt.core.Hierarchy}';
personalDataProtectionStatus : String(20) @title:
'{@i18n>com.sap.gtt.core.Data_Retention_Status}' enum {
businessActive = 'BA' @title:
'{@i18n>com.sap.gtt.core.Business_Active}';
endOfBusiness = 'EOB' @title:
'{@i18n>com.sap.gtt.core.End_of_Business}';
endOfPurpose = 'EOP' @title:
'{@i18n>com.sap.gtt.core.End_of_Purpose}';
endOfRetention = 'EOR' @title:
'{@i18n>com.sap.gtt.core.End_of_Retention}';
} default 'BA';
// Administrative Data
//systemAdminData : CoreTypes.SystemAdminData;
CreatedByUser : String(64) @title:
'{@i18n>com.sap.gtt.core.Created_By}';
CreationDateTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Created_At}';
LastChangedByUser : String(64) @title:
'{@i18n>com.sap.gtt.core.Last_Changed_By}';
LastChangeDateTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Last_Changed_At}';
}
entity TrackedProcessForWrite {
trackingIds : Composition of many
QualifiedTrackingId on trackingIds.trackedProcess = $self @title:
'{@i18n>com.sap.gtt.core.Qualified_Tracking_IDs}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
processEvents : Composition of many
ProcessEventDirectory on processEvents.process = $self;
};
// The event directory per tracked process
//
------------------------------------------------------------------------------
entity ProcessEventDirectory {
key process : Association to one TrackedProcess;
key processEventDirectoryId : CoreTypes.Uuid; // This is NOT the
id of the event
masked tenant : CoreTypes.Tenant not null;

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 51
eventCode : EventCode
@title:'{@i18n>com.sap.gtt.core.Event_Code}';
eventType : EventType
@title:'{@i18n>com.sap.gtt.core.Event_Type}';
eventStatus : String(50) @title:
'{@i18n>com.sap.gtt.core.Event_Status}' enum {
planned = 'PLANNED' @title:
'{@i18n>com.sap.gtt.core.Planned}' @Criticality: 0 @EditEnabled: true;
reported = 'REPORTED' @title:
'{@i18n>com.sap.gtt.core.Reported}' @Criticality: 3 @EditEnabled: true;
unplanned = 'UNPLANNED' @title:
'{@i18n>com.sap.gtt.core.Unplanned}' @Criticality: 1 @EditEnabled: false;
overdue = 'OVERDUE' @title:
'{@i18n>com.sap.gtt.core.Overdue}' @Criticality: 2 @EditEnabled: true;
};
eventReasonText : EventReasonText
@title:'{@i18n>com.sap.gtt.core.Event_Reason}';
event : Association to one Event;
/* correlationType : String(255) enum
@title:'{@i18n>com.sap.gtt.core.Correlation_Type}' {
parent = 'parent';
child = 'child';
subject = 'subject';
observer = 'observer';
};
*/
// Plan Data
sequence : EventSequence @title:
'{@i18n>com.sap.gtt.core.Sequence}';
payloadSequence : Integer @title:
'{@i18n>com.sap.gtt.core.Payload_Sequence}';
//@Common.SemanticObject: 'Location'
location : Association to one
Location.Location @title:'{@i18n>com.sap.gtt.core.Location}';
// Fields for overdue redetection
nextOverdueDetectionUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Next_Overdue_Detection_Time}';
overdueDetectionCounter : Integer
@title:'{@i18n>com.sap.gtt.core.Overdue_Detection_Counter}';
// planned technical time & date
plannedTechnicalTimestampUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Planned_Technical_Time}';
plannedTechTsEarliestUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Earliest_Planned_Technical_Time}';
plannedTechTsLatestUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Latest_Planned_Technical_Time}';
// planned business time & date
@TimeZoneInfo.TimeZone: plannedBusinessTimeZone
plannedBusinessTimestampUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Planned_Business_Time}';
@TimeZoneInfo.TimeZone: plannedBusinessTimeZone
plannedBizTsEarliestUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Earliest_Planned_Business_Time}';
@TimeZoneInfo.TimeZone: plannedBusinessTimeZone
plannedBizTsLatestUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Latest_Planned_Business_Time}';
@Semantics.TimeZone: true
plannedBusinessTimeZone : Association to one TimeZone
@title:'{@i18n>com.sap.gtt.core.Planned_Business_Time_Zone}';
// Actual Event Data
// ToDo: Partially redundant with event data => to be sorted out based
on access patterns
actualTechnicalTimestampUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Actual_Technical_Time}';
@TimeZoneInfo.TimeZone: actualBusinessTimeZone
actualBusinessTimestampUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Actual_Business_Time}';
@Semantics.TimeZone: true

Creating and Deploying GTT Models


52 PUBLIC Modeling Language Guide
actualBusinessTimeZone : Association to one TimeZone
@title:'{@i18n>com.sap.gtt.core.Actual_Business_Time_Zone}';
// Administrative Data
//systemAdminData : CoreTypes.SystemAdminData;
CreatedByUser : String(64) @title:
'{@i18n>com.sap.gtt.core.Created_By}';
processingTimestampUTC : Timestamp @title:
'{@i18n>com.sap.gtt.core.Created_At}';
};
// Used in event to update qualified tracking IDs in processes.
entity ObserverAddDeleteByBusSysKey {
key event : Association to one Event;
scheme : String(255) @title:
'{@i18n>com.sap.gtt.core.Scheme}';
sender : Association to one
BusinessPartner.BusinessPartner @title: '{@i18n>com.sap.gtt.core.Sender}';
logicalSenderSystem : LogicalSenderSystem @title:
'{@i18n>com.sap.gtt.core.Sender_System}';
key trackingIdType : TrackingIdType @title:
'{@i18n>com.sap.gtt.core.Tracking_ID_Type}';
key trackingId : TrackingId @title:
'{@i18n>com.sap.gtt.core.Tracking_ID}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
validFromUTC : ValidityStartTimestampUTC @title:
'{@i18n>com.sap.gtt.core.Valid_From}';
validToUTC : ValidityEndTimestampUTC @title:
'{@i18n>com.sap.gtt.core.Valid_To}';
action : String(50) @title:
'{@i18n>com.sap.gtt.core.Action}' enum {
add = 'A' @title:
'{@i18n>com.sap.gtt.core.Add}';
delete = 'D' @title:
'{@i18n>com.sap.gtt.core.Delete}';
};
};
// Events and Event Messages: // Idea is to define the events only -
// a corresponding Event Message has equivalent data
//
------------------------------------------------------------------------------
@CoreModel.BaseType: #Event
entity Event {
// Unique identifier - common for T&T and also for IoT AS it's a UUID
key id : String(50);
masked tenant : CoreTypes.Tenant not null;
// Fields for T&T Event Model
eventCode : EventCode
@title:'{@i18n>com.sap.gtt.core.Event_Code}';
eventType : EventType
@title:'{@i18n>com.sap.gtt.core.Event_Type}';
eventReasonText : EventReasonText
@title:'{@i18n>com.sap.gtt.core.Event_Reason}';
senderParty : Association to one
BusinessPartner.BusinessPartner @title: '{@i18n>com.sap.gtt.core.Event_Sender}';
//trackingId : EventQualifiedTrackingId;
scheme : String(255) @title:
'{@i18n>com.sap.gtt.core.Scheme}';
sender : Association to one
BusinessPartner.BusinessPartner @title: '{@i18n>com.sap.gtt.core.Sender}';
logicalSenderSystem : LogicalSenderSystem @title:
'{@i18n>com.sap.gtt.core.Sender_System}';
trackingIdType : TrackingIdType @title:
'{@i18n>com.sap.gtt.core.Tracking_ID_Type}';
trackingId : TrackingId @title:
'{@i18n>com.sap.gtt.core.Tracking_ID}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
// Actual Event Data

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 53
actualTechnicalTimestampUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Actual_Technical_Time}';
@TimeZoneInfo.TimeZone: actualBusinessTimeZone
actualBusinessTimestampUTC : Timestamp
@title:'{@i18n>com.sap.gtt.core.Actual_Business_Time}';
@Semantics.TimeZone: true
actualBusinessTimeZone : Association to one TimeZone
@title:'{@i18n>com.sap.gtt.core.Actual_Business_Time_Zone}';
//@Common.SemanticObject: 'Location'
location : Association to one
Location.Location @title:'{@i18n>com.sap.gtt.core.Location}';
// adHoc location fields
locationId : String(255)
@title:'{@i18n>com.sap.gtt.core.Location_ID}';
locationDescription : CoreTypes.Description
@title:'{@i18n>com.sap.gtt.core.Location_Description}'; // TODO: localized
longitude : Decimal(9,6)
@title:'{@i18n>com.sap.gtt.core.Longitude}';
latitude : Decimal(8,6)
@title:'{@i18n>com.sap.gtt.core.Latitude}';
trackingIds : Composition of many
ObserverAddDeleteByBusSysKey on trackingIds.event = $self;
objectReferences : Composition of many
ObjectReference on objectReferences.event = $self
@title:'{@i18n>com.sap.gtt.core.Object_References}';
action : String(255)
@title:'{@i18n>com.sap.gtt.core.Action}' enum {
ADD = 'ADD' @title:
'{@i18n>com.sap.gtt.core.Add}';
OBSERVE = 'OBSERVE' @title:
'{@i18n>com.sap.gtt.core.Observe}';
DELETE = 'DELETE' @title:
'{@i18n>com.sap.gtt.core.Delete}';
};
// Administrative Data
messageSourceType : String(50)
@title:'{@i18n>com.sap.gtt.core.Message_Source_Type}';
CreatedByUser : String(64) @title:
'{@i18n>com.sap.gtt.core.Created_By}';
processingTimestampUTC : Timestamp @title:
'{@i18n>com.sap.gtt.core.Created_At}';
};
entity EventForWrite {
eventReasonText : EventReasonText
@title:'{@i18n>com.sap.gtt.core.Event_Reason}';
altKey : String(255) @title:
'{@i18n>com.sap.gtt.core.Key}';
location : Association to one
Location.Location @title:'{@i18n>com.sap.gtt.core.Location}';
trackingIds : Composition of many
ObserverAddDeleteByBusSysKey on trackingIds.event = $self;
objectReferences : Composition of many
ObjectReference on objectReferences.event = $self;
action : String(255)
@title:'{@i18n>com.sap.gtt.core.Action}' enum {
ADD = 'ADD' @title:
'{@i18n>com.sap.gtt.core.Add}';
OBSERVE = 'OBSERVE' @title:
'{@i18n>com.sap.gtt.core.Observe}';
DELETE = 'DELETE' @title:
'{@i18n>com.sap.gtt.core.Delete}';
};
actualBusinessTimestamp : Timestamp
@title:'{@i18n>com.sap.gtt.core.Actual_Business_Time}';
longitude : Decimal(9,6)
@title:'{@i18n>com.sap.gtt.core.Longitude}';
latitude : Decimal(8,6)
@title:'{@i18n>com.sap.gtt.core.Latitude}';

Creating and Deploying GTT Models


54 PUBLIC Modeling Language Guide
};
// Predefined Event for Overdue
// ----------------------------------------------------------------------
@UI.HeaderInfo.Title.Label: '{@i18n>com.sap.gtt.core.GTT_Overdue}'
@SAP_EM.eventCode: {Code: 'GTT_OVERDUE', Text:
'{@i18n>com.sap.gtt.core.Overdue}', Type: 'UNPLANNED' }
@CoreModel.Indexable: false
entity GTTOverdueEvent : CoreModel.Event {
process : Association to one TrackedProcess;
plannedEvent : Association to one ProcessEventDirectory
{ processEventDirectoryId };
};
@UI.HeaderInfo.Title.Label:
'{@i18n>com.sap.gtt.core.GTT_Reset_Planned_Event_Status}'
@SAP_EM.eventCode: {Code: 'GTT_RESET_PLANNED', Text:
'{@i18n>com.sap.gtt.core.GTT_Reset_Planned_Event_Status}', Type: 'UNPLANNED' }
@CoreModel.Indexable: false
entity GTTResetPlannedEventStatusEvent : CoreModel.Event {
plannedEventType : EventType
@title:'{@i18n>com.sap.gtt.core.Planned_Event_Type}';
plannedEventLocation : Association to one
Location.Location @title:'{@i18n>com.sap.gtt.core.Planned_Event_Location}';
plannedEventLocationType : String(50)
@title:'{@i18n>com.sap.gtt.core.Planned_Event_Location_Type}';
};
entity GTTResetPlannedEventStatusEventForWrite : CoreModel.EventForWrite {
plannedEventType : EventType
@title:'{@i18n>com.sap.gtt.core.Planned_Event_Type}';
plannedEventLocation : Association to one
Location.Location @title:'{@i18n>com.sap.gtt.core.Planned_Event_Location}';
plannedEventLocationType : String(50)
@title:'{@i18n>com.sap.gtt.core.Planned_Event_Location_Type}';
};
// Predefined Event for Personal Data Blocking
// ----------------------------------------------------------------------
@UI.HeaderInfo.Title.Label:
'{@i18n>com.sap.gtt.core.GTT_Personal_Data_Blocking}'
@SAP_EM.eventCode: {Code: 'GTT_DPP_BLOCK', Text:
'{@i18n>com.sap.gtt.core.Personal_Data_Blocking}', Type: 'PLANNED' }
@CoreModel.Indexable: false
entity GTTPersonalDataBlockingEvent : CoreModel.Event {
process : Association to one TrackedProcess;
};
// Predefined Event for Personal Data Deletion
// ----------------------------------------------------------------------
@UI.HeaderInfo.Title.Label:
'{@i18n>com.sap.gtt.core.GTT_Personal_Data_Deletion}'
@SAP_EM.eventCode: {Code: 'GTT_DPP_DELETE', Text:
'{@i18n>com.sap.gtt.core.Personal_Data_Deletion}', Type: 'PLANNED' }
@CoreModel.Indexable: false
entity GTTPersonalDataDeletionEvent : CoreModel.Event {
process : Association to one TrackedProcess;
};
//
// Entities for map function. Only used for odata services.
// The data is computed on the fly.
//
entity ProcessLocation {
key id : String(255);
key process : Association to one TrackedProcess;
location : Association to one Location.Location;
pos : String(255);
type : String(255);
description : String(255);
};
entity CurrentProcessLocation {
key id : String(255);
key process : Association to one TrackedProcess;

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 55
longitude : Decimal(9,6);
latitude : Decimal(8,6);
lastUpdateTime : Timestamp;
pos : String(255);
};
entity ProcessRoute {
key id : CoreTypes.Uuid;
key process : Association to one TrackedProcess;
pos : String(5000);
};
//
// Entities for EPCIS.
//
entity BusinessStep {
key Code : String(255)
@title:'{@i18n>com.sap.gtt.core.Code}' @Common:{ Text:Text,
TextArrangement:#TextOnly };
Text : String(255)
@title:'{@i18n>com.sap.gtt.core.Name}';
};
entity Disposition {
key Code : String(255)
@title:'{@i18n>com.sap.gtt.core.Code}' @Common:{ Text:Text,
TextArrangement:#TextOnly };
Text : String(255)
@title:'{@i18n>com.sap.gtt.core.Name}';
};
entity BusinessTransactionType {
key Code : String(255)
@title:'{@i18n>com.sap.gtt.core.Code}' @Common:{ Text:Text,
TextArrangement:#TextOnly };
Text : String(255)
@title:'{@i18n>com.sap.gtt.core.Name}';
};
entity SourceDestType {
key Code : String(255)
@title:'{@i18n>com.sap.gtt.core.Code}' @Common:{ Text:Text,
TextArrangement:#TextOnly };
Text : String(255)
@title:'{@i18n>com.sap.gtt.core.Name}';
};
@CoreModel.EPCTrackedObject: true
entity GTTEPCTrackedObject : CoreModel.TrackedProcess {
@CoreModel.SemanticKey: true
epc : String(255) @title:
'{@i18n>com.sap.gtt.core.EPC_ID}';
lastBizStep : BusinessStepID @title:
'{@i18n>com.sap.gtt.core.Last_Business_Step}';
lastDisposition : DispositionID @title:
'{@i18n>com.sap.gtt.core.Last_Disposition}';
lastReadPoint : String(255) @title:
'{@i18n>com.sap.gtt.core.Last_Read_Point}';
lastBizLocation : String(255) @title:
'{@i18n>com.sap.gtt.core.Last_Business_Location}';
lastEventTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Last_Event_Time}';
}
entity GTTAllTrackedProcessForEPCTrackedObject : CoreModel.AllTrackedProcess
{
@CoreModel.SemanticKey: true
epc : String(255) @title:
'{@i18n>com.sap.gtt.core.EPC_ID}';
lastBizStep : BusinessStepID @title:
'{@i18n>com.sap.gtt.core.Last_Business_Step}';
lastDisposition : DispositionID @title:
'{@i18n>com.sap.gtt.core.Last_Disposition}';
lastReadPoint : String(255) @title:
'{@i18n>com.sap.gtt.core.Last_Read_Point}';

Creating and Deploying GTT Models


56 PUBLIC Modeling Language Guide
lastBizLocation : String(255) @title:
'{@i18n>com.sap.gtt.core.Last_Business_Location}';
lastEventTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Last_Event_Time}';
}
type ErrorReasonID : String(255) enum {
did_not_occur = 'urn:epcglobal:cbv:er:did_not_occur';
incorrect_data = 'urn:epcglobal:cbv:er:incorrect_data';
};
entity CorrectiveEventID {
key errorDeclaration : Association to one ErrorDeclaration;
key eventID : String(255) @title:
'{@i18n>com.sap.gtt.core.Event_ID}';
}
entity ErrorDeclaration {
key id : CoreTypes.Uuid;
declarationTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Declaration_Time}';
reason : ErrorReasonID @title:
'{@i18n>com.sap.gtt.core.Reason}';
correctiveEventIDs : Composition of many CorrectiveEventID on
correctiveEventIDs.errorDeclaration = $self @title:
'{@i18n>com.sap.gtt.core.Corrective_Event_IDs}';
}
@UI.HeaderInfo.Title.Label: '{@i18n>com.sap.gtt.core.GTT_EPCIS_Event}'
//@SAP_EM.eventCode: {Code: 'GTT_EPCIS', Text:
'{@i18n>com.sap.gtt.core.GTT_EPCIS_Event}', Type: 'UNPLANNED' }
@CoreModel.EPCIS.Event: true
entity GTTEPCISEvent : CoreModel.Event {
eventTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Event_Time}';
recordTime : Timestamp @title:
'{@i18n>com.sap.gtt.core.Record_Time}';
eventTimeZoneOffset : String(10) @title:
'{@i18n>com.sap.gtt.core.Event_Time_Zone_Offset}';
//eventID : String(255);
//errorDeclaration : Composition of one ErrorDeclaration;
}
type BusinessStepID : String(255) enum {
accepting = 'urn:epcglobal:cbv:bizstep:accepting' @title:
'{@i18n>com.sap.gtt.core.Accepting}';
arriving = 'urn:epcglobal:cbv:bizstep:arriving' @title:
'{@i18n>com.sap.gtt.core.Arriving}';
assembling = 'urn:epcglobal:cbv:bizstep:assembling' @title:
'{@i18n>com.sap.gtt.core.Assembling}';
collecting = 'urn:epcglobal:cbv:bizstep:collecting' @title:
'{@i18n>com.sap.gtt.core.Collecting}';
commissioning = 'urn:epcglobal:cbv:bizstep:commissioning'
@title: '{@i18n>com.sap.gtt.core.Commissioning}';
consigning = 'urn:epcglobal:cbv:bizstep:consigning' @title:
'{@i18n>com.sap.gtt.core.Consigning}';
creating_class_instance =
'urn:epcglobal:cbv:bizstep:creating_class_instance' @title:
'{@i18n>com.sap.gtt.core.Creating_Class_Instance}';
cycle_counting = 'urn:epcglobal:cbv:bizstep:cycle_counting'
@title: '{@i18n>com.sap.gtt.core.Cycle_Counting}';
decommissioning = 'urn:epcglobal:cbv:bizstep:decommissioning'
@title: '{@i18n>com.sap.gtt.core.Decommissioning}';
departing = 'urn:epcglobal:cbv:bizstep:departing' @title:
'{@i18n>com.sap.gtt.core.Departing}';
destroying = 'urn:epcglobal:cbv:bizstep:destroying' @title:
'{@i18n>com.sap.gtt.core.Destroying}';
disassembling = 'urn:epcglobal:cbv:bizstep:disassembling'
@title: '{@i18n>com.sap.gtt.core.Disassembling}';
dispensing = 'urn:epcglobal:cbv:bizstep:dispensing' @title:
'{@i18n>com.sap.gtt.core.Dispensing}';
encoding = 'urn:epcglobal:cbv:bizstep:encoding' @title:
'{@i18n>com.sap.gtt.core.Encoding}';

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 57
entering_exiting = 'urn:epcglobal:cbv:bizstep:entering_exiting'
@title: '{@i18n>com.sap.gtt.core.Entering_Exiting}';
holding = 'urn:epcglobal:cbv:bizstep:holding' @title:
'{@i18n>com.sap.gtt.core.Holding}';
inspecting = 'urn:epcglobal:cbv:bizstep:inspecting' @title:
'{@i18n>com.sap.gtt.core.Inspecting}';
installing = 'urn:epcglobal:cbv:bizstep:installing' @title:
'{@i18n>com.sap.gtt.core.Installing}';
killing = 'urn:epcglobal:cbv:bizstep:killing' @title:
'{@i18n>com.sap.gtt.core.Killing}';
loading = 'urn:epcglobal:cbv:bizstep:loading' @title:
'{@i18n>com.sap.gtt.core.Loading}';
other = 'urn:epcglobal:cbv:bizstep:other' @title:
'{@i18n>com.sap.gtt.core.Other}';
packing = 'urn:epcglobal:cbv:bizstep:packing' @title:
'{@i18n>com.sap.gtt.core.Packing}';
picking = 'urn:epcglobal:cbv:bizstep:picking' @title:
'{@i18n>com.sap.gtt.core.Picking}';
receiving = 'urn:epcglobal:cbv:bizstep:receiving' @title:
'{@i18n>com.sap.gtt.core.Receiving}';
removing = 'urn:epcglobal:cbv:bizstep:removing' @title:
'{@i18n>com.sap.gtt.core.Removing}';
repackaging = 'urn:epcglobal:cbv:bizstep:repackaging'
@title: '{@i18n>com.sap.gtt.core.Repackaging}';
repairing = 'urn:epcglobal:cbv:bizstep:repairing' @title:
'{@i18n>com.sap.gtt.core.Repairing}';
replacing = 'urn:epcglobal:cbv:bizstep:replacing' @title:
'{@i18n>com.sap.gtt.core.Replacing}';
reserving = 'urn:epcglobal:cbv:bizstep:reserving' @title:
'{@i18n>com.sap.gtt.core.Reserving}';
retail_selling = 'urn:epcglobal:cbv:bizstep:retail_selling'
@title: '{@i18n>com.sap.gtt.core.Retail_Selling}';
shipping = 'urn:epcglobal:cbv:bizstep:shipping' @title:
'{@i18n>com.sap.gtt.core.Shipping}';
staging_outbound = 'urn:epcglobal:cbv:bizstep:staging_outbound'
@title: '{@i18n>com.sap.gtt.core.Staging_Outbound}';
stock_taking = 'urn:epcglobal:cbv:bizstep:stock_taking'
@title: '{@i18n>com.sap.gtt.core.Stock_Taking}';
stocking = 'urn:epcglobal:cbv:bizstep:stocking' @title:
'{@i18n>com.sap.gtt.core.Stocking}';
storing = 'urn:epcglobal:cbv:bizstep:storing' @title:
'{@i18n>com.sap.gtt.core.Storing}';
transforming = 'urn:epcglobal:cbv:bizstep:transforming'
@title: '{@i18n>com.sap.gtt.core.Transforming}';
transporting = 'urn:epcglobal:cbv:bizstep:transporting'
@title: '{@i18n>com.sap.gtt.core.Transporting}';
unloading = 'urn:epcglobal:cbv:bizstep:unloading' @title:
'{@i18n>com.sap.gtt.core.Unloading}';
unpacking = 'urn:epcglobal:cbv:bizstep:unpacking' @title:
'{@i18n>com.sap.gtt.core.Unpacking}';
void_shipping = 'urn:epcglobal:cbv:bizstep:void_shipping'
@title: '{@i18n>com.sap.gtt.core.Void_Shipping}';
};
type DispositionID : String(255) enum {
active = 'urn:epcglobal:cbv:disp:active' @title:
'{@i18n>com.sap.gtt.core.Active}';
container_closed = 'urn:epcglobal:cbv:disp:container_closed'
@title: '{@i18n>com.sap.gtt.core.Container_Closed}';
damaged = 'urn:epcglobal:cbv:disp:damaged' @title:
'{@i18n>com.sap.gtt.core.Damaged}';
destroyed = 'urn:epcglobal:cbv:disp:destroyed' @title:
'{@i18n>com.sap.gtt.core.Destroyed}';
dispensed = 'urn:epcglobal:cbv:disp:dispensed' @title:
'{@i18n>com.sap.gtt.core.Dispensed}';
disposed = 'urn:epcglobal:cbv:disp:disposed' @title:
'{@i18n>com.sap.gtt.core.Disposed}';
encoded = 'urn:epcglobal:cbv:disp:encoded' @title:
'{@i18n>com.sap.gtt.core.Encoded}';

Creating and Deploying GTT Models


58 PUBLIC Modeling Language Guide
expired = 'urn:epcglobal:cbv:disp:expired' @title:
'{@i18n>com.sap.gtt.core.Expired}';
in_progress = 'urn:epcglobal:cbv:disp:in_progress' @title:
'{@i18n>com.sap.gtt.core.In_Progress}';
in_transit = 'urn:epcglobal:cbv:disp:in_transit' @title:
'{@i18n>com.sap.gtt.core.In_Transit}';
inactive = 'urn:epcglobal:cbv:disp:inactive' @title:
'{@i18n>com.sap.gtt.core.Inactive}';
no_pedigree_match = 'urn:epcglobal:cbv:disp:no_pedigree_match'
@title: '{@i18n>com.sap.gtt.core.No_Pedigree_Match}';
non_sellable_other = 'urn:epcglobal:cbv:disp:non_sellable_other'
@title: '{@i18n>com.sap.gtt.core.Non_Sellable_Other}';
partially_dispensed = 'urn:epcglobal:cbv:disp:partially_dispensed'
@title: '{@i18n>com.sap.gtt.core.Partially_Dispensed}';
recalled = 'urn:epcglobal:cbv:disp:recalled' @title:
'{@i18n>com.sap.gtt.core.Recalled}';
reserved = 'urn:epcglobal:cbv:disp:reserved' @title:
'{@i18n>com.sap.gtt.core.Reserved}';
retail_sold = 'urn:epcglobal:cbv:disp:retail_sold' @title:
'{@i18n>com.sap.gtt.core.Retail_Sold}';
returned = 'urn:epcglobal:cbv:disp:returned' @title:
'{@i18n>com.sap.gtt.core.Returned}';
sellable_accessible = 'urn:epcglobal:cbv:disp:sellable_accessible'
@title: '{@i18n>com.sap.gtt.core.Sellable_and_Accessible}';
sellable_not_accessible =
'urn:epcglobal:cbv:disp:sellable_not_accessible' @title:
'{@i18n>com.sap.gtt.core.Sellable_but_Not_Accessible}';
stolen = 'urn:epcglobal:cbv:disp:stolen' @title:
'{@i18n>com.sap.gtt.core.Stolen}';
unknown = 'urn:epcglobal:cbv:disp:unknown' @title:
'{@i18n>com.sap.gtt.core.Unknown}';
};
type BusinessTransactionTypeID : String(255) enum {
bol = 'urn:epcglobal:cbv:btt:bol' @title:
'{@i18n>com.sap.gtt.core.Bol}';
desadv = 'urn:epcglobal:cbv:btt:desadv' @title:
'{@i18n>com.sap.gtt.core.Desadv}';
inv = 'urn:epcglobal:cbv:btt:inv' @title:
'{@i18n>com.sap.gtt.core.Inv}';
pedigree = 'urn:epcglobal:cbv:btt:pedigree' @title:
'{@i18n>com.sap.gtt.core.Pedigree}';
po = 'urn:epcglobal:cbv:btt:po' @title:
'{@i18n>com.sap.gtt.core.Po}';
poc = 'urn:epcglobal:cbv:btt:poc' @title:
'{@i18n>com.sap.gtt.core.Poc}';
prodorder = 'urn:epcglobal:cbv:btt:prodorder' @title:
'{@i18n>com.sap.gtt.core.Prodorder}';
recadv = 'urn:epcglobal:cbv:btt:recadv' @title:
'{@i18n>com.sap.gtt.core.Recadv}';
rma = 'urn:epcglobal:cbv:btt:rma' @title:
'{@i18n>com.sap.gtt.core.Rma}';
};
type SourceDestTypeID : String(255) enum {
owning_party = 'urn:epcglobal:cbv:sdt:owning_party' @title:
'{@i18n>com.sap.gtt.core.Owning_party}';
possessing_party = 'urn:epcglobal:cbv:sdt:possessing_party'
@title: '{@i18n>com.sap.gtt.core.Possessing_party}';
location = 'urn:epcglobal:cbv:sdt:location' @title:
'{@i18n>com.sap.gtt.core.Location}';
};
entity EPC {
key event : Association to one Event;
key epc : String(255) @title:
'{@i18n>com.sap.gtt.core.EPC}';
};
entity QuantityElement {
key event : Association to one Event;

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 59
key epcClass : String(255) @title:
'{@i18n>com.sap.gtt.core.EPC_Class}';
quantity : Decimal(15,3) @title:
'{@i18n>com.sap.gtt.core.Quantity}';
uom : String(3) @title:
'{@i18n>com.sap.gtt.core.Unit_Of_Measure}';
};
entity BusinessTransaction {
key id : CoreTypes.Uuid;
key event : Association to one Event;
type : BusinessTransactionTypeID @title:
'{@i18n>com.sap.gtt.core.Type}';
bizTransaction : String(255) @title:
'{@i18n>com.sap.gtt.core.Business_Transaction}';
};
entity Source {
key id : CoreTypes.Uuid;
key event : Association to one Event;
type : SourceDestTypeID @title:
'{@i18n>com.sap.gtt.core.Type}';
source : String(255) @title:
'{@i18n>com.sap.gtt.core.Source}';
};
entity Destination {
key id : CoreTypes.Uuid;
key event : Association to one Event;
type : SourceDestTypeID @title:
'{@i18n>com.sap.gtt.core.Type}';
destination : String(255) @title:
'{@i18n>com.sap.gtt.core.Destination}';
};
@UI.HeaderInfo.Title.Label: '{@i18n>com.sap.gtt.core.GTT_EPCIS_Object_Event}'
//@SAP_EM.eventCode: {Code: 'GTT_EPCIS_OBJ', Text:
'{@i18n>com.sap.gtt.core.GTT_EPCIS_Object_Event}', Type: 'UNPLANNED' }
@CoreModel.EPCIS.ObjectEvent: true
entity GTTEPCISObjectEvent : GTTEPCISEvent {
epcList : Composition of many EPC on epcList.event = $self
@title: '{@i18n>com.sap.gtt.core.EPC_List}';
//quantityList : Composition of many QuantityElement on
quantityList.event = $self;
bizStep : BusinessStepID @title:
'{@i18n>com.sap.gtt.core.Business_Step}';
disposition : DispositionID @title:
'{@i18n>com.sap.gtt.core.Disposition}';
readPoint : String(255) @title:
'{@i18n>com.sap.gtt.core.Read_Point}';
bizLocation : String(255) @title:
'{@i18n>com.sap.gtt.core.Business_Location}';
bizTransactionList : Composition of many BusinessTransaction on
bizTransactionList.event = $self @title:
'{@i18n>com.sap.gtt.core.Business_Transaction_List}';
sourceList : Composition of many Source on sourceList.event =
$self @title: '{@i18n>com.sap.gtt.core.Source_List}';
destinationList : Composition of many Destination on
destinationList.event = $self @title:
'{@i18n>com.sap.gtt.core.Destination_List}';
//ilmd : ILMD;
};
@UI.HeaderInfo.Title.Label:
'{@i18n>com.sap.gtt.core.GTT_EPCIS_Aggregation_Event}'
//@SAP_EM.eventCode: {Code: 'GTT_EPCIS_AGG', Text:
'{@i18n>com.sap.gtt.core.GTT_EPCIS_Aggregation_Event}', Type: 'UNPLANNED' }
@CoreModel.EPCIS.AggregationEvent: true
entity GTTEPCISAggregationEvent : GTTEPCISEvent {
parentID : String(255) @title:
'{@i18n>com.sap.gtt.core.Parent_ID}';
childEPCs : Composition of many EPC on childEPCs.event =
$self @title: '{@i18n>com.sap.gtt.core.Child_EPCs}';

Creating and Deploying GTT Models


60 PUBLIC Modeling Language Guide
//childQuantityList : Composition of many QuantityElement on
childQuantityList.event = $self;
bizStep : BusinessStepID @title:
'{@i18n>com.sap.gtt.core.Business_Step}';
disposition : DispositionID @title:
'{@i18n>com.sap.gtt.core.Disposition}';
readPoint : String(255) @title:
'{@i18n>com.sap.gtt.core.Read_Point}';
bizLocation : String(255) @title:
'{@i18n>com.sap.gtt.core.Business_Location}';
bizTransactionList : Composition of many BusinessTransaction on
bizTransactionList.event = $self @title:
'{@i18n>com.sap.gtt.core.Business_Transaction_List}';
sourceList : Composition of many Source on sourceList.event =
$self @title: '{@i18n>com.sap.gtt.core.Source_List}';
destinationList : Composition of many Destination on
destinationList.event = $self @title:
'{@i18n>com.sap.gtt.core.Destination_List}';
};
@UI.HeaderInfo.Title.Label:
'{@i18n>com.sap.gtt.core.GTT_EPCIS_Transaction_Event}'
//@SAP_EM.eventCode: {Code: 'GTT_EPCIS_TRA', Text:
'{@i18n>com.sap.gtt.core.GTT_EPCIS_Transaction_Event}', Type: 'UNPLANNED' }
@CoreModel.EPCIS.TransactionEvent: true
entity GTTEPCISTransactionEvent : GTTEPCISEvent {
bizTransactionList : Composition of many BusinessTransaction on
bizTransactionList.event = $self @title:
'{@i18n>com.sap.gtt.core.Business_Transaction_List}';
parentID : String(255) @title:
'{@i18n>com.sap.gtt.core.Parent_ID}';
epcList : Composition of many EPC on epcList.event = $self
@title: '{@i18n>com.sap.gtt.core.EPC_List}';
//quantityList : Composition of many QuantityElement on
quantityList.event = $self;
bizStep : BusinessStepID @title:
'{@i18n>com.sap.gtt.core.Business_Step}';
disposition : DispositionID @title:
'{@i18n>com.sap.gtt.core.Disposition}';
readPoint : String(255) @title:
'{@i18n>com.sap.gtt.core.Read_Point}';
bizLocation : String(255) @title:
'{@i18n>com.sap.gtt.core.Business_Location}';
sourceList : Composition of many Source on sourceList.event =
$self @title: '{@i18n>com.sap.gtt.core.Source_List}';
destinationList : Composition of many Destination on
destinationList.event = $self @title:
'{@i18n>com.sap.gtt.core.Destination_List}';
}
//
// Entities for analytics. Only used for odata services.
// The data is computed on the fly.
//
entity ProcessCountByDay {
key id : String(255);
sender : Association to one
BusinessPartner.BusinessPartner; // For Odata Filter
date : Date;
count : Integer;
};
entity ProcessCountBySender {
key id : String(255);
sender : Association to one
BusinessPartner.BusinessPartner;
date : Date; // For Odata Filter
count : Integer;
};
entity UnplannedEventCountByProcess {
key id : String(255);

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 61
date : Date;
sender : Association to one
BusinessPartner.BusinessPartner;
count : Integer;
process : Association to one CoreModel.TrackedProcess;
};
entity LocationProcess {
key id : String(255);
locationid : String(255);
date : Date;
sender : Association to one
BusinessPartner.BusinessPartner;
process : Association to one CoreModel.TrackedProcess;
unplannedCount : Integer;
}
entity UnplannedEventCountByLocation {
key id : String(255); // location id
date : Date;
sender : Association to one
BusinessPartner.BusinessPartner;
location : Association to one Location.Location;
pos : String(255);
processCount : Integer;
unplannedCount : Integer;
};
};

CoreServices.cds

namespace com.sap.gtt.core;
using com.sap.gtt.core.CoreModel;
using sap.appcore.cs.i.CoreTypes;
using sap.appcore.bp.p.BusinessPartner as bp;
using sap.appcore.loc.p.Location as loc;
using sap.appcore.prod.p.Product as prod;
context CoreServices {
@abstract context TrackedProcessService {
extend entity CoreModel.Event with {
@TimeZoneInfo.toLocalString: {
UTCTimestamp: actualBusinessTimestampUTC,
TimeZone: actualBusinessTimeZone
}
actualBusinessTimestampUTC_text : String(255)
@Common.FieldControl: #Hidden;
};
entity Event as projection on CoreModel.Event excluding {
tenant
};
entity GTTOverdueEvent as projection on CoreModel.GTTOverdueEvent
excluding {
tenant,
plannedEvent
};
entity GTTResetPlannedEventStatusEvent as projection on
CoreModel.GTTResetPlannedEventStatusEvent excluding {
tenant
};
entity HierarchyNode as projection on CoreModel.HierarchyNode;
entity ObjectReference as projection on CoreModel.ObjectReference {
*,
event : redirected to Event
};
entity GTTPersonalDataBlockingEvent as projection on
CoreModel.GTTPersonalDataBlockingEvent excluding {
tenant
};

Creating and Deploying GTT Models


62 PUBLIC Modeling Language Guide
entity GTTPersonalDataDeletionEvent as projection on
CoreModel.GTTPersonalDataDeletionEvent excluding {
tenant
};
entity QualifiedTrackingId as projection on
CoreModel.QualifiedTrackingId;
entity BusinessPartner as projection on bp.BusinessPartner excluding {
tenant
};
entity Location as projection on loc.Location excluding {
tenant
};
entity GTIN as projection on prod.GTIN;
entity Product as projection on prod.Product excluding {
tenant
};
// Helper entities for ValueLists
entity TimeZone as projection on CoreModel.TimeZone;
entity EventStatus as projection on CoreModel.EventStatus;
entity PersonalDataProtectionStatus as projection on
CoreModel.PersonalDataProtectionStatus;
entity EventAction as projection on CoreModel.EventAction;
extend entity CoreModel.TrackedProcess with actions {
// Report Unplanned Event
action ReportUnplannedEvent (
eventType : CoreModel.EventType not null
@title: '{@i18n>com.sap.gtt.core.Event}' @Common.FieldControl:#Mandatory
@ValueList: {type: #fixed, entity: 'EventFilteredDescription'},
eventReasonText : CoreModel.EventReasonText @title:
'{@i18n>com.sap.gtt.core.Reason}' @Common.FieldControl:#Optional,
@Common: {
ValueList: {
Label: '{@i18n>com.sap.gtt.core.Locations}',
CollectionPath: 'Location',
SearchSupported: false,
Parameters: [
{
$Type: 'Common.ValueListParameterInOut',
ValueListProperty: 'locationId',
LocalDataProperty: 'locationlocationId',
},
{
$Type: 'Common.ValueListParameterOut',
ValueListProperty: 'description',
LocalDataProperty: 'locationDescription',
}
]
}
}
locationDescription : CoreTypes.Description
@title: '{@i18n>com.sap.gtt.core.Location}' @Common.FieldControl:#Optional,
locationlocationId : CoreTypes.Uuid
@Common.FieldControl:#Hidden, // Location UUID
actualBusinessTimestamp : Timestamp not null @title:
'{@i18n>com.sap.gtt.core.Actual_Business_Time}' @Common.FieldControl:#Mandatory,
@Common: {
FieldControl: #Mandatory,
Text: actualBusinessTimeZone,
TextArrangement: #TextLast, // formatted as "Asia/Shanghai -
China Time (UTC+08:00)"
ValueListWithFixedValues: true,
ValueList: {
Label: '{@i18n>com.sap.gtt.core.Time_Zones}',
CollectionPath: 'TimeZone',
SearchSupported: false,
Parameters: [
{
$Type: 'Common.ValueListParameterInOut',

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 63
ValueListProperty: 'timeZoneCode',
LocalDataProperty: 'actualBusinessTimeZone',
},
{
$Type: 'Common.ValueListParameterDisplayOnly',
ValueListProperty: 'description'
}
]
}
}
actualBusinessTimeZone : String not null @title:
'{@i18n>com.sap.gtt.core.Actual_Business_Time_Zone}'
) returns String;
};
extend entity CoreModel.ProcessEventDirectory with {
// planned business time & date
@TimeZoneInfo.toLocalString: {
UTCTimestamp: plannedBusinessTimestampUTC,
TimeZone: plannedBusinessTimeZone
}
plannedBusinessTimestampUTC_text : String(255)
@Common.FieldControl: #Hidden;
// @TimeZoneInfo.toLocalString: {
// UTCTimestamp: plannedBizTsEarliestUTC,
// TimeZone: plannedBusinessTimeZone
// }
// plannedBizTsEarliestUTC_text : String(255)
@Common.FieldControl: #Hidden;
// @TimeZoneInfo.toLocalString: {
// UTCTimestamp: plannedBizTsLatestUTC,
// TimeZone: plannedBusinessTimeZone
// }
// plannedBizTsLatestUTC_text : String(255)
@Common.FieldControl: #Hidden;
// Actual Event Data
@TimeZoneInfo.toLocalString: {
UTCTimestamp: actualBusinessTimestampUTC,
TimeZone: actualBusinessTimeZone
}
actualBusinessTimestampUTC_text : String(255)
@Common.FieldControl: #Hidden;
@TimeZoneInfo.toLocalTime: {
UTCTimestamp: actualBusinessTimestampUTC,
TimeZone: actualBusinessTimeZone
}
actualBusinessTimestamp : Timestamp
@Common.FieldControl: #Hidden; // fake timestamp for the date time picker in
report event UI
};
entity ProcessEventDirectory as projection on
CoreModel.ProcessEventDirectory {
*,
event : redirected to GTTEPCISAggregationEvent
} excluding {
tenant,
// planned technical time & date
plannedTechTsEarliestUTC,
// planned business time & date
plannedBizTsEarliestUTC,
plannedBizTsLatestUTC
};
extend entity ProcessEventDirectory with actions {
// Report Planned Event
@sap.applicable.path: 'to_eventStatus/EditEnabled'
action EditEvent (
@Common.Text: to_eventType.Text
eventTypeText : String @title:
'{@i18n>com.sap.gtt.core.Event}' @Common.FieldControl:#ReadOnly,

Creating and Deploying GTT Models


64 PUBLIC Modeling Language Guide
eventType : CoreModel.EventType not
null @Common.FieldControl:#Hidden,
@Common.Text: location.description
locationDescription : CoreTypes.Description
@title: '{@i18n>com.sap.gtt.core.Location}' @Common.FieldControl:#ReadOnly,
locationlocationId : CoreTypes.Uuid
@Common.FieldControl:#Hidden, // Location UUID
plannedBusinessTimestampUTC_text : String @title:
'{@i18n>com.sap.gtt.core.Planned_Business_Time}' @Common.FieldControl:#ReadOnly,
actualBusinessTimestamp : Timestamp not null @title:
'{@i18n>com.sap.gtt.core.Actual_Business_Time}' @Common.FieldControl:#Mandatory,
@Common: {
FieldControl: #Mandatory,
Text: actualBusinessTimeZone.description,
TextArrangement: #TextLast, // formatted as "Asia/Shanghai -
China Time (UTC+08:00)"
ValueListWithFixedValues: true,
ValueList: {
Label: '{@i18n>com.sap.gtt.core.Time_Zones}',
CollectionPath: 'TimeZone',
SearchSupported: false,
Parameters: [
{
$Type: 'Common.ValueListParameterInOut',
ValueListProperty: 'timeZoneCode',
LocalDataProperty:
'actualBusinessTimeZonetimeZoneCode',
},
{
$Type: 'Common.ValueListParameterDisplayOnly',
ValueListProperty: 'description'
}
]
}
}
actualBusinessTimeZonetimeZoneCode : String not null
) returns String;
};
entity ObserverAddDeleteByBusSysKey as projection on
CoreModel.ObserverAddDeleteByBusSysKey{
*,
event : redirected to Event
};
//
// Entities for Value Lists
//
entity EventDescription {
key Code : String(255) @title:
'{@i18n>com.sap.gtt.core.Event}' @Common: { Text: Text, TextArrangement:
#TextOnly };
Text : String(255) @title:
'{@i18n>com.sap.gtt.core.Description}';
};
entity EventFilteredDescription : EventDescription {};
//
// Entities for map function
//
entity ProcessLocation as projection on CoreModel.ProcessLocation;
entity CurrentProcessLocation as projection on
CoreModel.CurrentProcessLocation;
entity ProcessRoute as projection on CoreModel.ProcessRoute;
//
// Entities for EPCIS
//
entity EPC as projection on CoreModel.EPC {
*,
event : redirected to Event
};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 65
entity BusinessTransaction as projection on
CoreModel.BusinessTransaction {
*,
event : redirected to Event
};
entity Source as projection on CoreModel.Source {
*,
event : redirected to Event
};
entity Destination as projection on CoreModel.Destination {
*,
event : redirected to Event
};
entity GTTEPCISObjectEvent as projection on
CoreModel.GTTEPCISObjectEvent excluding {
tenant
};
entity GTTEPCISAggregationEvent as projection on
CoreModel.GTTEPCISAggregationEvent excluding {
tenant
};
entity GTTEPCISTransactionEvent as projection on
CoreModel.GTTEPCISTransactionEvent excluding {
tenant
};
// Entities for Value Lists
entity BusinessStep as projection on CoreModel.BusinessStep;
entity Disposition as projection on CoreModel.Disposition;
entity BusinessTransactionType as projection on
CoreModel.BusinessTransactionType;
entity SourceDestType as projection on CoreModel.SourceDestType;
//
// Entities for analytics
//
entity ProcessCountByDay as projection on CoreModel.ProcessCountByDay;
entity ProcessCountBySender as projection on
CoreModel.ProcessCountBySender;
entity UnplannedEventCountByProcess as projection on
CoreModel.UnplannedEventCountByProcess;
entity LocationProcess as projection on CoreModel.LocationProcess;
entity UnplannedEventCountByLocation as projection on
CoreModel.UnplannedEventCountByLocation;
};
};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for Event
//
annotate CoreModel.Event with @(
// Header-level Annotations
Common.FilterExpressionRestrictions: [
{
Property: actualBusinessTimestampUTC,
AllowedExpressions: #SingleInterval,
}
],
UI.HeaderInfo: {
TypeName: '{@i18n>com.sap.gtt.core.Event}',
TypeNamePlural: '{@i18n>com.sap.gtt.core.Events}',
Title: {Value: to_eventType.Text},
},
UI.Identification: [
{Value: eventType},
],
UI.SelectionFields: [
eventType
],
Capabilities: {

Creating and Deploying GTT Models


66 PUBLIC Modeling Language Guide
Insertable: false,
Updatable: false,
Deletable: false,
FilterRestrictions: {
NonFilterableProperties: [
to_action,
]
},
SortRestrictions: {
NonSortableProperties: [
]
},
SearchRestrictions: {
Searchable: false
},
},
) {
// Element-level Annotations
@Common.Text: actualBusinessTimestampUTC_text
@Common.TextArrangement: #TextOnly
actualBusinessTimestampUTC;
action @ValueList:{type:#fixed, entity:'EventAction'};
};
// Line Items for Lists
annotate CoreModel.Event with @(
UI.PresentationVariant: {
Visualizations: [
'@UI.LineItem'
],
SortOrder: [
],
RequestAtLeast: [
],
},
UI.LineItem: [
{Value: eventType},
{Value: eventReasonText},
{Value: location},
{Value: actualBusinessTimestampUTC},
{Value: CreatedByUser},
{Value: processingTimestampUTC},
]
);
// Facets for Object Page
annotate CoreModel.Event with @(
UI.HeaderFacets: [
{$Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#SenderInfo'},
{$Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#TrackingInfo'},
],
UI.Facets: [
{
$Type: 'UI.CollectionFacet',
ID: 'DetailInfo',
Label: '{@i18n>com.sap.gtt.core.Detailed_Information}',
Facets: [
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#GeneralInfo'},
{$Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#AdminData'},
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#CustomData'},
]
},
],
UI.FieldGroup#SenderInfo: {
Label: '{@i18n>com.sap.gtt.core.Sender}',
Data: [
{$Type: 'UI.DataFieldForAnnotation', Label:
'{@i18n>com.sap.gtt.core.Sender}', Target: 'sender/@Communication.Contact'},

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 67
{Value: logicalSenderSystem},
]
},
UI.FieldGroup#TrackingInfo: {
Label: '{@i18n>com.sap.gtt.core.Tracking_ID}',
Data: [
{Value: trackingId},
{Value: trackingIdType},
]
},
UI.FieldGroup#GeneralInfo: {
Label: '{@i18n>com.sap.gtt.core.General}',
Data: [
{Value: action},
{Value: location},
{Value: actualBusinessTimestampUTC},
{Value: eventReasonText},
]
},
UI.FieldGroup#AdminData: {
Label: '{@i18n>com.sap.gtt.core.Administrative_Data}',
Data: [
{$Type: 'UI.DataFieldForAnnotation', Label:
'{@i18n>com.sap.gtt.core.Event_Sender}', Target: 'senderParty/
@Communication.Contact'},
{Value: CreatedByUser},
{Value: processingTimestampUTC},
]
}
);
annotate CoreModel.EventType with @ValueList: {type: #fixed, entity:
'EventDescription'};
// EPC Event Object Page
annotate CoreModel.GTTEPCISEvent with @(
UI.HeaderFacets: [
{
$Type: 'UI.ReferenceFacet',
Target: '@UI.FieldGroup#TrackingInfo'
},
],
UI.Facets: [
{
$Type: 'UI.CollectionFacet',
ID: 'EventInfoSection',
Label: '{@i18n>com.sap.gtt.core.Event_Information}',
Facets: [
{
$Type: 'UI.CollectionFacet',
Id: 'BasicInfoSection',
Label: '{@i18n>com.sap.gtt.core.Basic_Information}',
Facets: [
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#BasicInfo'},
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#CustomData'},
]
}
]
}
],
UI.FieldGroup#BasicInfo: {
Label: '{@i18n>com.sap.gtt.core.General}',
Data: [
{Value: action},
{Value: eventTime},
{Value: bizStep},
{Value: disposition},
{Value: readPoint},

Creating and Deploying GTT Models


68 PUBLIC Modeling Language Guide
{Value: bizLocation}
]
}
);
annotate CoreModel.BusinessTransaction with @(
Capabilities: {
Insertable: false,
Updatable: false,
Deletable: false,
SearchRestrictions: {
Searchable: false
}
},
UI.LineItem#BizTransList: [
{ Value: type },
{ Value: bizTransaction }
]
) {
type @ValueList: {type: #fixed, entity: 'BusinessTransactionType'};
};
annotate CoreModel.Source with @(
Capabilities: {
Insertable: false,
Updatable: false,
Deletable: false,
SearchRestrictions: {
Searchable: false
}
},
UI.LineItem#SourceList: [
{ Value: type },
{ Value: source }
]
) {
type @ValueList: {type: #fixed, entity: 'SourceDestType'};
};
annotate CoreModel.Destination with @(
Capabilities: {
Insertable: false,
Updatable: false,
Deletable: false,
SearchRestrictions: {
Searchable: false
}
},
UI.LineItem#DestinationList: [
{ Value: type },
{ Value: destination }
]
) {
type @ValueList: {type: #fixed, entity: 'SourceDestType'};
};
annotate CoreModel.BusinessStepID with @ValueList: {type: #fixed, entity:
'BusinessStep'};
annotate CoreModel.DispositionID with @ValueList: {type: #fixed, entity:
'Disposition'};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for TrackedProcess
//
annotate CoreModel.TrackedProcess with @(
UI.Identification: [
{Value: altKey},
],
UI.PresentationVariant: {
Visualizations: [
'@UI.LineItem'
],

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 69
SortOrder: [
],
RequestAtLeast: [
altKey,
],
},
Capabilities: {
Insertable: false, Updatable: false, Deletable: false,
FilterRestrictions: {
NonFilterableProperties: [
to_personalDataProtectionStatus,
]
},
SortRestrictions: {
NonSortableProperties: [
senderbusinessPartnerID,
]
},
SearchRestrictions: {
Searchable: false
}
},
) {
personalDataProtectionStatus @ValueList:{type:#fixed,
entity:'PersonalDataProtectionStatus'};
};
annotate CoreServices.TrackedProcessService.QualifiedTrackingId with {
trackedProcess @odata.navigable:false;
};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for ProcessEventDirectory
//
annotate CoreServices.TrackedProcessService.ProcessEventDirectory with @(
// Header-level Annotations
Common.FilterExpressionRestrictions: [
{
Property: plannedBusinessTimestampUTC,
AllowedExpressions: #SingleInterval,
},
{
Property: actualBusinessTimestampUTC,
AllowedExpressions: #SingleInterval,
}
],
UI.HeaderInfo: {
TypeName: '{@i18n>com.sap.gtt.core.Event}',
TypeNamePlural: '{@i18n>com.sap.gtt.core.Events}',
Title: {Value: to_eventType.Text},
},
UI.Identification: [
{Value: eventType},
],
UI.SelectionFields: [
eventType,
eventStatus
],
Capabilities: {
Insertable: false, Updatable: false, Deletable: false,
FilterRestrictions: {
NonFilterableProperties: [
locationlocationId, // FIXME: use association only
plannedTechnicalTimestampUTC,
plannedBusinessTimestampUTC,
actualTechnicalTimestampUTC,
actualBusinessTimestampUTC,
processingTimestampUTC,
]

Creating and Deploying GTT Models


70 PUBLIC Modeling Language Guide
},
SortRestrictions: {
NonSortableProperties: [
locationlocationId, // FIXME: use association only
]
},
SearchRestrictions: {
Searchable: false
},
},
) {
// Element-level Annotations
process @Common.FieldControl:#Hidden @odata.navigable:false; //> I think we
need to keep that --> should check later
processEventDirectoryId @Common.FieldControl:#Hidden;
event @Common.FieldControl:#Hidden;
eventType @title:'{@i18n>com.sap.gtt.core.Event}' @readonly;
eventStatus @Common.FieldControl:#ReadOnly @ValueList:{type:#fixed,
entity:'EventStatus'};
@Common.Text: plannedBusinessTimestampUTC_text
@Common.TextArrangement: #TextOnly
plannedBusinessTimestampUTC;
// plannedBizTsEarliestUTC @Common.FieldControl:#Hidden;
// plannedBizTsLatestUTC @Common.FieldControl:#Hidden;
plannedBusinessTimeZone @Common.FieldControl:#Hidden;
@Common.Text: actualBusinessTimestampUTC_text
@Common.TextArrangement: #TextOnly
actualBusinessTimestampUTC;
actualBusinessTimeZone @Common.FieldControl:#Hidden;
actualBusinessTimestamp @Common.FieldControl:#Hidden;
// Note: in addition, @title is inherited for all from data model
};
// Line Items for Lists
annotate CoreServices.TrackedProcessService.ProcessEventDirectory with @(
UI.PresentationVariant: {
Visualizations: [
],
SortOrder: [
{Property: sequence, Descending: false}
],
RequestAtLeast: [
sequence,
eventType,
to_eventType.Text,
to_eventStatus.EditEnabled,
location.description,
event.id,
event.locationDescription,
actualBusinessTimestamp,
actualBusinessTimestampUTC,
actualBusinessTimeZonetimeZoneCode,
],
},
UI.LineItem: [
{Value: eventType},
{Value: eventStatus, Criticality: to_eventStatus.Criticality,
CriticalityRepresentation: #WithIcon},
{Value: eventReasonText},
{Value: location},
{Value: plannedBusinessTimestampUTC},
{Value: actualBusinessTimestampUTC},
],
UI.LineItem#GenericEvents: [
{Value: eventType},
{Value: eventStatus, Criticality: to_eventStatus.Criticality,
CriticalityRepresentation: #WithIcon},
{Value: eventReasonText},
{Value: location},

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 71
{Value: plannedBusinessTimestampUTC},
{Value: actualBusinessTimestampUTC},
{Value: CreatedByUser},
{Value: processingTimestampUTC},
],
UI.LineItem#EpcisEvents: [
{Value: event.action},
{Value: event.eventTime},
{Value: event.bizStep},
{Value: event.disposition},
{Value: event.readPoint},
{Value: event.bizLocation},
],
);
// Facets for Object Page
annotate CoreServices.TrackedProcessService.ProcessEventDirectory with @(
UI.HeaderFacets: [
{$Type: 'UI.ReferenceFacet', Target: '@UI.DataPoint#EventStatus'},
],
UI.DataPoint#EventStatus: {
Value: eventStatus,
Title: '{@i18n>com.sap.gtt.core.Event_Status}',
Criticality: to_eventStatus.Criticality,
},
UI.Facets: [
{
$Type: 'UI.CollectionFacet',
ID: 'DetailInfo',
Label: '{@i18n>com.sap.gtt.core.Detailed_Information}',
Facets: [
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#GeneralInfo'},
{$Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#TimeInfo'},
]
},
],
UI.FieldGroup#GeneralInfo: {
Label: '{@i18n>com.sap.gtt.core.General}',
Data: [
{Value: location},
{Value: eventReasonText},
]
},
UI.FieldGroup#TimeInfo: {
Label: '{@i18n>com.sap.gtt.core.Time}',
Data: [
{Value: plannedBusinessTimestampUTC},
{Value: plannedTechnicalTimestampUTC},
]
}
);
////////////////////////////////////////////////////////////////////////////
//
// Annotations for BusinessPartner
//
// @title: '{@i18n>com.sap.gtt.core.Business_Partners}'
annotate CoreServices.TrackedProcessService.BusinessPartner with @(
UI.Identification: [
{Value: organizationName1},
{Value: streetName},
{Value: postalCode},
{Value: landlinePhoneNumber},
], //> Collection of UI.DataField w/ PropertyValue
Communication.Contact: {
fn: organizationName1,
adr: [{
label: 'Address',
street: streetName,

Creating and Deploying GTT Models


72 PUBLIC Modeling Language Guide
locality: cityName,
region: regionDescription,
country: countryDescription,
code: postalCode,
}],
tel: [{
type: #work,
uri: landlinePhoneNumber,
}, {
type: #cell,
uri: mobilePhoneNumber,
}],
email: [{
type: #work,
address: emailAddress,
}],
//url: [{
// type: #work,
// uri: Website,
//}],
},
Communication.Address: {
label: 'Address',
street: streetName,
locality: cityName,
region: regionDescription,
country: countryDescription,
code: postalCode,
},
) {
businessPartnerID @title:'{@i18n>com.sap.gtt.core.ID}' @Common: {
FieldControl: #Hidden,
Text: organizationName1,
TextArrangement: #TextOnly
};
organizationName1 @title:'{@i18n>com.sap.gtt.core.Name}';
organizationName2 @Common.FieldControl:#Hidden;
emailAddress @title: '{@i18n>com.sap.gtt.core.Email}'
@Common.FieldControl:#Hidden;
landlinePhoneNumber @title: '{@i18n>com.sap.gtt.core.Phone}';
mobilePhoneNumber @title: '{@i18n>com.sap.gtt.core.Mobile}';
houseNumber @title:'{@i18n>com.sap.gtt.core.House_Number}';
streetName @title:'{@i18n>com.sap.gtt.core.Street}';
cityName @title:'{@i18n>com.sap.gtt.core.City}';
region @Common.FieldControl:#Hidden;
regionDescription @title:'{@i18n>com.sap.gtt.core.Region}';
country @Common.FieldControl:#Hidden;
countryDescription @title:'{@i18n>com.sap.gtt.core.Country}';
postalCode @title:'{@i18n>com.sap.gtt.core.Postal_Code}';
longitude @title:'{@i18n>com.sap.gtt.core.Longitude}'
@Common.FieldControl:#Hidden;
latitude @title:'{@i18n>com.sap.gtt.core.Latitude}'
@Common.FieldControl:#Hidden;
objectGroup @Common.FieldControl:#Hidden;
};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for Location
//
// @title: '{@i18n>com.sap.gtt.core.Locations}'
annotate CoreServices.TrackedProcessService.Location with @(
UI.Identification: [
{Value: description},
{Value: locationId},
], //> Collection of UI.DataField w/ PropertyValue
Communication.Contact: {
fn: description,
},

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 73
/*Communication.Address: {
label: 'Address',
street: LocationData_streetName,
locality: LocationData_cityName,
region: LocationData_regionDescription,
country: LocationData_countryDescription,
code: LocationData_postalCode,
}*/
) {
locationId @Common.FieldControl:#Hidden @Common:{Text: description,
TextArrangement: #TextOnly};
description @title: '{@i18n>com.sap.gtt.core.Description}';
};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for Product
//
// @title: '{@i18n>com.sap.gtt.core.Product}'
annotate CoreServices.TrackedProcessService.Product with @(
UI.Identification: [
{Value: description},
],
) {
productId @Common.FieldControl:#Hidden @Common:{Text: description,
TextArrangement: #TextOnly};
};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for HierarchyNode
//
annotate CoreServices.TrackedProcessService.HierarchyNode with @(
Capabilities: {
Insertable: false, Updatable: false, Deletable: false,
SearchRestrictions: {
Searchable: false
},
},
) {
// Element-level Annotations
process @Common.FieldControl:#Hidden;
parent @Common.FieldControl:#Hidden;
hierarchyLevel @Common.FieldControl:#Hidden;
drillState @Common.FieldControl:#Hidden;
validFrom @Common.FieldControl:#Hidden;
validTo @Common.FieldControl:#Hidden;
};

CoreTypes.cds

namespace sap.appcore.cs.i;
context CoreTypes {
type Uuid : String(50);
type Name : String(255);
type Description : String(255); //Description, usually in
language depenant "text" tables
// business partner and location types
/*--type Geolocation : hana.ST_GEOMETRY(4326); **/
type LocationID : Uuid;
type BusinessPartnerID : Uuid;
type Boolean : Integer; // 0 = false, 1 = true
// Tenant field to be used in all transaction and master data tables
// Check table: sap.appcore.cs.p::Tenant
type Tenant : String(36);
type TenantStatus : String(1);
// ISO-2 language code to be used in all language dependent tables
// Check table: sap.appcore.cs.p::Language
type Language : String(2);

Creating and Deploying GTT Models


74 PUBLIC Modeling Language Guide
// user admin data to be used in all tables where audit trail information
is required
type SystemAdminData {
CreatedByUser : String(64);
CreationDateTime : Timestamp;
LastChangedByUser : String(64);
LastChangeDateTime : Timestamp;
};
};

CoreAnnotations.cds

annotation title : String;


annotation important : Boolean;
annotation Criticality : UI.CriticalityType;
annotation EditEnabled : Boolean;
context odata {
annotation entitySet : String;
annotation foreignKey : String;
annotation foreignKey4 : String;
annotation navigable : Boolean;
};
type PropertyPath : String;
type AnnotationPath : String;
// property value
context PropertyValue {
annotation source : String; // full qualified name of the source entity, or
property name of the source association
annotation sourceType : String enum {
Entity = 'Entity';
Association = 'Association';
};
annotation outSourceProperty : String; // output property in source
annotation parameters : array of {
inSourceProperty : String; // input property in source
localDataProperty : String; // input property in this entity
};
};
// Computed Property
context ComputedProperty {
context formatValue {
annotation Conditions : array of {
Left : PropertyPath;
Operator : UI.SelectionRangeOptionType;
Right : PropertyPath;
Result: PropertyPath;
};
annotation Default: PropertyPath;
};
};
// Time Zone
context TimeZoneInfo {
annotation TimeZone : PropertyPath;
context toLocalString {
annotation UTCTimestamp : PropertyPath;
annotation TimeZone : PropertyPath;
};
context toLocalTime {
annotation UTCTimestamp : PropertyPath;
annotation TimeZone : PropertyPath;
};
};
// UI extension
context UIExt {
context GeoMap {
annotation FacetID : String;
};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 75
context Hierarchy {
annotation FacetID : String;
};
};
// SAP Annotations for OData Version 2.0
// See: https://wiki.scn.sap.com/wiki/display/EmTech/SAP+Annotations+for+OData
+Version+2.0
// ----------------------------------------------------------------------
context sap {
context semantics {
annotation UnitOfMeasure : Boolean;
annotation TimeZone : Boolean;
};
context applicable {
annotation path : String;
};
};
// Org.OData.Core.V1
// ----------------------------------------------------------------------
context Core {
annotation Immutable : Boolean;
};
// Org.OData.Measures.V1
// ----------------------------------------------------------------------
context Measures {
annotation Unit : String;
};
// Org.OData.Capabilities.V1
// ----------------------------------------------------------------------
context Capabilities {
annotation FilterRestrictions : FilterRestrictionsType;
type FilterRestrictionsType {
NonFilterableProperties : array of PropertyPath;
};
annotation SortRestrictions : SortRestrictionsType;
type SortRestrictionsType {
NonSortableProperties : array of PropertyPath;
};
annotation SearchRestrictions : SearchRestrictionsType;
type SearchRestrictionsType {
Searchable : Boolean;
};
annotation InsertRestrictions : InsertRestrictionsType;
type InsertRestrictionsType {
Insertable : Boolean;
};
annotation UpdateRestrictions : UpdateRestrictionsType;
type UpdateRestrictionsType {
Updatable : Boolean;
};
annotation DeleteRestrictions : DeleteRestrictionsType;
type DeleteRestrictionsType {
Deletable : Boolean;
};
};
// com.sap.vocabularies.Common.v1
// ----------------------------------------------------------------------
context Common {
annotation Label : String;
annotation Text : String;
annotation SemanticObject : String;
annotation FilterExpressionRestrictions : array of
FilterExpressionRestrictionType;
type FilterExpressionRestrictionType {
Property : PropertyPath;
AllowedExpressions : FilterExpressionType;
};
type FilterExpressionType : String enum {

Creating and Deploying GTT Models


76 PUBLIC Modeling Language Guide
SingleValue = 'SingleValue';
MultiValue = 'MultiValue';
SingleInterval = 'SingleInterval';
};
annotation FieldControl : FieldControlType;
type FieldControlType : Integer enum {
Mandatory = 7;
Optional = 3;
ReadOnly = 1;
Inapplicable = 0;
Hidden = 0;
};
annotation ValueList : ValueListType;
type ValueListType {
Label : String;
CollectionPath : String not null;
SearchSupported : Boolean;
Parameters : array of ValueListParameter;
};
annotation ValueListWithFixedValues : Boolean;
type ValueListParameter {
$Type : String enum {
ValueListParameterInOut = 'Common.ValueListParameterInOut';
ValueListParameterIn = 'Common.ValueListParameterIn';
ValueListParameterOut = 'Common.ValueListParameterOut';
ValueListParameterDisplayOnly =
'Common.ValueListParameterDisplayOnly';
ValueListParameterFilterOnly = 'Common.ValueListParameterFilterOnly';
};
ValueListProperty : String;
};
type ValueListParameterIn : ValueListParameter {
LocalDataProperty : PropertyPath;
};
type ValueListParameterInOut : ValueListParameter {
LocalDataProperty : PropertyPath;
};
type ValueListParameterOut : ValueListParameter {
LocalDataProperty : PropertyPath;
};
type ValueListParameterDisplayOnly : ValueListParameter;
type ValueListParameterFilterOnly : ValueListParameter;
annotation SemanticKey : array of PropertyPath;
annotation SortOrder : array of SortOrderType;
type SortOrderType {
Property : PropertyPath;
Descending : Boolean;
};
};
// com.sap.vocabularies.Communication.v1
// ----------------------------------------------------------------------
context Communication {
annotation Contact : ContactType;
type ContactType {
fn : String;
adr : array of AddressType;
tel : array of PhoneNumberType;
email : array of EmailAddressType;
};
annotation Address : AddressType;
type AddressType {
street : String;
locality : String;
region : String;
code : String;
country : String;
label : String;
type : ContactInformationType;

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 77
};
type PhoneNumberType {
uri : String;
type : PhoneType;
};
type EmailAddressType {
address : String;
type : ContactInformationType;
};
type ContactInformationType : Integer enum {
work = 1;
home = 2;
preferred = 4;
};
type PhoneType : Integer enum {
work = 1;
home = 2;
preferred = 4;
voice = 8;
cell = 16;
fax = 32;
video = 64;
};
};
// com.sap.vocabularies.UI.v1
// ----------------------------------------------------------------------
context UI {
type DataFieldAbstract : {
$Type : String enum {
DataField = 'UI.DataField';
DataFieldForAnnotation = 'UI.DataFieldForAnnotation';
DataFieldForAction = 'UI.DataFieldForAction';
DataFieldForIntentBasedNavigation =
'UI.DataFieldForIntentBasedNavigation';
DataFieldWithAction = 'UI.DataFieldWithAction';
DataFieldWithIntentBasedNavigation =
'UI.DataFieldWithIntentBasedNavigation';
DataFieldWithNavigationPath = 'UI.DataFieldWithNavigationPath';
DataFieldWithUrl = 'UI.DataFieldWithUrl';
};
Label : String;
Criticality : CriticalityType;
CriticalityRepresentation : CriticalityRepresentationType;
};
type CriticalityType : Integer enum {
Neutral = 0;
Negative = 1;
Critical = 2;
Positive = 3;
};
type CriticalityRepresentationType : String enum {
WithIcon = 'WithIcon';
WithoutIcon = 'WithoutIcon';
};
type SelectionRangeOptionType : String enum {
EQ = 'EQ'; // Equal to
BT = 'BT'; // Between
CP = 'CP'; // Contains pattern
LE = 'LE'; // Less then or equal to
GE = 'GE'; // Greater than or equal to
NE = 'NE'; // Not equal to
NP = 'NP'; // Does not contain pattern
GT = 'GT'; // Greater than
LT = 'LT'; // Less than
};
annotation TextArrangement : TextArrangementType;
type TextArrangementType : String enum {
TextFirst = 'TextFirst';

Creating and Deploying GTT Models


78 PUBLIC Modeling Language Guide
TextLast = 'TextLast';
TextSeparate = 'TextSeparate';
TextOnly = 'TextOnly';
};
annotation Importance : ImportanceType;
type ImportanceType : String enum {
High = 'High';
Medium = 'Medium';
Low = 'Low';
};
type DataField : DataFieldAbstract {
Value : PropertyPath;
};
type DataFieldForAnnotation : DataFieldAbstract {
Target : AnnotationPath;
};
type DataFieldWithUrl : DataField {
Url : String;
};
annotation HeaderInfo : HeaderInfoType;
type HeaderInfoType {
TypeName : String not null;
TypeNamePlural : String not null;
Title : DataField not null;
Description : DataField;
};
annotation Identification : array of DataFieldAbstract;
annotation LineItem : array of DataFieldAbstract;
annotation SelectionFields : array of PropertyPath;
annotation FieldGroup : FieldGroupType;
type FieldGroupType {
ID : String;
Label : String;
Data : array of DataFieldAbstract;
};
annotation DataPoint : DataPointType;
type DataPointType {
Title : String;
Description : String;
Value : PropertyPath;
Criticality : CriticalityType;
};
annotation Facets : array of Facet;
annotation HeaderFacets : array of Facet;
type Facet {
$Type : String enum {
ReferenceFacet = 'UI.ReferenceFacet';
CollectionFacet = 'UI.CollectionFacet';
};
ID : String;
Label : String;
};
type CollectionFacet : Facet {
Facets : array of Facet;
};
type ReferenceFacet : Facet {
Target : AnnotationPath;
};
annotation PresentationVariant : PresentationVariantType;
type PresentationVariantType {
ID : String;
SortOrder : array of Common.SortOrderType;
Visualizations : array of AnnotationPath;
RequestAtLeast : array of PropertyPath;
};
};
// SAP EM
// ----------------------------------------------------------------------

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 79
context SAP_EM {
annotation applicationObjectType : String; // data element /SAPTRX/AOTYPE
context eventCode {
annotation Code : String;
annotation Text : String;
annotation Type : String;
};
annotation fieldName : String; // data element /SAPTRX/PARAMNAME
annotation itemized : Boolean; // indicates that this particular entity
covers items
annotation itemizedEntity : String; // refers to another entity that handles
items
annotation primaryTrackingIdType : String; // data element /SAPTRX/TRXCOD
};
// SAP DPP
// ----------------------------------------------------------------------
context DPP {
annotation PII : Boolean;
annotation SPI : Boolean;
annotation DataSubjectID : Boolean;
};

CoreWriteServices.cds

namespace com.sap.gtt.core;
using com.sap.gtt.core.CoreModel;
using sap.appcore.cs.i.CoreTypes;
using sap.appcore.bp.p.BusinessPartner as bp;
using sap.appcore.loc.p.Location as loc;
context CoreServices {
context TrackedProcessWriteService {
entity QualifiedTrackingId as projection on
CoreModel.QualifiedTrackingId {
altKey,
validFromUTC,
validToUTC
};
entity ProcessEventDirectory as projection on
CoreModel.ProcessEventDirectory {
eventType,
location,
plannedTechnicalTimestampUTC as plannedTechnicalTimestamp,
plannedBusinessTimestampUTC as plannedBusinessTimestamp
};
entity ObjectReference as projection on CoreModel.ObjectReference {
obsType,
objKey
};
entity ObserverAddDeleteByBusSysKey as projection on
CoreModel.ObserverAddDeleteByBusSysKey {
altKey,
validFromUTC,
validToUTC,
action
};
entity GTTResetPlannedEventStatusEvent as projection on
CoreModel.GTTResetPlannedEventStatusEventForWrite
actions {
@Swagger.POST
action GTTResetPlannedEventStatusEvent(@Swagger.parameter:
'requestBody' GTTResetPlannedEventStatusEvent: GTTResetPlannedEventStatusEvent)
returns String;
};
};
};

Creating and Deploying GTT Models


80 PUBLIC Modeling Language Guide
4.2.2.1 Core Model Data Types

This chapter describes the scalar and complex data types and entities the core model provides.

Scalar Data Types

Type Technical Type Description

LocationId UUID UUID of a location

ExternalLocationIdType String(50) The identifier type, for example, type


“geo location” or type “ERP Shipping
Point” of the following external location
ID. There is no fixed set of types.

ExternalLocationId String(40) The external identifier of the location

UnitOfMeasure String(6) Unit of measure

TimeZoneCode String(50) Code of the time zone according to


JAVA convention

ValidityStartTimestampUTC Timestamp A timestamp that denotes the begin­


ning of a validity period

ValidityEndTimestampUTC Timestamp A timestamp that denotes the end of a


validity period

LogicalSenderSystem String(10) A value that identifies a logical system


from a party that sends data to track
and trace. This could be for example the
logical system value of the table T000
in an ABAP based sender system.

TrackedProcessId UUID The UUID of a tracked process instance

TrackedProcessType String(255) The (human readable) type of a tracked


process, for example,
com.sap.gtt.app.deliverysa
mple.DeliveryProcess

EventId UUID The UUID of an actual event

EventCode String(255) The (human readable) type of an event,


for example,
com.sap.gtt.app.deliverysa
mple.GoodsIssued

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 81
Type Technical Type Description

EventSequence Integer The sequence of the event

TrackingId String(50) The external ID value of an tracking ID


(see Qualified Tracking ID in Helper Enti­
ties)

TrackingIdType String(40) The type of the tracking ID, for example,


a delivery id

EventReasonText String(255) A free text that describes the event rea­


son for a manually created event

Complex Data Types

Complex Type Description

EventQualifiedTrackingId The quadruple of sender, logical system ID, tracking ID type,


and tracking ID.

See Qualified Tracking ID in Helper Entities for details.

4.2.2.2 Main Entities

Tracked Process

Tracked process is the heart of the global track and trace option for SAP Logistics Business Network. The
abstract TrackedProcess entity as defined in the core model provides all attributes and associations that are
necessary to track a process.

This entity can be defined with the following attributes:

Attribute Technical Type Description

id (key) TrackedProcessId The UUID of the tracked process

tenant Tenant The tenant to which the tracked proc­


ess instance belongs

Creating and Deploying GTT Models


82 PUBLIC Modeling Language Guide
Attribute Technical Type Description

name Name A natural language text to name the


tracked process instance

description Description A natural language text to describe the


tracked process instance

trackedProcessType TrackedProcessType The type of the tracked process in­


stance

trackingIds Composition The set of qualified tracking IDs to re­


trieve the tracked process during event
processing

processEvents Composition The process event directory for the


tracked process instance

lastProcessEvent Association For convenience during processing the


pointer to the last processed event

CreatedByUser systemAdminData The administrative data to audit the


creation of a tracked process instance

CreationDateTime systemAdminData The administrative data to audit the


creation of a tracked process instance

LastChangedByUser systemAdminData The administrative data to audit the


change of a tracked process instance

LastChangeDateTime systemAdminData The administrative data to audit the


change of a tracked process instance

Event

Event represents any kind of business event that occurred.

 Note

There are two “sender” fields: The sender of the event message and the sender in sense of an owner of the
tracking ID. For example: A carrier sends an event for a delivery of a supplier. The sender of the event is the
carrier, the sender of the ID is the supplier.

The Event entity can be defined with the following attributes:

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 83
Attribute Technical Type Description

id (key) EventId The UUID of the event

tenant Tenant The tenant to which the event belongs

eventCode EventCode The (human readable) event code

eventType EventType The (human readable) event type

eventReasonText EventReasonText The free text that describes the event


reason.

senderParty Association The business partner who has sent the


event

logicalSenderSystem LogicalSenderSystem The logical sender system of qualified


tracking ID as quadruple (sender, logi­
cal sender system, tracking ID type,
tracking ID)

trackingIdType TrackingIdType The tracking ID type of qualified track­


ing ID

trackingId TrackingId The tracking ID of qualified tracking ID

actualTechnicalTimestampUTC Timestamp The time stamp when the event has


been received by the system

actualBusinessTimestampUTC Timestamp The time stamp when the event actually


has happened

actualBusinessTimezone Association The time zone of the time stamp above

location Association The location where the event actually


has happened

CreatedByUser SystemAdminData The user name who has created the


event. Either a technical user in case
that the event is reported via ingestion
pipeline or a real user name in case the
event was reported from the UI.

Process Event Directory

The process event directory is the link between tracked processes and events and serves two purposes:

1. List the planned events of the tracked process with plan data. Link to an actual event once the event has
happened.

Creating and Deploying GTT Models


84 PUBLIC Modeling Language Guide
2. List all unplanned events (plan data is empty in this case) that have happened to the tracked process.

From a business perspective, planned and unplanned events should be covered together in one common list.

The ProcessEventDirectory entity can be defined with the following attributes:

Attribute Technical Type Description

process (key) Association The tracked process to which the proc­


ess event directory entry belongs

processEventDirectoryId (key) UUID The unique ID of the process event di­


rectory entry

tenant Tenant The tenant to which the entry belongs

eventCode EventCode The event code of the event

eventStatus EventStatus The status of the event

eventReasonText EventReasonText A free text to describe the reason for a


manually created event

event Association The event to which the process event


directory entry belongs

sequence EventSequence The sequence of event directory

location Association The location of event directory

plannedTechnicalTimestampUTC Timestamp The planned point in time by when the


event shall be reported from technical
perspective

plannedTechTsEarliestUTC Timestamp The earliest point in time by when the


event may be reported from technical
perspective

plannedTechTsLatestUTC Timestamp The latest point in time by when the


event must have been reported from
technical perspective

plannedBusinessTimestampUTC Timestamp The planned point in time by when the


event shall happen from business per­
spective

plannedBizTsEarliestUTC Timestamp The earliest point in time by when the


event may happen from business per­
spective

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 85
Attribute Technical Type Description

plannedBizTsLatestUTC Timestamp The latest point in time by when the


event must have happened from busi­
ness perspective

plannedBusinessTimeZone Association The time zone of the three points in


time above

actualTechnicalTimestampUTC Timestamp The actual point in time by when the


event shall be reported from technical
perspective

actualBusinessTimestampUTC Timestamp The actual point in time by when the


event shall happen from business per­
spective

actualBusinessTimeZone Timestamp The time zone of the point in time


above

CreatedByUser SystemAdminData The name of the user who has created


the event. It can be either a technical
user in case that the event is reported
via ingestion pipeline or a real user
name in case the event was reported
from the UI.

processingTimestampUTC Timestamp The time when the event is created.

4.2.2.3 Master Data Entities

Master data entities are those entities that are used to describe master data including business partners,
locations, and products.

Business Partner

The BusinessPartner entity describes the business partner master data with the following attributes:

Attribute Technical Type Description

businessPartnerID (key) BusinessPartnerID The ID of the business partner

Creating and Deploying GTT Models


86 PUBLIC Modeling Language Guide
Attribute Technical Type Description

tenant String(36) The tenant to which the business part­


ner master data is released

organizationName String(255) The organization name of the business


partner

emailAddress String(255) The email address of the business part­


ner

landlinePhoneNumber String(127) The landline phone number of the busi­


ness partner

mobilePhoneNumber String(127) The mobile phone number of the busi­


ness partner

streetName String(255) The street name in the address of the


business partner

houseNumber String(10) The house number in the address of the


business partner

cityName String(255) The city name in the address of the


business partner

postalCode String(10) The postal code in the address of the


business partner

country String(2) The country/region name in the ad­


dress of the business partner

countryDescription String(60) The country/region description in the


address of the business partner

region String(3) The region name in the address of the


business partner

regionDescription String(60) The region description in the address of


the business partner

longitude String(20) The longitude in the address of the


business partner

latitude String(20) The latitude in the address of the busi­


ness partner

objectGroup String(32) The object group to which the business


partner belongs

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 87
Location

The Location entity describes the location master data with the following attributes:

Attribute Technical Type Description

locationId (key) UUID The UUID of the location

tenant String(36) The tenant to which the location master


data is released

altKey String(255) The unique identifier for the location


master data

description Description The description of the location

globalLocationNumber String(13) The global location number of the loca­


tion

streetName String(255) The street name of the location

houseNumber String(10) The house number of the location

cityName String(255) The city name of the location

district String(255) The district name of the location

postalCode String(10) The postal code of the location

country String(2) The country/region name of the loca­


tion

countryDescription String(60) The country/region description of the


location

region String(3) The region name of the location

regionDescription String(60) The region description of the location

Product

The Product entity describes the product master data with the following attributes:

Attribute Technical Type Description

productId (key) UUID The UUID of the product

Creating and Deploying GTT Models


88 PUBLIC Modeling Language Guide
Attribute Technical Type Description

tenant String(36) The tenant to which the product master


data is released

altKey String(255) The unique identifier for the product


master data

description String(255) The description of the product

productTypeId String(255) The product type ID

productTypeDescription String(255) The product type description

gitns Composition The list of GTINs (Global Trade Item


Numbers) of the product

4.2.2.4 Helper Entities

Helper entities are those entities that are not tracked processes or events, but required to be modeled as an
entity in an ERM.

Time Zone

The main use case of a TimeZone entity is a value help on the UI. This entity can be defined with the following
attributes:

Attribute Technical Type Description

timeZoneCode (key) TimeZoneCode The time zone in Java notation

description Description A textual description of the time zone.


In Java, code and description are identi­
cal.

Qualified Tracking ID

The tracking ID is not a simple value but consists of a quadruple of sender, logical system, ID type and the ID
itself. The QualifiedTrackingId entity is used to assign this quadruple together with a validity period to a
tracked process. The tracking ID that uniquely identifies the tracked process is the primary ID.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 89
 Note

Often we do not distinguish between the qualified tracking ID (quadruple) and the tracking ID (scalar
value), but in most cases we mean by “tracking ID” actually the “qualified tracking ID”.

The QualifiedTrackingId entity can be defined with the following attributes:

Attribute Technical Type Description

trackedProcess (key) Association The tracked process to which the track­


ing ID belongs

sender (key) Description The business partner (owner) of the


tracking ID

logicalSenderSystem (key) LogicalSenderSystem The ID owner’s system of origin of the


tracking ID

trackingIdType (key) TrackingIdType The type of the tracking ID defined by


the sender

trackingId (key) TrackingId The tracking ID itself

validFromUTC ValidityStartTimestampUTC The start time stamp of the period in


which the qualified tracking ID is valid
for the process

validToUTC ValidityEndTimestampUTC The end time stamp of the period in


which the qualified tracking ID is valid
for the process

primaryId Boolean True if the tracking ID uniquely identi­


fies the tracked process. This value is
defined by the first sender of the
tracked process. The validity period has
no meaning if this flag is set.

Event Status

The EventStatus entity is a helper entity to allow value help in user interfaces and assign properties to an
event status that can be used in reporting. This entity can be defined with the following attributes:

Attribute Technical Type Description

Code (key) String(10) The event code

Creating and Deploying GTT Models


90 PUBLIC Modeling Language Guide
Attribute Technical Type Description

Text String(50) A textual UI relevant description of the


event code

Criticality Integer16 Defines the criticality of the event sta­


tus

EditEnabled Boolean True if the even status can be changed

4.2.2.5 Annotations

Annotations are a powerful concept within CDS to extend a metadata model definition with additional
metadata to control behavior of consumers of the metadata model. The core model defines the following
annotations that are used by the core engine.

In principle, each CDS element can be annotated. However annotations fulfill a certain purpose and hence can
only be used for certain elements defined by annotations scope.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 91
Annotation Scope Technical Type Description

ObjectIdentifierType Attribute String(255) Describes for an external ID


what the ID originally descri­
bed. Used in context of in­
bound processing for mes­
sages coming from an SAP
ERP system.

Admissible values for busi­


ness partner are as follows:

● customer
● vendor
● businessPartner
● others

Admissible values for loca­


tion are as follows:

● customerLocation
● vendorLocation
● businessPartner
● shippingPoint
● plant

If location is needed in events


and event messages, this an­
notation must be defined on
location of event, for exam­
ple, annotate
DelayedEvent with {

location
@CoreModel.ObjectId
entifierType:
#customerLocation;

};

UsageType Entity String(255) Describes the main purpose


of an entity as follows:

● inboundMessage
● userInterface
● search
● searchResult

MainEntity Entity Boolean Defines the main entity of a


service definition that is
shown as separate tile in the
Fiori Launchpad emulation.

Creating and Deploying GTT Models


92 PUBLIC Modeling Language Guide
Annotation Scope Technical Type Description

BaseType Entity String(255) Describes the base type of an


entity as follows:

● TrackedProcess
● BusinessPartner
● Location

SAP_EM The set of annotations within


SAP_EM that refers to the in­
tegration of the global track
and trace option for SAP
Logistics Business Network
with SAP Event Management.

.primaryTrackingIdType Entity String(20) The type of the primary


tracking ID as passed from
SAP Event Management. If
this annotation is not set, the
application Object Type is
used as primary Tracking ID
Type. There must be only one
entity annotated with the
same primary Tracking ID
Type within one tenant.

.applicationObjectType Entity String(20) Creates the link between a


track and trace entity
(tracked process) and the
application object type re­
ceived from SAP Event Man­
agement. There must be only
one entity annotated with the
same application object
name that is not itemized
within one tenant.

.fieldName Attribute String(32) Defines for an attribute from


which parameter in the mes­
sage the attribute is filled.

.eventCode Entity String(20) Creates the link between an


SAP EM event code and the
event entity. Note that the
event code must be unique
within one tenant.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 93
Annotation Scope Technical Type Description

.itemized Entity Boolean Indicates whether the entity


is itemized. In this case, the
indexed parameters of the
SAP EM message are evalu­
ated and each set with same
index maps into the same in­
stance.

.itemizedEntity Attribute String(255) Defines for an attribute of an


entity that this attribute is
not a scalar value but an as­
sociation which might be
contained in the message
payload as well. This eases to
find from the entity all item­
ized sub-entities like the de­
livery items of a delivery.

KeepStatusSequence Attribute Boolean A status field of an entity


might be associated with
‘true’. In this case, an event
does only change the status
field when the new status is
logically after the old status.
For example: A delivery is
picked, issued and com­
pleted. If for technical rea­
sons the picking event is be­
ing reported after the proof
of delivery, the status “deliv­
ered” remains.

UpdateStatus Entity Array of An array of new status values


that are set when an event
happens. The ingestion
checks for each affected
tracked process whether the
given type matches and the
status attribute exists and
sets the status new under
consideration of the order.

.pathToStatus String(255) The full path (entity type


name + status attribute) of
the status to be updated.

.newValue String(255) The new status value.

Creating and Deploying GTT Models


94 PUBLIC Modeling Language Guide
Annotation Scope Technical Type Description

StatusProperties Entity Array of String(255) The status fields of an entity.


These must not be set by any
message call other than
event inbound processing.

Planned Events Entity Array of The initial list of planned


events once the tracked
process is being instantiated.
Each entry consists of four
fields.

.eventCode EventCode The event code of the plan­


ned event. Note that the
event code must be unique
within one tenant.

.matchLocation Boolean An indicator whether an ac­


tual event matches the plan­
ned event only in case when
the locations match as well.

.technicalToleranceValue String(50) A tolerance window that de­


fines a time window around
the planned technical time
stamp in which the actual
event is considered to be
“not a delay.” This value is
given as time stamp period
presentation like P[JY]
[MM][WW][TD][T[hH]
[mM][s[.f]S]] accord­
ing to ISO 8601.

.businessToleranceValue String(50) A tolerance window that de­


fines a time window around
the planned business time
stamp in which the actual
event is considered to be
“not a delay.” This value is
given as time stamp period
presentation like P[JY]
[MM][WW][TD][T[hH]
[mM][s[.f]S]] accord­
ing to ISO 8601.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 95
Annotation Scope Technical Type Description

.periodicOverdueDetection String(50) A value that defines the pe­


riod of overdue detection.

You don't need to set a value


for it. The period is always 24
hours, no matter which value
you set it to.

.maxOverdueDetection Integer The maximum number of


times that overdue events
are triggered for this event
type.

You don't need to set a value


for it. The maximum number
is always 3, no matter which
value you set it to.

AdmissibleUnplannedEvents Entity Array of EventCode A list of admissible unplan­


ned events, i.e. events that
are allowed to be reported
and that can be handled
somehow in the tracked
process.

ManuallyReportableUnplan­ Entity Array of EventType A list of unplanned events


nedEvents which can be manually re­
ported on the UI. If this anno­
tation is not defined, all event
types in
@CoreModel.AdmissibleU
nplannedEvents can be re­
ported manually on UI.

Creating and Deploying GTT Models


96 PUBLIC Modeling Language Guide
Annotation Scope Technical Type Description

DPP Marks an attribute as rele­


vant to Data Protection and
Privacy.

Notes:

● DPP annotations can


only be used on header-
level attributes of the
tracked process entity.
Otherwise an error oc­
curs when the model is
compiled.
● Once a model with DPP
annotations is deployed,
you cannot remove the
existing DPP annota­
tions and redeploy the
model.

.PII Attribute Boolean Marks an attribute as Per­


sonally Identifiable Informa­
tion, also known as personal
data. The personal data
change log includes all attrib­
utes marked with this anno­
tation.

.SPI Attribute Boolean Marks an attribute as Sensi­


tive Personal Information,
also known as sensitive per­
sonal data. The personal data
change log and read access
log include all attributes
marked with this annotation.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 97
Annotation Scope Technical Type Description

.DataSubjectID Attribute Boolean Marks an attribute as the


data subject ID.

Notes:

● @DPP.DataSubjectID
can only be used on an
attribute that is an email
address.
● An attribute annotated
with
@DPP.DataSubjectID
must also be annotated
with @DPP.PII.
● If @DPP.PII@DPP.SPI
is used in a model, the
model must have one
and only one or
@DPP.DataSubjectID.

4.2.2.6 Core Model Service

The core model service exposes the following entities and can be extended by applications. For all entities any
kind of tenant information is being excluded.

● Event
● ProcessEventDirectory
The location ID of planned location is included.
With additional action EditEvent
● QualifiedTrackingId
● BusinessPartner
● Location
● TimeZone
● EventStatus
● TrackedProcess
With additional action ReportUnplannedEvent

4.2.3 UI Annotations

To be able to use SAP Fiori Elements as generic UI to display tracked processes and events, a special set of
annotations is required to control the UI layout.

Creating and Deploying GTT Models


98 PUBLIC Modeling Language Guide
 Note

More about SAP Fiori Elements can be found at https://experience.sap.com/fiori-design-web/smart-


templates/ .

In the following we provide the subset of SAP Fiori Elements annotations that are currently supported by the
global track and trace option for SAP Logistics Business Network.

As shown in the Overall Structure section, we have annotations for the core engine and for applications
leveraging the core engine. Both are mixed together during runtime.

Related Information

Overall Structure [page 42]

4.2.3.1 UI Structure

For each tracked process type defined in applications we use overview pages and object pages of SAP Fiori
Elements. The overview page shows a list of all tracked processes with filter capabilities, and the object page
shows the details of one tracked process instance with a list of events.

The following shows an example of the overview page.

The following shows an example of the object page.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 99
4.2.3.2 Overview Page

Annotations on Tracked Process Types

To get the overview page rendered we have to use the following annotations for the tracked process type. As we
annotate in a separate file than the service definition, we use the following CDS syntax to define the UI layout.

annotate <TrackedProcess> with @( <annotations> )

Creating and Deploying GTT Models


100 PUBLIC Modeling Language Guide
The following annotations are allowed:

Common
The common block defines overall behavior for the overview page and contains the following attributes:

● Common.Label
Defines the label for the overview page, for example, a natural language term for the tracked processes like
“Delivery”.
CDS Annotation Definition:

Common: {
Label: 'Delivery'
}

● Common.SemanticKey
An array of field names as defined in the annotated service that describe the semantic key of the tracked
process (for example: ‘deliveryId’).
CDS Annotation Definition:

Common: {
SemanticKey: [
deliveryId,
]
}

These fields are rendered as bold style in the list report table.

● Common. FilterExpressionRestrictions
An array of tuples has the following two fields:
○ Property
○ AllowedExpressions
Where Property denotes a field name as defined in the annotated service and AllowedExpressions defines
how a filter can be entered. The global track and trace option for SAP Logistics Business Network currently
allows only the value #SingleInterval for date type fields.
CDS Annotation Definition:

Common: {
FilterExpressionRestrictions: [

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 101
{
Property: deliveryDate,
AllowedExpressions: #SingleInterval,
},
{
Property: loadingDate,
AllowedExpressions: #SingleInterval,
},
{
Property: transPlanDate,
AllowedExpressions: #SingleInterval,
}
],
}

UI
The UI block defines how the overview page looks like. The following attributes are allowed:

● UI.Identification
List of field names as defined in the annotated service that uniquely identify the tracked object. Usually this
is the same list as specified for Common.SemanticKey.
CDS Annotation Definition:

UI: {
Identification: [
{Value: deliveryId}
]
}

● UI.HeaderInfo
Defines how the header of the overview page looks like. The following attributes are possible.
CDS Annotation Definition:

UI: {
HeaderInfo: {
TypeName: 'Delivery',
TypeNamePlural: 'Deliveries',
Title: {
Label: 'Outbound Delivery',
Value: deliveryId
},
Description: {
Label: 'Track Outbound Delivery',
Value: description
}
}
}

● UI.HeaderInfo.TypeName
The name of the tracked process type in singular form (for example: “Delivery””)
● UI.HeaderInfo.TypeNamePlural
The name of the tracked process type in plural form (for example: “Deliveries”)

Creating and Deploying GTT Models


102 PUBLIC Modeling Language Guide
● UI.HeaderInfo.Title
A tuple of Label and Value that defines the title of the object page for one particular tracked process
instance.

● UI.HeaderInfo.Description
A tuple of Label and Value that defines the description of the object page for one particular tracked process
instance. The description is rendered beside the title.
● UI.SelectionFields
A list of field names as defined in the annotated service that are initially visible in the filters bar.
CDS Annotation Definition:

UI {
SelectionFields: [
deliveryId,
sender,
salesOrganization,
deliveryDate,
deliveryStatus,
shippingStatus
]
}

● UI.PresentationVariant
Defines how the result is displayed in the table. Currently the global track and trace option for SAP
Logistics Business Network only allows SortOrder, which is a list of sort criteria for the default sorting.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 103
CDS Annotation Definition:

UI {
PresentationVariant: {
SortOrder: [
{Property: deliveryId, Descending: true},
{Property: deliveryDate, Descending: true},
]
}
}

The above example defines the initial sorting by 'deliveryId' and 'deliveryDate` properties in descending
order.

Capabilities

The capabilities section defines overall behavior of the application. It may contain the following attributes:

● Capablities.Insertable
Capablities.Updateable
Capablities.Deleteable
These properties define whether an instance can be inserted, updated or deleted from the UI. For the
global track and trace option for SAP Logistics Business Network these values must be false.
CDS Annotation Definition:

Capabilities: {
Insertable: false,
Updatable: false,
Deletable: false,
}

● Capabilities.FilterRestrictions
Defines restrictions on the filter capabilities of the overview list. Currently the global track and trace option
for SAP Logistics Business Network only allows NonFilterableProperties, which is a list of field
names as defined in the annotated service that cannot be used as filter criteria.
CDS Annotation Definition:

Capabilities: {
FilterRestrictions: {
NonFilterableProperties: [
description,
sender,
shipToParty,
soldToParty,
shippingPoint,
to_shippingType,
to_deliveryStatus,
to_shippingStatus,
deliveryWeightUnit,
deliveryVolumeUnit,
]
}
}

Creating and Deploying GTT Models


104 PUBLIC Modeling Language Guide
● Capabilities.SortRestrictions
Defines restrictions on the sort capabilities of the overview list. Currently the global track and trace option
for SAP Logistics Business Network only allows NonSortableProperties, which is a list of field names
as defined in the annotated service that cannot be used as sort criteria.
CDS Annotation Definition:

Capabilities: {
SortRestrictions: {
NonSortableProperties: [
senderbusinessPartnerID,
shipToPartybusinessPartnerID,
soldToPartybusinessPartnerID,
shippingPointlocationId,
]
}
}

● Capabilities.SearchRestrcitions
Defines the search restrictions. Currently the global track and trace option for SAP Logistics Business
Network does not allow any search capabilities beside filtering, hence the only admissible property
Searchable must be set to false.
CDS Annotation Definition:

Capabilities: {
SearchRestrictions: {
Searchable: false
}
}

Annotations on Fields

Some fields shall be rendered in the UI in a different way that is defined by annotations. As we annotate in a
separate file than the service definition, we use the following CDS syntax to define the UI layout.

annotate <TrackedProcessUI> with { <field annotations> }

For fields, the following annotations are allowed:

● title
Defines the label for a certain field.
CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with {


deliveryId @title: 'Delivery ID';
description @title: 'Description';
};

● Common.FieldControl
Defines the appearance of the field on the UI. Currently the only supported value is #Hidden.
CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with {


id @Common.FieldControl: #Hidden;
};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 105
● ValueList
Describes how a value help for a particular field is being created. It is a tuple of type and entity.
The type describes the type of the value list. For the global track and trace option for SAP Logistics
Business Network, only #fixed is allowed. The entity names the entity that provides a value list. To query
data to display the value help, the UI requests data from that entity via OData call.
CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with {


deliveryStatus @ValueList: {type: #fixed, entity: 'DeliveryStatus'};
};

Annotations for Line Items

The overview page contains a list of all tracked processes that match the given filter criteria. The appearance of
the list needs to be defined with annotations as well.

For that, we annotate the tracked process type with a set of fields to appear in the list. We use the following
CDS syntax for this kind of annotation.

annotate <TrackedProcess> with @UI.LineItem: [ <set of fields> ]

CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with @UI.LineItem: [


{Value: deliveryId},
{Value: sender},
{Value: salesOrderId},
{Value: purchaseOrderId},
{Value: shipToParty},
{Value: salesOrganization},
{Value: deliveryDate},
{Value: loadingDate},
{Value: deliveryStatus, Criticality: to_deliveryStatus.Criticality,
CriticalityRepresentation: #WithoutIcon},
{Value: shippingStatus},
];

<set of fields> is an array of the following structure:

● Value
Is the field name as defined in the annotated service that shall appear in the list. This property is
mandatory.

Creating and Deploying GTT Models


106 PUBLIC Modeling Language Guide
● Criticality
Defines how the value is displayed. This value can either be a path to another field or a fixed value 0
(neutral, grey, default), 1 (negative, red), 2 (critical, yellow) or 3 (positive, green). This property is optional.
● CriticalityRepresentation
Defines whether an icon shall be used to display critical status or not. Supported values are
#WithoutIcon and #WithIcon. This property is optional.

4.2.3.3 Object Page

The object page is defined via facets. A facet contains a set of fields or a list of referenced entities to be
displayed. A facet is either described by a field group or by line item annotations of an associated entity.

We use the following CDS syntax to define the faces and field groups.

annotate <TrackedProcessUI> with @( ... )

The object page is structured in facets, whether for header or for the object details. Each facet hereby is a
single data point, a field group, or a set of other facets.

Annotations for Facets

UI.HeaderFacets

This contains all field groups or data points to be displayed in the header of the object page. The annotation is a
list of tuples with $Type and Target.$Type is always UI.ReferenceFacet, whereas Target is a reference to the
field group in format @UI.FieldGroup#<ID> or data point that defines the data to be show in format
@UI.DataPoint#<ID>.

CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with @(


UI.HeaderFacets: [
{$Type:'UI.ReferenceFacet', Target: '@UI.FieldGroup#SenderInfo'},
{$Type:'UI.ReferenceFacet', Target: '@UI.FieldGroup#TrackingInfo'},
{$Type:'UI.ReferenceFacet', Target: '@UI.FieldGroup#shippingStatus'},
{$Type:'UI.ReferenceFacet', Target: '@UI.DataPoint#deliveryStatus'},
]
};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 107
UI.Facets
Similar to header facets, we can define the structure of the object page.

CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with @(


UI.Facets: [
{
$Type: 'UI.CollectionFacet',
ID: 'BusinessProcess',
Label: 'Business Process',
Facets: [
{
$Type: 'UI.CollectionFacet',
ID: 'DetailInfo',
Label: 'Detailed Information',
Facets: [
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#SalesAndPurchase'},
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#ShippingInformation'},
{$Type: 'UI.ReferenceFacet', Target:
'@UI.FieldGroup#PackageDetails'},
]
},
{
$Type: 'UI.CollectionFacet', ID: 'DeliveryItems', Label:
'Delivery Items',
Facets: [
{$Type: 'UI.ReferenceFacet', Target: 'items/
@UI.LineItem'},
]
},
{
$Type: 'UI.CollectionFacet', ID: 'Events', Label: 'Event
Messages',
Facets: [
{$Type: 'UI.ReferenceFacet', Target: 'processEvents/
@UI.LineItem#GenericEvents'},
]
}
]
},
]
};

UI.Facets are an array of structure with the following fields and can be nested.

● $Type
The type of the facet. If this facet contains sub facets, the type should be UI.CollectionFacet,
otherwise it is UI.ReferenceFacet. This value is mandatory.
● ID
The unique ID of the facet. This value is mandatory.
● Label
A label for the facet. This value is optional.
● Target

Creating and Deploying GTT Models


108 PUBLIC Modeling Language Guide
A field group or data point that defines the data to be shown in format @UI.FieldGroup#<ID> or line
items of an associated another entity in form of <association>/@UI.LineItem#<ID>.
● Facets
An array of facets to be included in that facet. Nesting of facets influences how field groups are displayed
on the screen. A facet must either contain a Target or another set of Facets.

● UI.FieldGroup
An ordered collection of data fields with a label for the group. It is used to represent parts of a single data
instance in a form.
CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with @(


UI.FieldGroup#SalesAndPurchase: {
Label: 'Sales and Purchase',
Data: [
{Value: salesOrderId},
{Value: purchaseOrderId},
{Value: salesOrganization},
{$Type:'UI.DataFieldForAnnotation', Label:'Ship To Party',
Target:'shipToParty/@Communication.Contact'},
{$Type:'UI.DataFieldForAnnotation', Label:'Sold To Party',
Target:'soldToParty/@Communication.Contact'},
]
},
UI.FieldGroup#ShippingInformation: {
Label: 'Shipping Information',
Data: [
{Value: shippingType},
{Value: shippingPoint},
{Value: transPlanDate},
{Value: loadingDate},
{Value: deliveryDate},
]
},
};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 109
● UI.DataPoint
Visualizes a single point of data. It is used to render a semantic color for a data field.
CDS Annotation Definition:

annotate DeliveryService.DeliveryProcess with @(


UI.DataPoint#deliveryStatus: {
Value: deliveryStatus,
Title: 'Delivery Status',
Criticality: to_deliveryStatus.Criticality
}
};

Annotations for Line Items

The annotations for line items on the object page are the same as line items on the overview page.

CDS Annotation Definition:

// Line Item for DeliveryItem


annotate DeliveryService.DeliveryItem with @UI.LineItem: [
{Value: deliveryItem},
{Value: material},
{Value: deliveryQty},
{Value: pickingQty},
];

You need to reference this UI.LineItem annotation associated another entity in UI.Facets in form of
<association>/@UI.LineItem.

annotate DeliveryService.DeliveryProcess with @(


UI.Facets: [
{
$Type: 'UI.CollectionFacet',

Creating and Deploying GTT Models


110 PUBLIC Modeling Language Guide
ID: 'BusinessProcess',
Label: 'Business Process',
Facets: [
{
$Type: 'UI.CollectionFacet', ID: 'DeliveryItems', Label:
'Delivery Items',
Facets: [
{$Type: 'UI.ReferenceFacet', Target: 'items/
@UI.LineItem'},
]
}
]
},
]
};

Object Tracking Hierarchy

In the GTT app, you can track an object which includes a hierarchy table to show packaging hierarchy of the
target object. To enable this hierarchy table, you must add relevant scripts to your metadata model. The
example below shows how to modify a model to enable an object's packaging hierarchy.

Standard Mode
First, you must display a section to show a table for holding the hierarchy property as follows.

In the EPCISUI.cds, add the below scripts under UI.Facets:

{
$Type: 'UI.ReferenceFacet',
ID: 'Hierarchy',
Label: 'Hierarchy',
Target: 'hierarchy/@UI.LineItem',
}

In the EPCISUI.cds, annotate the hierarchy property of EPCTrackedObject to enable the hierarchy
function as shown below:

hierarchy @UIExt.Hierarchy.FacetID: 'Hierarchy';

You must define the columns in the hierarchy table. In the EPCISUI.cds, add the below scripts:

annotate TrackedProcessService.HierarchyNode with @UI.LineItem: [


{
$Type: 'UI.DataFieldWithUrl',

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 111
Value: node.altKey,
Url: {
$edmJson: {
$Apply: [
'#TrackedProcess-display?id={id}',
{
$LabeledElement: {
$Path: 'nodeid'
},
$Name: 'id'
}
],
$Function: 'odata.fillUriTemplate'
}
}
},
];

4.2.4 Application Model Details

You can define metadata models in the MM app to track and trace business processes and physical objects.

When creating an application model, you can choose either of the following modes:

● Simple Mode
A simple-mode application model contains only one CDS file, which defines the tracked processes and
events for the application, as well as some basic service and UI annotations. You do not need to configure
complex UI annotations and services. These configurations are predefined and automatically applied to
your model when the model is deployed.
● Standard Mode
A standard-mode application model consists of more CDS files. This mode allows you to customize the UI
display, services, and API references for your application in separate CDS files.

Creating and Deploying GTT Models


112 PUBLIC Modeling Language Guide
4.2.4.1 Delivery Application Model

The delivery application comes with additional metadata model definition that extends the generic tracked
process definition with delivery specific fields.

Standard Mode

A standard-mode delivery application consists of four files. The details are described in the subsequent topics
in this section.

File Name Name Space Context/Service Purpose

DeliveryModel.cds com.sap.gtt.app.delivery­ DeliveryModel Defines the metadata model


sample (tracked processes and
events) for the delivery appli­
cation.

DeliveryService.cds com.sap.gtt.app.delivery­ DeliveryService Exposes the necessary enti­


sample ties as a service.

DeliveryUI.cds com.sap.gtt.app.delivery­ Not applicable Provides the UI annotations


sample for Fiori Elements of the de­
livery application.

DeliveryWriteService.cds com.sap.gtt.app.delivery­ DeliveryWriteService Exposes the necessary enti­


sample ties as a service for proc­
esses and events ingestion.

Simple Mode

A simple-mode delivery application only consists of the DeliveryModel.cds file. The model details are
similar to those for the standard mode. However, a simple-mode delivery model does not have separate service
and UI annotation files. The DeliveryModel.cds file for simple-mode delivery application also includes some
basic service and UI annotations.

The annotations for simple-mode delivery application are as follows:

Annotation Scope Technical Type Description

ShowCriticality Attribute Boolean Indicates whether the field


are visualized in color.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 113
Annotation Scope Technical Type Description

Semantickey Attribute Boolean Indicates whether the attrib­


ute is the semantic key of the
tracked process.

SortOrder Entity Defines sort order.

.ByField String Defines which attribute the


search result is sorted by.

.Descending Boolean Indicates the search result is


sorted in descending order.

SearchFields Entity Defines the fields shown on


the Overview page.

.FilterFileds Array of string Defines which fields are ini­


tially visible in the Filters bar.

.ResultFileds Array of string Defines which fields are ini­


tially visible in the search re­
sult table.

LayoutGroups Entity Array of A collection of data fields


with a group name and label
for each group.

.GroupName String Defines the name of the


group.

.Label String Defines the label of the


group.

.Data Array of string Defines the data fields con­


tained in the group.

LayoutFacets Entity Array of Defines how the facets are


structured in Details page.

.Header Array of string Defines which layout groups


are shown in the header area.
This field is mandatory.

.Main Array of string Defines which layout groups


are shown in the details area.
This field is mandatory.

Creating and Deploying GTT Models


114 PUBLIC Modeling Language Guide
Annotation Scope Technical Type Description

.Sublists Array of string Defines which association at­


tributes are shown. This field
is optional. A tracked process
can contain no sub-list.

.ShowFacetLabel Controls whether the labels


on the object details page
should be displayed or not.
The default is False.

SublistFields Entity Array of Defines which fields are visi­


ble in the sub-list.

.SublistName Array of string Indicates the sub-list to be


configured.

.Data Array of String Defines the data fields con­


tained in the sub-list.

MapEnabled Entity Boolean Indicates whether map views


are enabled in the GTT app.

MapEnabled.DisplayOnOb­ Entity Boolean Indicates whether a map


jectPage view is enabled on process'
details page.

When this is enabled, users


can click the Map tab to
check the map view for the
target process.

Map.CurrentProcessLocation Attribute Defines current process loca­


tion.

.Longitude Boolean Marks this field as the longi­


tude of the current process
location.

.Latitude Boolean Marks this field as the lati­


tude of the current process
location.

.UpdateTimestamp Boolean Marks this field as the update


timestamp for the current
process location.

.Data supports three formats:

1. If it is a normal filed, it should be defined similarly with: Data: [fieldName]


2. If it is shown as a contact card, it should be defined similarly with:

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 115
Data: [{Type:'UI.DataFieldForAnnotation', Label:'Label Name', Target:
fieldName /@Communication.Contact'}
3. If it is shown as a hyperlink, it should be defined similarly with:
Data: [{$Type:'UI.DataFieldWithUrl',Target: filedName, URL: '#TrackedProcess-
display?model=com.sap.gtt.app.deliverysample&deliveryId={ filedName }' }]

4.2.4.1.1 Application Specific Data Types

The delivery application defines some application specific data types.

Scalar Data Types

Type Technical Type Description

DocumentNumber String(10) The document number of the delivery


as defined in SAP ERP system

CustomPONumber String(20) The number of the customer purchase


orders as stored in the SAP ERP system

ShippingStatusCode String(50) The shipping status of the delivery as


defined in SAP ERP system. Admissible
values are as follows:

● notStarted = '01'
● pickingCompleted = '02'
● goodsIssued = '03'
● proofOfDelivery = '04'

DeliveryStatusCode String(2) The delivery status of the delivery as


defined in SAP ERP system. Admissible
values are as follows:

● onTime = '01'
● delayed = '02'

Creating and Deploying GTT Models


116 PUBLIC Modeling Language Guide
Type Technical Type Description

ShippingTypeCode String(20) The shipping type as defined in an ERP


system. Admissible values are as fol­
lows:

● truck = '01'
● mail = '02'
● train = '03'
● ship = '04'
● airplane = '05'
● driverUnload = 'DU'
● liftgate = 'LG'
● ltl = 'LT'
● multimodal = 'MM'
● nextDayAir = 'P1'
● secondDayAir = 'P2'
● ground = 'P3'
● truckVSWM = 'WM'

4.2.4.1.2 Helper Entities

Helper entities within the delivery application serve mainly for value lists.

Shipping Status

Attribute Technical Type Description

Code (key) ShippingStatusCode The code of the shipping status

Text String(50) The text of the shipping status

Delivery Status

Attribute Technical Type Description

Code (key) DeliveryStatusCode The code of the delivery status

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 117
Attribute Technical Type Description

Text String(50) The text of the delivery status

Criticality Integer16 The criticality of a status value

Shipping Type

Attribute Technical Type Description

Code (key) ShippingTypeCode The code of the shipping type

Text String(50) The text of the shipping type

4.2.4.1.3 Business Entities

Delivery Items

The delivery application tracks deliveries originated in SAP ERP systems.

Attribute Technical Type Description

delivery (key) Association The delivery process to which the items


belong

deliveryItem (key) String(6) The position number of the delivery


item

distributionChannel String(255) The distribution channel

plant String(4) The plant

storageLocation Association The location where the item is stored

material String(40) The material code

deliveryQty Decimal(13,2) The quantity to be delivered

pickingQty Decimal(13,2) The picked quantity

Creating and Deploying GTT Models


118 PUBLIC Modeling Language Guide
Attribute Technical Type Description

deliveryQtyUnit UnitOfMeasure The unit of measure of the two quanti­


ties above

4.2.4.1.4 Tracked Process "Delivery Process"

The delivery process is the major entity of the delivery application. It extends the abstract tracked process as
defined in the core engine.

Technically, BaseDeliveryProcess, which includes delivery specific fields, is firstly defined.


DeliveryProcess inherits both CoreModel.TrackedProcess and BaseDeliveryProcess, so that it
includes both the fields from core process and the delivery specific fields. This BaseDeliveryProcess is also
used for DeliveryProcessForWrite and AllTrackedProcessForDeliveryProcess.

entity DeliveryProcess : CoreModel.TrackedProcess, BaseDeliveryProcess{};

General Data

Entity name: DeliveryProcess

Namespace: com.sap.gtt.app.delivery.sample

Context: Delivery

Type: extends CoreModel.TrackedProcessInstance

Description: The entity is used for data modeling of a delivery process

Attributes

Attribute Technical Type Description

deliveryId DocumentNumber The ID of the delivery document as re­


ceived from the ERP system of the sup­
plier

salesOrderId DocumentNumber The ID of the corresponding sales order


document as received from the suppli­
er’s ERP system

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 119
Attribute Technical Type Description

shipToParty Association The business partner who receives the


delivery

soldToParty Association The business partner who pays for the


delivered goods

salesOrganization String(4) Internal sales organization of the sup­


plier

deliveryDate Date The date by when the delivery shall


happen

loadingDate Date The date when the delivery is being


loaded (for example, handed to the car­
rier)

transPlanDate Date The date by when the transportation is


finished

shippingPoint Association The location where the delivery is ship­


ped to

deliveryWeight Decimal(15,3) The gross weight of the delivery

deliveryNetWeight Decimal(15,3) The net weight of the delivery

deliveryWeightUnit UnitOfMeasure The unit of the above two values

deliveryVolume Decimal(15,3) The volume of the delivery

deliveryVolumeUnit UnitOfMeasure The unit of the above value

shippingType ShippingTypeCode The kind of how the delivery is being


shipped

purchaseOrderId CustomerPONumber The ID of the purchase order document


of the corresponding ERP system of the
customer

numberOfPackages Integer The number of packages of which the


delivery consists

DeliveryStatus DeliveryStatusCode The current status of the delivery

ShippingStatus ShippingStatusCode The current status of the shipment

items Association The items of the delivery as separated


entity

Creating and Deploying GTT Models


120 PUBLIC Modeling Language Guide
Annotations

The delivery process is annotated with

@CoreModel.PlannedEvents

List of planned events for the delivery process that consists of the following:

● PickingCompletedEvent (match location, technical tolerance window 2 hours, business tolerance value 1
hour)
● GoodsIssuedEvent (does not match location, technical tolerance window 1 day, business tolerance value 1
hour)
● ProofOfDeliveryEvent (does not match location, technical tolerance window 1 minute, business tolerance
value 1 hour)

@CoreModel. AdmissibleUnplannedEvents

List of the following admissible unplanned events:

● DelayedEvent

@CoreModel.StatusProperties

List of the following status attributes that must not be passed via any message:

● shippingStatus
● deliveryStatus

4.2.4.1.5 Events

The following events are defined for the delivery application as extension to the generic event as defined in the
core model. None of the events have event specific attributes, only annotations.

Similar with the delivery process, a base version for each event is firstly defined and both the core event and
base version event are inherited by each event.

entity PickingCompletedEvent : CoreModel.Event, BasePickingCompletedEvent{};

PickingCompletedEvent

@SAP_EM.eventCode

Code: PICK_COMPL

Type: PLANNED

@CoreModel.UpdateStatus

Field: DeliveryProcess.shippingStatus

New value: 02

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 121
GoodsIssuedEvent

@SAP_EM.eventCode

Code: GI

Type: PLANNED

@CoreModel.UpdateStatus

Field: DeliveryProcess.shippingStatus

New value: 03

ProofOfDeliveryEvent

@SAP_EM.eventCode

Code: POD

Type: PLANNED

@CoreModel.UpdateStatus

Field: DeliveryProcess.shippingStatus

New value: 04

DelayedEvent

@SAP_EM.eventCode

Code: DELAY

Type: UPLANNED

@CoreModel.UpdateStatus

Field: DeliveryProcess.deliveryStatus

New value: 02

4.2.4.1.6 Entities for Inbound Processing

Within the delivery metadata model we have defined entities for inbound processing.

Creating and Deploying GTT Models


122 PUBLIC Modeling Language Guide
Delivery Process Inbound

Entity name: DeliveryProcessInbound

Namespace: com.sap.gtt.app.deliverysample

Context: Delivery

Type: projection on Delivery.DeliveryProcess

Description: The entity is used for data mapping during processing of generic messages sent by SAP Event
Management

Annotations

Attribute Value Description

@CoreModel.UsageType inboundMessage Entity is used for inbound processing of


generic message interface

@SAP_EM.applicationObjectType OBP10_DELIV The entity is used for this application


object type

@SAP_EM.primaryTrackingIdType DEL_NO The type of the primary tracking ID


(value is passed in field applicationOb­
jectID within the message)

Attributes

Attribute @SAP_EM.fieldname Remarks

deliveryId DEL_NO

salesOrderId SO_NO

shipToParty SHIP_TO_PARTY objectIdentifierType: 'customer'

soldToParty SOLD_TO_PARTY objectIdentifierType: 'customer'

salesOrganization SALES_ORGANIZATION

deliveryDate DELIVERY_DATE

loadingDate LOADING_DATE

transPlanDate TRANS_PLAN_DATE

shippingPoint SHIPPING_POINT

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 123
Attribute @SAP_EM.fieldname Remarks

deliveryNetWeight DELIVERY_NET_WEIGHT

deliveryWeightUnit DELIVERY_WEIGHT_UNIT

deliveryVolume DELIVERY_VOLUME

deliveryVolumeUnit DELIVERY_VOLUME_UNIT

shippingType SHIPPING_TYPE

numberOfPackages NO_OF_PACKAGES

purchaseOrderId PO_NO

deliveryWeight DELIVERY_WEIGHT

items itemizedEntity: 'DeliveryProcessItemIn­


bound'

Delivery Process Item Inbound

Entity name: DeliveryProcessItemInbound

Namespace: com.sap.gtt.app.deliverysample

Context: Delivery

Type: projection on Delivery.DeliveryProcessItem

Description: The entity is used for data mapping during processing of generic messages sent by SAP Event
Management

Annotations

Attribute Value Description

@CoreModel.UsageType inboundMessage Entity is used for inbound processing of


generic message interface

@SAP_EM.applicationObjectType OBP10_DELIV The entity is used for this application


object type

Creating and Deploying GTT Models


124 PUBLIC Modeling Language Guide
Attribute Value Description

@SAP_EM.itemized true The entity maps against indexed pa­


rameters from the generic SAP EM in­
bound message

Attributes

Attribute @SAP_EM.fieldname Remarks

deliveryItem DELIVERY_ITEM

plant PLANT

storageLocation STORAGE_LOC

material MATERIAL

deliveryQty DELIVERY_QTY

qtyUnit QUANTITY_UNIT

pickingQty PICKING_QTY

distributionChannel DISTRIBUTION_CHANNEL

4.2.4.1.7 Delivery Application Service

The delivery application service extends the core service and exposes in addition the following entities:

Entity Description

DeliveryProcess UI specific projection of the delivery process defined in deliv­


ery metadata model

DeliveryItem UI specific projection of delivery item defined in delivery


metadata model

DeliveryStatus Projection of the corresponding entities in delivery metadata


model. Main purpose is the provisioning of value helps.
Shipping Status

ShippingType

EventDescription Newly defined entity to provide value help for events with
code and description

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 125
Extension from Core Service

The application service is extended from the core service. For example, DeliveryService.cds is defined as
follows:

namespace com.sap.gtt.app.deliverysample;
using com.sap.gtt.app.deliverysample.DeliveryModel from "DeliveryModel";
using com.sap.gtt.core.CoreServices.TrackedProcessService from "CoreServices";
using com.sap.gtt.core.CoreModel from "CoreModel";
service DeliveryService @extends: TrackedProcessService {
@CoreModel.UsageType: #userInterface
@CoreModel.MainEntity: true
entity DeliveryProcess as projection on DeliveryModel.DeliveryProcess {
*,
shippingPoint.locationId as shippingPoint @title:'Shipping Point',
items : redirected to DeliveryItem,
trackingIds : redirected to TrackedProcessService.QualifiedTrackingId,
sender : redirected to TrackedProcessService.BusinessPartner,
processEvents : redirected to TrackedProcessService.ProcessEventDirectory,
shipToParty : redirected to TrackedProcessService.BusinessPartner,
soldToParty : redirected to TrackedProcessService.BusinessPartner
} excluding {
tenant, name, trackedProcessType, trackingIds,
lastProcessedEvent,
CreatedByUser, CreationDateTime,
LastChangedByUser, LastChangeDateTime
};
}

The following are some important restrictions to be considered when you want to extend your application
service from the core service.

● The "using ... from ..." statements must be written in the order from top to bottom of the models.
You must import high level models before low level models. The models ordered from top down are:
1. DeliveryUI
2. DeliveryService
3. DeliveryModel
4. CoreServices
5. CoreModel
6. CoreType
● You must use the syntax "@extends:" to extend your application service from the core service. This is a
special syntax sugar feature which is only supported for application service models in the global track and
trace option for SAP Logistics Business Network.
● You must use the annotation "@CoreModel.MainEntity: true" on the entity which needs to be
displayed in the application UI. For example, "DeliveryProcess" entity in the Delivery Application
Service.

4.2.4.1.8 Delivery Application UI Annotations

The UI annotation file contains the layout definition for delivery processes within SAP Fiori Elements.

The following shows a full example CDS code for Delivery UI annotations. For annotation definition details, see
the previous "UI Annotations" section.

Creating and Deploying GTT Models


126 PUBLIC Modeling Language Guide
Example

An example annotation for a delivery looks like the following:

annotate DeliveryService.DeliveryProcess with @(


Common: {
Label: 'Delivery',
SemanticKey: [ deliveryId ],
FilterExpressionRestrictions: [{
Property: deliveryDate,
AllowedExpressions: #SingleInterval,
},{
Property: loadingDate,
AllowedExpressions: #SingleInterval,
},{
Property: transPlanDate,
AllowedExpressions: #SingleInterval,
}],
},
UI: {
Identification: [
deliveryId,
],
HeaderInfo: {
TypeName:'Delivery',
TypeNamePlural:'Deliveries',
Title: {
Label: 'Outbound Delivery',
Value: deliveryId
},
Description: {
Label: 'Track Outbound Delivery',
Value: description
}
},
SelectionFields: [
deliveryId,
sender,
salesOrganization,
deliveryDate,
deliveryStatus,
shippingStatus
],
PresentationVariant: {
SortOrder: [
{$Record: [
{$PropertyValue: {Property: 'Property', PropertyPath:
'deliveryId'}},
{$PropertyValue: {Property: 'Descending', Bool: true}}
]}
]
},
},
Capabilities: {
Insertable:false, Updatable:false, Deletable:false,
FilterRestrictions: {
NonFilterableProperties: [
description,
sender,
shipToParty,
soldToParty,
shippingPoint,
to_shippingType,
to_deliveryStatus,
to_shippingStatus,
deliveryWeightUnit,
deliveryVolumeUnit,
]

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 127
},
SortRestrictions: {
NonSortableProperties: [
]
},
SearchRestrictions: {
Searchable: false
}
},
//readonly, // => this sets Common.Immutable to all its properties
) {
id @title:'ID' @Common.FieldControl:#Hidden;
description @title: 'Description';
sender @Common.ValueList.SearchSupported:false;
shipToParty @important @Common.SemanticObject:'BusinessPartner'
@Common.ValueList.SearchSupported:false;
soldToParty @important @Common.SemanticObject:'BusinessPartner'
@Common.ValueList.SearchSupported:false;
};
// Line Items for Lists
annotate DeliveryService.DeliveryProcess with @UI.LineItem: [
deliveryId,
sender,
salesOrderId,
purchaseOrderId,
shipToParty,
salesOrganization,
deliveryDate,
loadingDate,
{Value:deliveryStatus, Criticality:to_deliveryStatus.Criticality,
CriticalityRepresentation:#WithoutIcon},
shippingStatus,
];
// Facets for Object Page
annotate DeliveryService.DeliveryProcess with @(
UI.HeaderFacets: [
{ Type:'UI.ReferenceFacet', Target: '@UI.FieldGroup#SenderInfo' },
{ Type:'UI.ReferenceFacet', Target: '@UI.FieldGroup#TrackingInfo' },
{ Type:'UI.ReferenceFacet', Target: '@UI.FieldGroup#shippingStatus' },
{ Type:'UI.ReferenceFacet', Target: '@UI.DataPoint#deliveryStatus' },
],
UI.FieldGroup#SenderInfo: {
Label: 'Sender',
Data: [
sender,
logicalSenderSystem,
]
},
UI.FieldGroup#TrackingInfo: {
Label: 'Tracking ID',
Data: [
trackingId,
trackingIdType,
]
},
UI.FieldGroup#shippingStatus: {
Data: [
shippingStatus,
]
},
UI.DataPoint#deliveryStatus: {
Value:deliveryStatus,
Title:'Delivery Status',
Criticality:to_deliveryStatus.Criticality
},
UI.FieldGroup#SalesAndPurchase: {
Label: 'Sales and Purchase',
Data: [

Creating and Deploying GTT Models


128 PUBLIC Modeling Language Guide
salesOrderId,
purchaseOrderId,
salesOrganization,
{Type:'UI.DataFieldForAnnotation', Label:'Ship To Party',
Target:'shipToParty/@Communication.Contact'},
{Type:'UI.DataFieldForAnnotation', Label:'Sold To Party',
Target:'soldToParty/@Communication.Contact'},
]
},
UI.FieldGroup#ShippingInformation: {
Label: 'Shipping Information',
Data: [
shippingType,
shippingPoint,
transPlanDate,
loadingDate,
deliveryDate,
]
},
UI.FieldGroup#PackageDetails: {
Label: 'Package Details',
Data: [
numberOfPackages,
deliveryVolume,
deliveryWeight,
deliveryNetWeight,
]
},
UI.Facets: [
{
Type: 'UI.CollectionFacet',
ID: 'BusinessProcess',
Label: 'Business Process',
Facets: [
{
Type: 'UI.CollectionFacet',
ID: 'DetailInfo',
Label: 'Detailed Information',
Facets: [
{ Type:'UI.ReferenceFacet', Target:
'@UI.FieldGroup#SalesAndPurchase' },
{ Type:'UI.ReferenceFacet', Target:
'@UI.FieldGroup#ShippingInformation' },
{ Type:'UI.ReferenceFacet', Target:
'@UI.FieldGroup#PackageDetails' },
]
},
{
Type:'UI.CollectionFacet', ID:'DeliveryItems',
Label:'Delivery Items',
Facets: [
{ Type:'UI.ReferenceFacet', Target: 'items/
@UI.LineItem' },
]
},
{
Type:'UI.CollectionFacet', ID:'Events', Label:'Event
Messages',
Facets: [
{ Type:'UI.ReferenceFacet', Target: 'processEvents/
@UI.LineItem#GenericEvents' },
]
}
]
}
]
);
annotate DeliveryService.DeliveryProcess with {

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 129
deliveryStatus @ValueList:{ type:#fixed, entity:'DeliveryStatus' };
shippingStatus @ValueList:{ type:#fixed, entity:'ShippingStatus' };
shippingType @ValueList:{ type:#fixed, entity:'ShippingType' };
};
////////////////////////////////////////////////////////////////////////////
//
// Annotations for DeliveryItem
//
annotate DeliveryService.DeliveryItem with @(
Capabilities: {
Insertable:false, Updatable:false, Deletable:false,
FilterRestrictions: {
NonFilterableProperties: [
deliveryItem,
distributionChannel,
plant,
storageLocation,
material,
deliveryQty,
pickingQty,
]
},
SortRestrictions: {
NonSortableProperties: [
deliveryItem,
distributionChannel,
plant,
storageLocation,
material,
deliveryQty,
pickingQty,
]
},
},
) {
// Element-level Annotations
delivery @Common.FieldControl:#Hidden;
qtyUnit @Common.FieldControl:#Hidden;
};
// Line Item for DeliveryItems
annotate DeliveryService.DeliveryItem with @UI.LineItem: [
deliveryItem,
material,
deliveryQty,
pickingQty
];

Related Information

UI Annotations [page 98]

4.2.4.1.9 Delivery Application Write Service

Write service is used to expose APIs from your GTT models. You can view these APIs are shown in the Model
Management App. The delivery application write service extends core write service. The following examples
show you how to define write service for simple-mode and standard-mode delivery models.

Creating and Deploying GTT Models


130 PUBLIC Modeling Language Guide
Simple Mode

In the DeliveryModel.cds file, define a write version of process and event for each tracked process and
event. For example:

entity DeliveryProcessForWrite : CoreModel.TrackedProcessForWrite,


BaseDeliveryProcess{};
entity PickingCompletedEventForWrite : CoreModel.EventForWrite,
BasePickingCompletedEvent{};

BaseDeliveryProcess and BasePickingCompletedEvent include the process specific fields and event
specific fields respectively. You may check the Outbound Delivery template model in the MM app for details.

Standard Mode

For a standard-mode model, define write service as follows:

● In DeliveryModel.cds, define a write version of process and event for each tracked process and event.
For example:

entity DeliveryProcessForWrite : CoreModel.TrackedProcessForWrite,


BaseDeliveryProcess{};
entity PickingCompletedEventForWrite : CoreModel.EventForWrite,
BasePickingCompletedEvent{};

BaseDeliveryProcess and BasePickingCompletedEvent include the process specific fields and


event specific fields respectively.
● In DeliveryWriteService, each process and event should project on the write version of process and
event, and an action with the @Swagger.POST annotation should be added to each. The model
deployment process generates a swagger specification file that describes the APIs for process and events
ingestion. For example:

entity DeliveryProcess as projection on DeliveryModel.DeliveryProcessForWrite


actions {
@Swagger.POST
action deliveryProcess(@Swagger.parameter: 'requestBody' deliveryProcess:
DeliveryProcess) returns String;
};

You may check the Outbound Delivery template model in the MM app for details.

4.2.4.2 Shipment Application Model

The shipment application comes with additional metadata model definition that extends the generic tracked
process definition with shipment specific fields. The definitions are similar with those in the delivery
application, which are described in the previous section.

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 131
Standard Mode

A standard-mode shipment application consists of four files.

File Name Name Space Context/Service Purpose

ShipmentModel.cds com.sap.gtt.app.shipment­ ShipmentModel Defines the metadata model


sample (tracked processes and
events) for the shipment ap­
plication.

ShipmentService.cds com.sap.gtt.app.shipment­ ShipmentService Exposes the necessary enti­


sample ties as a service.

ShipmentUI.cds com.sap.gtt.app.shipment­ Not applicable Provides the UI annotations


sample for Fiori Elements of the ship­
ment application.

ShipmentWriteService.cds com.sap.gtt.app.shipment­ ShipmentWriteService Exposes the necessary enti­


sample ties as a service for proc­
esses and events ingestion.

The shipment application


write service extends core
write service. For the process
and all the events, an action
with the @Swagger.POST an­
notation is added, so that a
swagger specification file is
generated after model de­
ployment, which describes
the APIs for process and
events ingestion. These APIs
are shown in the GTT Model
Management App.

Simple Mode

A simple-mode shipment application only consists of the ShipmentModel.cds file. The model details are
similar to those for the standard mode. However, a simple-mode shipment model does not have separate
service and UI annotation files.

Creating and Deploying GTT Models


132 PUBLIC Modeling Language Guide
4.2.4.2.1 Map-related Functions in a Shipment Process

In the GTT app, you can track one or more shipment processes on a map view on the processes list page
and/or a process' details page. The examples below show how to modify shipment template models to enable
map-related functions.

Standard Mode

Showing Map View on Process' Details Page


On a process' details page, a map view can be shown in the Map tab for monitoring shipping route, event
locations and current process location for the specific process. To enable these map-related functions on
process' details page, you must add relevant scripts to your shipment model.

Prerequisites

In the ShipmentUI.cds file, add the following scripts under UI.Facets:

{
$Type: 'UI.ReferenceFacet',
ID: 'ProcessGeoMap',
Label: '{@i18n>Map}',
}

Step 1 - Display Shipping Route on the Map

1. In the ShipmentModel.cds file, add the processRoute property to BaseShipmentProcess, as shown


below:

processRoute: Association to one CoreModel.ProcessRoute {id};

2. In the ShipmentUI.cds file, annotate currentProcessLocation of ShipmentProcess as shown


below:

@UIExt.GeoMap.DisplayOnObjectPage.FacetID: 'ProcessGeoMap'
processRoute;

Step 2 - Display Shipping Routes with Different Colors

In the ShipmentUI.cds file, annotate processRoute of ShipmentProcess as shown below:

@UIExt.GeoMap.Route.Status.Text.PropertyPath: to_deliveryStatus.Text
@UIExt.GeoMap.Route.Status.Value.PropertyPath: deliveryStatus
@UIExt.GeoMap.Route.Status.ValueList.Entity: DeliveryStatus
processRoute;

Step 3 - Display Event Locations on the Map

In the ShipmentModel.cds file, add the processLocations property to BaseShipmentProcess as shown


below:

processLocations : Association to many CoreModel.ProcessLocation on


processLocations.process = $self;

Step 4 - Display Current Process Location on the Map

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 133
In the ShipmentModel.cds file, add the currentProcessLocation, longitude, latitude and
currentLocationTimestamp properties to BaseShipmentProcess, as shown below:

currentProcessLocation: Association to one CoreModel.CurrentProcessLocation {id};


@CoreModel.Map.CurrentProcessLocation.Longitude: true
longitude: Decimal(9,6) @title: '{@i18n>Last_Reported_Longitude}';
@CoreModel.Map.CurrentProcessLocation.Latitude: true
latitude: Decimal(8,6) @title: '{@i18n>Last_Reported_Latitude}';
@CoreModel.Map.CurrentProcessLocation.UpdateTimestamp: true
currentLocationTimestamp: Timestamp @title: '{@i18n>Last_Reported_Time}';

Step 5 - Hide the Map Related Virtual Fields from UI

In the ShipmentUI.cds file, annotate processRoute and currentProcessLocation of


ShipmentProcess as shown below:

@Common.FieldControl: #Hidden
processRoute;
@Common.FieldControl: #Hidden
currentProcessLocation;

Showing Map View on Processes List Page


On the processes list page, you can click the Map View button above the list to display a map view for
monitoring shipping routes and current process locations for all processes in the list. To enable these map-
related functions on the processes list page, you must add relevant scripts to your shipment model.

Step 1 - Display Shipping Routes on the Map

1. In the ShipmentModel.cds file, add the processRoute property to BaseShipmentProcess, as shown


below:

processRoute: Association to one CoreModel.ProcessRoute {id};

2. In the ShipmentUI.cds file, annotate processRoute of ShipmentProcess as shown below:

@UIExt.GeoMap.DisplayOnListReportPage.Enabled: true
processRoute;

Step 2 - Display Shipping Routes with Different Colors

In the ShipmentUI.cds file, annotate processRoute of ShipmentProcess as shown below:

@UIExt.GeoMap.Route.Status.Text.PropertyPath: to_deliveryStatus.Text
@UIExt.GeoMap.Route.Status.Value.PropertyPath: deliveryStatus
@UIExt.GeoMap.Route.Status.ValueList.Entity: DeliveryStatus
processRoute;

Step 3 - Display Current Process Locations on the Map

In the ShipmentModel.cds file, add the currentProcessLocation, longitude, latitude and


currentLocationTimestamp properties to BaseShipmentProcess, as shown below:

currentProcessLocation: Association to one CoreModel.CurrentProcessLocation {id};

@CoreModel.Map.CurrentProcessLocation.Longitude: true
longitude: Decimal(9,6) @title:'{@i18n>Longitude}';

@CoreModel.Map.CurrentProcessLocation.Latitude: true
latitude : Decimal(8,6) @title:'{@i18n>Latitude}';

Creating and Deploying GTT Models


134 PUBLIC Modeling Language Guide
@CoreModel.Map.CurrentProcessLocation.UpdateTimestamp: true
currentLocationTimestamp: Timestamp;

Step 4 - Display a Popover with a Customized Presentation on the Map

1. To display a map popover on the processes list page, in the ShipmentUI.cds file, add the below scripts:

annotate ShipmentService.ShipmentProcess with @UI.PresentationVariant#GeoMap:


{
Visualizations: [
'@UI.LineItem#GeoMap'
]
};

annotate ShipmentService.ShipmentProcess with @UI.LineItem#GeoMap: [


{Value: shipmentId},
{Value: deliveryStatus, Criticality: to_deliveryStatus.Criticality,
CriticalityRepresentation: #WithoutIcon},
];

2. In the ShipmentUI.cds file, annotate processRoute of ShipmentProcess as shown below:

@UIExt.GeoMap.DisplayOnListReportPage.PopupPresentationVariantID: 'GeoMap'
processRoute;

Step 5 - Hide the Map Related Virtual Fields from UI

In the ShipmentUI.cds file, annotate processRoute and currentProcessLocation of


ShipmentProcess as shown below:

@Common.FieldControl: #Hidden
processRoute;

@Common.FieldControl: #Hidden
currentProcessLocation;

Simple Mode

 Note

The simple-mode shipment model only supports showing a map view on a process' details page. To show
the map view on the processes list page, you need to use the standard mode, as described above.

Showing Map View on Process' Details Page


Prerequisites

In the shipmentModel.cds file, annotate the BaseShipmentProcess entity with:

@CoreModel.MapEnabled: true

Step 1 - Display Shipping Route on the Map

In the shipmentModel.cds file, add the processRoute property to BaseShipmentProcess, as shown


below:

processRoute: Association to one CoreModel.ProcessRoute {id};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 135
Step 2 - Display Event Locations on the Map

In the shipmentModel.cds file, add the processLocations property to BaseShipmentProcess as shown


below:

processLocations : Association to many CoreModel.ProcessLocation on


processLocations.process = $self;

Step 3 - Display Current Process Location on the Map

In the shipmentModel.cds file, add the currentProcessLocation, longitude, latitude and


currentLocationTimestamp properties to BaseShipmentProcess, as shown below:

currentProcessLocation: Association to one CoreModel.CurrentProcessLocation {id};


@CoreModel.Map.CurrentProcessLocation.Longitude: true
longitude: Decimal(9,6) @title: '{@i18n>Last_Reported_Longitude}';
@CoreModel.Map.CurrentProcessLocation.Latitude: true
latitude: Decimal(8,6) @title: '{@i18n>Last_Reported_Latitude}';
@CoreModel.Map.CurrentProcessLocation.UpdateTimestamp: true
currentLocationTimestamp: Timestamp @title: '{@i18n>Last_Reported_Time}';

4.2.4.3 Object Tracking Application Model

You can define EPCIS model or non-EPCIS model in the MM app for tracking physical objects and related
events.

 Note

One tenant can only contain at most one active EPCIS model.

An EPCIS object tracking model contains one EPCIS tracked object entity and at most three EPCIS event
entities: object event, aggregation event, and transaction event. The EPCIS tracked object and events must be
inherited exactly once.

In a non-EPCIS object tracking model, the EPCIS event entities must not be inherited.

You can include object tracking packaging hierarchy in an object tracking model. For details, see Object
Tracking Hierarchy in Object Page.

Standard Mode EPCIS Model

A standard-mode EPCIS model consists of three files.

Creating and Deploying GTT Models


136 PUBLIC Modeling Language Guide
File Name Name Space Content/Service Purpose

EPCISModel.cds com.sap.gtt.app.epcissample EPCISModel Defines the metadata model


(tracked object and EPCIS
events) for the object track­
ing application.

EPCISService.cds com.sap.gtt.app.epcissample EPCISService Exposes the necessary enti­


ties as a service.

EPCISUI.cds com.sap.gtt.app.epcissample Not applicable Provides the UI annotations


for Fiori Elements of the ob­
ject tracking application.

Simple Mode EPCIS Model

A simple-mode EPCIS model only consists of the EPCISModel.cds file with model information and basic UI
layout information.

ILMD, EPCIS Vocabulary Extension, and AllTrackedProcess

You can add fields to ILMD in an EPCIS model. These fields may come from the EPCIS standard vocabulary for
ILMD, or may be constructed based on the customer’s industry requirements. For example:

@CoreModel.EPCIS.URI: 'urn:epcglobal:cbv:mda:countryOfOrigin'
countryOfOrigin : String(2) @title:'Country/Region
Of Origin';
// GTT specific ILMD fields
@CoreModel.EPCIS.URI: 'http://gtt.sap.com/epcis/ilmd:gtin'
gtin : String(255) @title:'GTIN';

The vocabulary of BusinessStepID, DispositionID, BusinessTransactionTypeID in EPICS can be


extended by adding new enumeration values to them. The syntax is as follows:

extend CoreModel.BusinessStepID {
name = 'uri';
};

To support showing information from different process types in one hierarchy table. A virtual entity like
AllTrackedProcess should be defined in model layer and exposed in service layer. For example:

entity AllTrackedProcessForEPCTrackedObject :
CoreModel.GTTAllTrackedProcessForEPCTrackedObject, BaseEPCTrackedObject{};

Creating and Deploying GTT Models


Modeling Language Guide PUBLIC 137
Related Information

Object Page [page 107]

Creating and Deploying GTT Models


138 PUBLIC Modeling Language Guide
5 Upgrade Guide

5.1 Upgrading GTT Models from Core Model Version 10.0.0


to 11.0.0

GTT core model has been upgraded from version 10.0.0 to 11.0.0 in the 2018.12a delivery. To ensure that your
existing GTT models work properly in the new delivery, proceed as follows:

● If you have an existing simple-mode model that defines the tracking of packing hierarchy but cannot see
the Hierarchy section in the GTT app, redeploy your model.
● If you have an existing model that includes map-related functions, revise your model as described below
and redeploy it.

To revise your standard-mode or simple-mode model that includes map-related functions, make the following
changes where applicable:

Standard Mode - Show Map on Process' Details Page

1. Revise the <project_name>Model.cds file as follows:


○ To display shipping route on the map, add the following "one-to-one" association to the entity
BaseShipmentProcess section.
Since 2018.12a, one process can only have one shipping route. To avoid compilation errors, if your
existing model includes a "one-to-many" association, do not delete it. Just add this "one-to-one"
association.

entity BaseShipmentProcess {
processRoute : Association to one CoreModel.ProcessRoute {id};
}

○ To display current process location on the map, add the following "one-to-one" association to the
entity BaseShipmentProcess section.
Since 2018.12a, one process can only have one current process location. To avoid compilation errors, if
your existing model includes a "one-to-many" association, do not delete it. Just add this "one-to-one"
association.

entity BaseShipmentProcess {
currentProcessLocation : Association to one
CoreModel.CurrentProcessLocation {id};
}

2. Revise the <project_name>UI.cds file as follows:


○ Add the following to hide map-related virtual fields:

@Common.FieldControl: #Hidden
processRoute;
@Common.FieldControl: #Hidden

Creating and Deploying GTT Models


Upgrade Guide PUBLIC 139
currentProcessLocation;

UI: {
Capabilities: {
FilterRestrictions: {
NonFilterableProperties: [
processRoute,
currentProcessLocation,
]
},
}
}

○ Add the following to specify a UI facet to show the map:

@UIExt.GeoMap.DisplayOnObjectPage.FacetID: 'ProcessGeoMap'
processRoute;

○ Add the following to set color, text, value and value list for the process route status shown on the map:

@UIExt.GeoMap.Route.Status.Color.PropertyPath:
to_deliveryStatus.Criticality
@UIExt.GeoMap.Route.Status.Text.PropertyPath: to_deliveryStatus.Text
@UIExt.GeoMap.Route.Status.Value.PropertyPath: deliveryStatus
@UIExt.GeoMap.Route.Status.ValueList.Entity: DeliveryStatus
processRoute;

Standard Mode - Show Map on Processes List Page

Showing a map view on the processes list page is a new feature introduced to 2018.12a. It is only supported by
standard mode models. To enable this for your existing model, revise the <project_name>Model.cds file as
follows:

1. Add the following to enable a map view on the processes list page:

@UIExt.GeoMap.DisplayOnListReportPage.Enabled: true
processRoute;

2. Add the following to set color, text, value and values list for the process route status shown on the map:

@UIExt.GeoMap.Route.Status.Color.PropertyPath: to_deliveryStatus.Criticality
@UIExt.GeoMap.Route.Status.Text.PropertyPath: to_deliveryStatus.Text
@UIExt.GeoMap.Route.Status.Value.PropertyPath: deliveryStatus
@UIExt.GeoMap.Route.Status.ValueList.Entity: DeliveryStatus
processRoute;

3. Add the following to show a pop-up information box when a process is selected on the map:

@UIExt.GeoMap.DisplayOnListReportPage.PopupPresentationVariantID: 'GeoMap'
processRoute

annotate ShipmentService.ShipmentProcess with @UI.PresentationVariant#GeoMap:


{
Visualizations: [
'@UI.LineItem#GeoMap'
]
};
annotate ShipmentService.ShipmentProcess with @UI.LineItem#GeoMap: [
{Value: shipmentId},
{Value: deliveryStatus, Criticality: to_deliveryStatus.Criticality,
CriticalityRepresentation: #WithoutIcon},
];

Creating and Deploying GTT Models


140 PUBLIC Upgrade Guide
Simple Mode - Show Map on Process' Details Page

Revise the <project_name>Model.cds file as follows:

1. To enable the map view on the process' details page, add @CoreModel.MapEnabled:true as highlighted
below:

@CoreModel.MapEnabled: true
entity ShipmentProcess : CoreModel.TrackedProcess, BaseShipmentProcess{};

2. To display shipping route on the map, add the following "one-to-one" association to the entity
BaseShipmentProcess section.
Since 2018.12a, one process can only have one shipping route. To avoid compilation errors, if your existing
model includes a "one-to-many" association, do not delete it. Just add this "one-to-one" association.

entity BaseShipmentProcess {
processRoute : Association to one CoreModel.ProcessRoute {id};
}

3. To display current process location on the map, add the following "one-to-one" association to the entity
BaseShipmentProcess section.
Since 2018.12a, one process can only have one current process location. To avoid compilation errors, if
your existing model includes a "one-to-many" association, do not delete it. Just add this "one-to-one"
association.

entity BaseShipmentProcess {
currentProcessLocation : Association to one
CoreModel.CurrentProcessLocation {id};
}

For more information on modeling map-related functions, see Map-related Functions in a Shipment Process
[page 133].

5.2 Upgrading GTT Models from Core Model Version 9.0.0


to 10.0.0

GTT core model has been upgraded from version 9.0.0 to 10.0.0 in the 2018.08a delivery.

If you have an existing model that includes a hierarchy table in the object page, you need to revise your model
to define the columns for the hierarchy table, as shown below:

Old:

annotate EPCISService.EPCTrackedObject with @UI.Facets: [


{
$Type: 'UI.CollectionFacet',
ID: 'BusinessProcess',
Label: 'Business Process',
Facets: [
{
$Type: 'UI.CollectionFacet', ID: 'Hierarchy', Label: 'EPC List',
Facets: [
{$Type: 'UI.ReferenceFacet', Target: 'hierarchy/
@UI.LineItem'},
]

Creating and Deploying GTT Models


Upgrade Guide PUBLIC 141
},
]
},
];
annotate EPCISService.EPCTrackedObject with {
hierarchy @UIExt.Hierarchy.FacetID: 'Hierarchy';
};

New:

annotate EPCISService.EPCTrackedObject with @UI.Facets: [


{
$Type: 'UI.CollectionFacet',
ID: 'BusinessProcess',
Label: 'Business Process',
Facets: [
{
$Type: 'UI.CollectionFacet', ID: 'Hierarchy', Label: 'EPC List',
Facets: [
{$Type: 'UI.ReferenceFacet', Target: 'hierarchy/
@UI.LineItem'},
]
},
]
},
];
annotate EPCISService.EPCTrackedObject with {
hierarchy @UIExt.Hierarchy.FacetID: 'Hierarchy';
};
// Define columns for the hiearchy table
annotate TrackedProcessService.HierarchyNode with @UI.LineItem: [
{
$Type: 'UI.DataFieldWithUrl',
Value: node.altKey,
Url: {
$edmJson: {
$Apply: [
'#TrackedProcess-display?id={id}',
{
$LabeledElement: {
$Path: 'nodeid'
},
$Name: 'id'
}
],
$Function: 'odata.fillUriTemplate'
}
}
},
];

Creating and Deploying GTT Models


142 PUBLIC Upgrade Guide
Important Disclaimers and Legal Information

Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:

● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your
agreements with SAP) to this:

● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.
● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.

● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such
links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this
information.

Beta and Other Experimental Features


Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by
SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use
the experimental features in a live operating environment or with data that has not been sufficiently backed up.
The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your
feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax
and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of
example code unless damages have been caused by SAP's gross negligence or willful misconduct.

Gender-Related Language
We try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders.

Videos Hosted on External Platforms


Some videos may point to third-party video hosting platforms. SAP cannot guarantee the future availability of videos stored on these platforms. Furthermore, any
advertisements or other content hosted on these platforms (for example, suggested videos or by navigating to other videos hosted on the same site), are not within
the control or responsibility of SAP.

Creating and Deploying GTT Models


Important Disclaimers and Legal Information PUBLIC 143
www.sap.com/contactsap

© 2019 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. The information contained herein may be changed
without prior notice.

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 or its affiliated companies shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP 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.

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. All
other product and service names mentioned are the trademarks of their
respective companies.

Please see https://www.sap.com/about/legal/trademark.html for


additional trademark information and notices.

THE BEST RUN

You might also like