Table of Contents

Open all
Close all
Foreword
17
Preface
19
Acknowledgments
22
PART I Basic Concepts and Technical Components
23
1 Introduction to the ABAP RESTful Application Programming Model
25
1.1 What Is the ABAP RESTful Application Programming Model?
26
1.1.1 The Purpose of the Programming Model
26
1.1.2 The REST Architectural Style
30
1.1.3 OData
35
1.1.4 Technological Innovations with SAP S/4HANA
37
1.1.5 Evolution of ABAP-Based Programming Models
38
1.2 Architecture and Concepts of the ABAP RESTful Application Programming Model
42
1.2.1 RAP Transaction Model
43
1.2.2 Implementation Types
43
1.2.3 Entity Manipulation Language
45
1.2.4 Technical Context of a RAP Application and RAP Runtime Environment
45
1.3 Development Objects of the ABAP RESTful Application Programming Model
48
1.3.1 Data Modeling with Core Data Services
48
1.3.2 Behavior Definition
49
1.3.3 Behavior Implementation
49
1.3.4 Projection Layer
50
1.3.5 Business Services
51
1.3.6 Interaction of the Artifacts
51
1.4 ABAP Development Tools as a Development Tool
52
1.5 Quality Attributes of the ABAP RESTful Application Programming Model
54
1.5.1 Evolution Capability
54
1.5.2 Development Efficiency
55
1.5.3 Testability
56
1.5.4 Separation of Business and Technology
56
1.6 Availability of the ABAP RESTful Application Programming Model
57
1.6.1 SAP BTP ABAP Environment
57
1.6.2 SAP S/4HANA Cloud ABAP Environment
58
1.6.3 ABAP Platform for On-Premise SAP S/4HANA
59
1.7 The Role of RAP in the ABAP Cloud Development Model
60
2 Core Data Services: Data Modeling
65
2.1 What Are Core Data Services?
66
2.2 Structure and Syntax of CDS
69
2.2.1 Creating a Basic Interface View
70
2.2.2 Analyzing the Data Model
74
2.2.3 Using CDS Views
77
2.2.4 Extending the Data Model
78
2.3 Associations
83
2.4 Annotations
86
2.5 Access Controls
91
2.6 Extensibility of CDS Entities
96
2.6.1 CDS View Extensions
97
2.6.2 CDS Metadata Extensions
100
2.7 Additional CDS Functionality
103
2.7.1 Virtual Elements
103
2.7.2 CDS Custom Entities
106
2.8 Virtual Data Model
110
2.9 CDS Language Elements for Modeling Business Objects
114
3 Behavior Definition
119
3.1 What Is a Behavior Definition?
119
3.1.1 Context and Structure of a Behavior Definition
120
3.1.2 Syntax of a Behavior Definition
123
3.1.3 Possible Behavior
124
3.2 Editing a Behavior Definition in ABAP Development Tools
131
3.2.1 Creating a Behavior Definition
131
3.2.2 Changing and Activating a Behavior Definition
135
3.2.3 Finding and Opening a Behavior Definition
136
3.2.4 Documenting Behavior Definitions and Relationships
137
3.3 Implementation Types
139
3.3.1 Managed Scenario
141
3.3.2 Unmanaged Scenario
143
3.4 Strict Mode
144
3.5 Entity Behavior Definition
145
3.6 Defining a Behavior Pool
146
3.6.1 Behavior Pool for Behavior Definition
146
3.6.2 Behavior Pool for the CDS Entity
147
3.6.3 Behavior Pool for the Implementation Group
147
3.7 Numbering Assignment
148
3.7.1 Early, External Numbering Assignment
150
3.7.2 Early, Internal Numbering
150
3.7.3 Late Numbering
151
3.8 Field Properties
152
3.8.1 Mandatory Fields
152
3.8.2 Protection Against Write Access
153
3.8.3 Combination: Mandatory Field for Creation and Write Protection for Updates
154
3.9 Field Mappings
155
3.10 Standard Operations for a CDS Entity
157
3.10.1 Create, Read, Update, and Delete
157
3.10.2 Create and Read Operations by Association
158
3.11 Specific Operations for a CDS Entity
160
3.11.1 Actions
161
3.11.2 Functions
168
3.11.3 Functions for Defaulting
170
3.12 Concurrency and Locking Behavior
173
3.12.1 Pessimistic Locking
173
3.12.2 Optimistic Locking
175
3.13 Internal Business Logic
177
3.13.1 Determinations
177
3.13.2 Validations
182
3.13.3 Calling Determinations or Validations via an Action
185
3.14 Authorization Checks
187
3.14.1 Authorization Master
188
3.14.2 Authorization-Dependent
190
3.14.3 Delegating Authorization Checks
191
3.15 Draft Handling
192
3.15.1 Enabling Draft Handling
193
3.15.2 Draft Handling in the Business Object Composition Tree
193
3.15.3 Draft Lifecycle and Draft Actions
195
3.15.4 Side Effects
197
3.16 Events
204
3.16.1 Manually Triggered Events
205
3.16.2 Derived Events
206
3.17 Overarching Concepts
207
3.17.1 Dynamic Feature Control
207
3.17.2 Preliminary Checks of Operations
212
3.17.3 Internal Visibility of Operations
212
4 Entity Manipulation Language: Accessing Business Logic
215
4.1 Data Types
216
4.1.1 Derived Data Types
216
4.1.2 Implicit Return Parameters
218
4.2 EML Operations
219
4.2.1 READ ENTITIES
220
4.2.2 MODIFY ENTITIES
222
4.2.3 GET PERMISSIONS
226
4.2.4 SET LOCKS
227
4.2.5 COMMIT ENTITIES
228
4.2.6 ROLLBACK ENTITIES
229
4.3 Using the EML Outside of Behavior Implementations
229
4.3.1 Use in the Context of an ABAP Report
230
4.3.2 Implementation in the Context of a Test Class
231
4.4 Concrete Use Cases
232
5 Behavior Implementation
239
5.1 Business Object Provider API
239
5.2 Runtime Behavior of the ABAP RESTful Application Programming Model
240
5.2.1 Interaction Phase and Transactional Buffer
241
5.2.2 Save Sequence
242
5.3 Interfaces for the Interaction Handler and the Save Handler
243
5.4 Interaction Handler
244
5.4.1 FOR MODIFY
245
5.4.2 FOR INSTANCE AUTHORIZATION
248
5.4.3 FOR GLOBAL AUTHORIZATION
250
5.4.4 FOR FEATURES
252
5.4.5 FOR GLOBAL FEATURES
255
5.4.6 FOR LOCK
256
5.4.7 FOR READ
258
5.4.8 FOR READ by Association
259
5.4.9 FOR DETERMINE
261
5.4.10 FOR VALIDATE
262
5.4.11 FOR NUMBERING
263
5.4.12 FOR PRECHECK
264
5.5 Save Handler
265
5.5.1 FINALIZE
266
5.5.2 CHECK_BEFORE_SAVE
268
5.5.3 ADJUST_NUMBERS
269
5.5.4 SAVE
270
5.5.5 CLEANUP
272
5.5.6 CLEANUP_FINALIZE
273
5.6 Events
274
5.6.1 Triggering Events
275
5.6.2 Consumption of Events
275
6 Business Services
281
6.1 Projection Layer
282
6.1.1 CDS Projection View
283
6.1.2 Projection Behavior Definition
284
6.2 Service Definition
285
6.3 Service Binding
285
6.4 Testing Business Services in SAP Gateway Client
289
6.5 Testing UI Services Using the SAP Fiori Elements Preview
292
6.6 Business Object Interfaces
293
6.6.1 Structure of a Business Object Interface
293
6.6.2 Using Business Object Interfaces
296
6.6.3 Using Business Object Interfaces as New BAPIs
296
7 Extensibility of Business Objects
301
7.1 Introduction to the Extensibility Concept
301
7.2 Extension Options
305
7.2.1 Extensions to the Data Model
305
7.2.2 Extensions to the Behavior
312
7.2.3 Extensibility with Additional CDS Entities
316
7.3 Extending a Standard Business Object
320
7.3.1 Description of the Use Case
320
7.3.2 Extending the Data Model
323
7.3.3 Extending the Behavior
332
7.3.4 Derived Events
342
8 Application Interfaces and SAP Fiori Elements
347
8.1 Development Tools
347
8.1.1 SAP Business Application Studio
347
8.1.2 Visual Studio Code
350
8.2 SAP Fiori Elements UIs for RAP Applications
351
8.2.1 Floorplans in SAP Fiori Elements
351
8.2.2 Selected UI Annotations
353
8.2.3 Defining UI Annotations in a CDS View
355
8.2.4 Generating Annotations via the Service Modeler
370
PART II Practical Application Development
383
9 Use Cases
385
9.1 Areas of Use for the ABAP RESTful Application Programming Model
385
9.2 Implementation Types
386
9.3 Decision Criteria for Selecting the Implementation Type
387
10 Managed Scenario: Developing an Application with SAP Fiori Elements
391
10.1 Description of the Use Case
392
10.2 Building the Data Model
392
10.2.1 Database Tables
392
10.2.2 CDS Modeling
396
10.3 Creating Behavior Definitions
405
10.3.1 Creating Behavior Definitions for Certificate Management
405
10.3.2 Enabling Draft Handling
410
10.4 Defining a Business Service
411
10.4.1 Creating a Service Definition
412
10.4.2 Creating the Service Binding
413
10.5 Creating an SAP Fiori Elements User Interface
416
10.6 Enrichment with a Determination
424
10.7 Enrichment with a Validation
428
10.8 Enrichment with an Action
432
10.9 Generation and Deployment of the App
434
10.10 File Upload
442
11 Managed Scenario with Unmanaged Save: Integrating an Existing Application
445
11.1 Description of the Use Case
446
11.2 Building the Data Model
449
11.2.1 Overview of the Logical Data Model
450
11.2.2 Database Tables
452
11.2.3 CDS Modeling
455
11.3 Creating a Behavior Definition
460
11.4 Implementing the Create Purchase Order Function
463
11.4.1 Declaring Managed Numbering
463
11.4.2 Setting Field Properties
463
11.4.3 Creating the Behavior Pool
465
11.4.4 Implementing Determinations
466
11.4.5 Save Sequence: Implementing Creation via the Business Object Interface
472
11.4.6 Implementing Validations
481
11.5 Implementing the Delete Purchase Order Function
487
11.5.1 Save Sequence: Implementing Deletion via the Business Object Interface
487
11.5.2 Implementing a Validation
492
11.6 Defining Business Services
492
11.6.1 Setting Up the Projection Layer for the My Purchase Orders App
492
11.6.2 Creating a Service Definition
494
11.6.3 Creating a Service Binding
495
11.7 Implementing Authorization Checks
495
11.7.1 Access Controls for Read Access
496
11.7.2 Access Controls for Write Access
497
11.8 Creating an SAP Fiori Elements User Interface
500
11.8.1 Creating a Metadata Extension
500
11.8.2 Generating and Deploying the Application
503
12 Unmanaged Scenario: Reusing Existing Source Code
505
12.1 Description of the Use Case
505
12.2 Description of the Existing Application
507
12.2.1 Database Tables
507
12.2.2 Source Code of the Existing Application
510
12.3 Extending the Data Model
513
12.4 Creating a Behavior Definition
519
12.5 Creating a Behavior Implementation
523
12.5.1 Implementing the Interaction Phase
525
12.5.2 Implementing the Save Sequence
533
12.6 Defining a Business Service
537
13 Special Features in the Cloud Environment
541
13.1 Basic Technical Principles
542
13.1.1 ABAP for Cloud Development
545
13.1.2 Technical Infrastructure Components
545
13.1.3 Migrating Legacy Code
547
13.2 Identity and Access Management
548
13.3 Deploying SAP Fiori Apps and Assigning Authorizations
551
13.3.1 Creating an IAM App and Business Catalog
552
13.3.2 Creating an IAM Business Role
554
13.3.3 Integration in SAP Fiori Launchpad
554
13.4 Consuming Business Services
558
Bibliography
563
The Authors
565
Index
567