Inhaltsverzeichnis

Alle Kapitel aufklappen
Alle Kapitel zuklappen
Preface
15
Structure of the Book
16
Acknowledgments
19
1 Modeling Your First CDS View
21
1.1 Define the Data Model of the Application
22
1.2 Implement the Data Model of the Application
25
1.2.1 Create Database Tables
26
1.2.2 Create a CDS View
30
1.2.3 Edit a CDS View
38
1.2.4 Create a Hierarchy of CDS Views
42
1.3 Summary
54
2 Fundamentals of CDS Data Modeling
55
2.1 Overview of CDS Syntax
56
2.2 Key Fields
59
2.3 Cast Operations
61
2.4 Case Statements
63
2.5 Session Variables
64
2.6 Client Handling
66
2.7 Union Views
68
2.8 Joins
76
2.9 SQL Aggregation Functions
82
2.10 Associations
85
2.10.1 Association Definitions
85
2.10.2 Expose Associations
88
2.10.3 Model M:N Relations
89
2.10.4 Use Associations in CDS Views
92
2.10.5 Use Associations in ABAP Code
105
2.11 Parameters
106
2.12 Conversion Functions for Currencies and Quantity Units
112
2.13 Performance Aspects
116
2.13.1 Static View Complexity
117
2.13.2 Calculated Fields
120
2.13.3 Functions and Calculations
122
2.13.4 Persistency Models
122
2.13.5 CDS Models in ABAP Code
122
2.13.6 Performance Tests
123
2.14 Summary
123
3 Annotations
125
3.1 Annotation Definitions
126
3.1.1 Annotation Names
128
3.1.2 Type Definitions
132
3.1.3 Enumeration Values
133
3.1.4 Default Values
134
3.1.5 Scope Definitions
135
3.2 Effects of Annotations
136
3.3 Propagation Logic of Element Annotations
139
3.3.1 Basic Principles
140
3.3.2 Consistency Aspects
144
3.4 CDS Metadata Extensions
146
3.5 Active Annotations
150
3.6 Summary
152
4 Access Controls
153
4.1 Fundamentals of Access Controls
154
4.2 Mode of Action of Access Controls
157
4.3 Implementation Patterns for Access Controls
162
4.3.1 Inherit Implementation of Access Controls
162
4.3.2 Implement Access Controls with Path Expressions
167
4.3.3 Implement Access Controls without Using Authorization Objects
173
4.3.4 Implement Access Controls for Analytical Queries
175
4.3.5 Implement Access Controls on the Field Level
178
4.3.6 Change Access Controls of SAP-Delivered CDS Models
179
4.3.7 Block Standard Data Selections from CDS Models
180
4.3.8 Decouple Access Controls from User Input
182
4.4 Test Access Controls
183
4.5 Summary
186
5 Native SAP HANA Functions in CDS
187
5.1 Implementation of a CDS Table Function
188
5.2 Application Scenarios
195
5.3 Aspects for Consideration
196
5.4 Summary
197
6 Modeling Application Data
199
6.1 Application Architecture in SAP S/4HANA
200
6.2 Field Labels
204
6.2.1 Determination of a Field Label
204
6.2.2 Length of a Field Label
206
6.3 Field Semantics
208
6.3.1 Quantities and Amounts
208
6.3.2 Aggregation Behavior
209
6.3.3 System Times
211
6.3.4 Text and Languages
213
6.3.5 Information for the Fiscal Year
213
6.4 Foreign Key Relations
214
6.5 Text Relations
220
6.6 Composition Relations
222
6.7 Time-Dependent Data
225
6.8 Hierarchies
226
6.8.1 Leveled Hierarchies and Parent-Child Hierarchies
227
6.8.2 Example of a Parent-Child Hierarchy
230
6.8.3 Determination of a Hierarchy
233
6.8.4 Test a Hierarchy
235
6.9 Summary
237
7 The Virtual Data Model in SAP S/4HANA
239
7.1 Why a Virtual Data Model?
239
7.2 Structure of the Virtual Data Model
241
7.2.1 Basic Interface Views
242
7.2.2 Composite Interface Views
245
7.2.3 Consumption Views
246
7.2.4 Other Types of VDM Views
248
7.3 Naming in the Virtual Data Model
249
7.3.1 Field Names
249
7.3.2 Names of VDM Views
252
7.3.3 Parameter Names
254
7.3.4 Association Names
254
7.4 Basic Interface View for the Sales Order
254
7.4.1 View Annotations
255
7.4.2 Structure of the Sales Order View
258
7.4.3 Specialization
259
7.4.4 Field Annotations
260
7.5 Tips for Finding Virtual Data Model Views
262
7.5.1 View Browser Application
262
7.5.2 Search in the ABAP Development Tools
265
7.5.3 Search Views with Specific Annotations
268
7.5.4 ABAP Where-Used List
269
7.6 Summary
270
8 Modeling Analytical Applications
271
8.1 Analytics in SAP S/4HANA
272
8.2 Analytic Views
273
8.2.1 First Analytic Cube View
273
8.2.2 Test Environment for Analytic Views
275
8.2.3 Analytic Cube Views
279
8.2.4 Analytic Dimension Views
282
8.2.5 Analytic Model in the Test Environment
290
8.2.6 Consistency of the Analytic Model
293
8.3 Analytic Queries
295
8.3.1 Definition of an Analytic Query
296
8.3.2 Initial Layout of a Query
299
8.3.3 Filter, Select Options, Parameters
302
8.3.4 Calculation of Measures
308
8.3.5 Restricted Measures
311
8.3.6 Exception Aggregation
313
8.3.7 Analytic Query Selecting from Dimension Views
319
8.4 Analytic Infrastructure
321
8.5 Summary
323
9 Modeling Transactional Applications
325
9.1 Transactional Applications
325
9.2 Transactional Infrastructure in SAP S/4HANA
327
9.3 Transactional Object Models
331
9.3.1 Define Object Models
331
9.3.2 Define Transactional Object Models
335
9.3.3 Define Static Properties
341
9.3.4 Set and Check Exclusive Locks
348
9.3.5 Implement Data Determinations and Validations
350
9.3.6 Model and Implement Actions
358
9.3.7 Control Properties Dynamically
361
9.3.8 Implement Authority Checks
364
9.3.9 Define Calculated Fields
368
9.4 Transactional Service Models
370
9.4.1 Define Transactional Service Models
370
9.4.2 Generate an OData Service
375
9.4.3 Define Calculated Fields
377
9.4.4 Define an SAP Fiori Application
379
9.5 Summary
385
10 CDS-Based Search Functionality
387
10.1 Modeling Value Help Views
388
10.1.1 Sample CDS Model and OData Exposure Overview
388
10.1.2 CDS Value Help Modeling Details
391
10.2 Free-Text Search Functionality in OData Services
396
10.3 Summary
402
11 Extensions of CDS Views
403
11.1 Extension Options and Released CDS Views
404
11.1.1 Key User Extensions
404
11.1.2 Extend an On-Premise Installation
405
11.1.3 Released CDS Views
405
11.2 CDS Extend Views with Custom Fields
407
11.2.1 Extension Field
408
11.2.2 View Stack
410
11.2.3 Indirect CDS View Extensions
412
11.2.4 Extend the Extension Include View
414
11.2.5 Extension Association
416
11.2.6 Stability of Indirect CDS View Extension
417
11.3 Usage of CDS Extend Views
417
11.3.1 Missing Extension Association
418
11.3.2 Missing Extension Include View
419
11.3.3 Missing Foreign Key Fields
420
11.3.4 Analytic Query Views
420
11.3.5 Extension with Standard Fields
421
11.3.6 Extensions of Released CDS Views
423
11.3.7 Extensions with Calculated Fields
424
11.4 Summary
425
12 Automated Testing
427
12.1 Fundamentals of the Test Double Framework
428
12.2 Overview of the Test Sample
429
12.3 Test CDS Views
432
12.3.1 Create a Test Design
432
12.3.2 Implement ABAP Unit Tests
434
12.3.3 Test CDS Access Controls
440
12.3.4 Test CDS Views with Conversion Functions for Currencies and Quantity Units
443
12.3.5 Test Data Sources with Null Values
446
12.4 Test ABAP Logic with SQL Accesses to CDS Views
448
12.5 Summary
451
13 Troubleshooting
453
13.1 Troubleshoot Implementations of CDS Models
453
13.2 Troubleshoot Activation Issues
461
13.3 Summary
466
A CDS Annotation Reference
467
B The Authors
477
Index
479