ABAP Development for SAP S4HANA (SAP PRESS) (第1页)

第 1 页 / 共 465 页

第 2 页 / 共 465 页

SAP PRESS is a joint initiative of SAP and Rheinwerk Publishing. The know-how offered

by SAP specialists combined with the expertise of Rheinwerk Publishing offers the

reader expert books in the field. SAP PRESS features first-hand information and expert

advice, and provides useful skills for professional decision-making.

SAP PRESS offers a variety of books on technical and business-related topics for the SAP

user. For further information, please visit our website: http://www.sap-press.com.

Densborn, Finkbohner, Freudenberg, Mathäß, Wagner

Migrating to SAP S/4HANA

2017, 569 pages, hardcover and e-book

www.sap-press.com/4247

Anil Bavaraju

SAP Fiori Implementation and Development (2nd Edition)

2017, 615 pages, hardcover and e-book

www.sap-press.com/4401

Kiran Bandari

Complete ABAP

2017, 1,047 pages, hardcover and e-book

www.sap-press.com/3921

Gahm, Schneider, Swanepoel, Westenberger

ABAP Development for SAP HANA (2nd Edition)

2016, 641 pages, hardcover and e-book

www.sap-press.com/3973

第 3 页 / 共 465 页

Stefan Haas, Bince Mathew

ABAP® Development for

SAP S/4HANA®

ABAP Programming Model for SAP Fiori

第 4 页 / 共 465 页

Dear Reader,

Change is never easy. Take moving; once you’ve unpacked all your belongings and

found fresh arrangements for your furniture, it’s time to adjust to new neighbors, a

new commute, and a new community.

The move to SAP S/4HANA requires similar adjustments. SAP’s revolutionized busi-

ness suite brings with it a new programming model for developing on-premise applica-

tions. This model is powered by a collection of proven technologies and built to meet

the needs of modern users.

If exploration is the best way to get to know your new neighborhood, then a step-by-

step guide is the best way to get to know a new programming paradigm—and that’s

precisely what our author team provides. Stefan Haas and Bince Mathew have pooled

their considerable expertise to bring you a guide that walks you through the new pro-

gramming model and shows you how to update your development skills for the new

SAP S/4HANA world.

What did you think about ABAP Development for SAP S/4HANA: ABAP Programming

Model for SAP Fiori? Your comments and suggestions are the most useful tools to help

us make our books the best they can be. Please feel free to contact me and share any

praise or criticism you may have.

Thank you for purchasing a book from SAP PRESS!

Will Jobst

Editor, SAP PRESS

willj@rheinwerk-publishing.com

www.sap-press.com

Rheinwerk Publishing • Boston, MA

第 5 页 / 共 465 页

Notes on Usage

This e-book is protected by copyright. By purchasing this e-book, you have agreed to

accept and adhere to the copyrights. You are entitled to use this e-book for personal

purposes. You may print and copy it, too, but also only for personal use. Sharing an

electronic or printed copy with others, however, is not permitted, neither as a whole

nor in parts. Of course, making them available on the Internet or in a company network

is illegal as well.

For detailed and legally binding usage conditions, please refer to the section

Legal Notes.

This e-book copy contains a digital watermark, a signature that indicates which person

may use this copy:

第 6 页 / 共 465 页

Imprint

This e-book is a publication many contributed to, specifically:

Editor Will Jobst

Acquisitions Editor Hareem Shafi

Copyeditor Julie McNamee

Cover Design Graham Geary

Photo Credit Shutterstock.com/32490259/© Lynn Whitt

Production E-Book Graham Geary

Typesetting E-Book III-satz, Husby (Germany)

We hope that you liked this e-book. Please share your feedback with us and read the

Service Pages to find out how to contact us.

The Library of Congress has cataloged the printed edition as follows:

Names: Haas, Stefan (Information technology consultant), author. | Mathew, Bince, author.

Title: ABAP development for SAP S/4HANA / Stefan Haas, Bince Mathew.

Description: Bonn ; Boston : Rheinwerk Publishing, [2018] | Includes index.

Identifiers: LCCN 2018040316 (print) | LCCN 2018041086 (ebook) | ISBN

9781493217656 (ebook) | ISBN 9781493217649 (alk. paper)

Subjects: LCSH: Application software--Development. | SAP HANA (Electronic

resource) | SAP Fiori. | ABAP/4 (Computer program language) | Business

enterprises--Data processing.

Classification: LCC QA76.76.A65 (ebook) | LCC QA76.76.A65 H333 2018 (print) |

DDC 005.3--dc23

LC record available at https://lccn.loc.gov/2018040316

ISBN 978-1-4932-1764-9 (print)

ISBN 978-1-4932-1765-6 (e-book)

ISBN 978-1-4932-1766-3 (print and e-book)

© 2019 by Rheinwerk Publishing, Inc., Boston (MA)

1st edition 2019

第 7 页 / 共 465 页

Contents

Preface..................................................................................................................................................... 15

PART I SAP S/4HANA and SAP Fiori

1 SAP S/4HANA Architecture

23

1.1 Core Architecture................................................................................................................. 23

1.1.1 Overview.................................................................................................................. 24

1.1.2 OData ....................................................................................................................... 25

1.1.3 SAP HANA................................................................................................................ 26

1.1.4 SAP NetWeaver ABAP.......................................................................................... 27

1.1.5 SAP Fiori Front-end Server Based on SAP NetWeaver Gateway............ 27

1.1.6 SAPUI5...................................................................................................................... 28

1.1.7 SAP Fiori Launchpad ............................................................................................ 28

1.2 Backend.................................................................................................................................... 29

1.2.1 Virtual Data Model............................................................................................... 29

1.2.2 The Transactional Architecture (BOPF) ......................................................... 37

1.2.3 Analytics .................................................................................................................. 40

1.3 User Experience .................................................................................................................... 41

1.3.1 SAP Fiori ................................................................................................................... 42

1.3.2 SAP Fiori Launchpad ............................................................................................ 42

1.4 SAP S/4HANA Editions ...................................................................................................... 42

1.4.1 On-Premise Architecture ................................................................................... 42

1.4.2 Cloud Architecture ............................................................................................... 43

1.4.3 Release Strategies ................................................................................................ 45

1.5 SAP Cloud Platform............................................................................................................. 46

1.6 Summary ................................................................................................................................. 47

7

第 8 页 / 共 465 页

Contents

2 SAP Fiori and the Design-Led Development

Process

49

2.1 What Is SAP Fiori? ............................................................................................................... 49

2.1.1 SAP Fiori 1.0............................................................................................................ 50

2.1.2 SAP Fiori 2.0............................................................................................................ 51

2.1.3 Design Principles.................................................................................................. 52

2.1.4 Responsiveness and Adaptiveness................................................................. 54

2.1.5 SAP Fiori Launchpad............................................................................................ 54

2.2 Design-Led Development Process ............................................................................... 62

2.2.1 Discover................................................................................................................... 63

2.2.2 Design ...................................................................................................................... 64

2.2.3 Develop.................................................................................................................... 64

2.3 Different SAP Fiori App Types........................................................................................ 64

2.3.1 Freestyle .................................................................................................................. 64

2.3.2 SAP Fiori Elements ............................................................................................... 65

2.4 Prototyping Tools................................................................................................................ 77

2.4.1 Axure ........................................................................................................................ 78

2.4.2 SAP Build ................................................................................................................. 78

2.4.3 Building a Prototype Using the SAP Build Tool .......................................... 80

2.5 Summary................................................................................................................................. 94

3 ABAP Programing Model for SAP Fiori

95

3.1 Core Data Services .............................................................................................................. 95

3.2 SAP Gateway......................................................................................................................... 97

3.3 OData ....................................................................................................................................... 99

3.3.1 Overview ................................................................................................................. 99

3.3.2 OData Service Creation...................................................................................... 101

3.4 Service Adaptation Description Language............................................................... 109

3.4.1 Data Model Definition Phase........................................................................... 110

3.4.2 Service Implementation Phase........................................................................ 111

8

第 9 页 / 共 465 页

Contents

3.5 Business Object Processing Framework .................................................................... 113

3.5.1 Read-Only Application with Quick Actions.................................................. 113

3.5.2 New Application without Draft....................................................................... 114

3.5.3 Draft-Enabled Application................................................................................. 115

3.5.4 New Application with Draft.............................................................................. 115

3.6 SAP Fiori ................................................................................................................................... 116

3.7 Summary ................................................................................................................................. 117

PART II Developing Applications for SAP S/4HANA

4 Developing an SAP Fiori Elements List Report and

Object Page

121

4.1 Core Data Services Views ................................................................................................. 121

4.1.1 ABAP Development Tools in Eclipse............................................................... 122

4.1.2 Introduction to the Data Model ...................................................................... 125

4.1.3 Creating Basic Interface Core Data Services Views................................... 130

4.1.4 Adding Calculated Fields.................................................................................... 136

4.1.5 Adding Data Control Language Files.............................................................. 146

4.2 Transactional Processing with the Business Object Processing

Framework.............................................................................................................................. 150

4.2.1 Generating a BOPF Business Object from a CDS Model.......................... 150

4.2.2 Testing Business Object Nodes........................................................................ 155

4.2.3 Creating a Quick Action Using Business Object Processing

Framework.............................................................................................................. 156

4.3 Virtual Elements in Core Data Services...................................................................... 160

4.3.1 Adding a Virtual Element to a Core Data Services View ......................... 160

4.3.2 Implementing an ABAP Code Exit to Populate the Virtual

Element.................................................................................................................... 160

4.4 Creating an OData Service............................................................................................... 161

4.4.1 Auto-Exposing the OData Service................................................................... 161

4.4.2 Activating the OData Service on the SAP Gateway Hub System.......... 162

4.4.3 Testing the OData Service Using the SAP Gateway Client ..................... 164

9

第 10 页 / 共 465 页

Contents

4.5 Adding User Interface Annotations ............................................................................ 164

4.5.1 Creating a Metadata Extension File .............................................................. 165

4.5.2 User Interface-Relevant Annotations for the List Report ....................... 166

4.5.3 User Interface Annotations for the Object Page ....................................... 172

4.6 Generating a List Report Template in SAP Web IDE Full-Stack ...................... 177

4.7 Extending the User Interface......................................................................................... 181

4.7.1 Implementing User Interface Extensions via Breakout .......................... 181

4.7.2 Adding a QUnit Unit Test .................................................................................. 184

4.8 List Report Application versus Worklist Application........................................... 187

4.9 Summary................................................................................................................................. 187

5 Developing an Overview Page

189

5.1 Core Data Services Views ................................................................................................ 189

5.1.1 Creating a Simple Core Data Services View ................................................ 190

5.1.2 Adding a Data Control File................................................................................ 199

5.2 Adding User Interface Annotations ............................................................................ 199

5.2.1 Creating Annotations for an Analytical Card ............................................. 200

5.2.2 Creating Annotations for a List Card............................................................. 202

5.3 Creating an OData Service .............................................................................................. 206

5.3.1 Creating the OData Project .............................................................................. 206

5.3.2 Adding Overview Page Card CDS Views into the Project........................ 206

5.4 Exposing CDS Views as an OData Service ................................................................ 208

5.4.1 Importing the OData Service ........................................................................... 208

5.4.2 Registering the OData Service......................................................................... 209

5.5 Generating an Overview Page Template Project in SAP Web IDE ................ 210

5.5.1 Generating the Basic Overview Page Layout.............................................. 210

5.5.2 Adding the List Analytical Card ....................................................................... 215

5.5.3 Adding the Standard List Card......................................................................... 218

5.5.4 Adding the Bar List Card .................................................................................... 220

5.5.5 Adding the Table Card........................................................................................ 222

5.5.6 Overview Page Output ....................................................................................... 224

5.6 Summary................................................................................................................................. 225

10

第 11 页 / 共 465 页

Contents

6 Developing an Analytical List Page

227

6.1 Introduction ........................................................................................................................... 227

6.2 Building the Required CDS Views................................................................................. 227

6.2.1 Building Dimension Views ................................................................................ 229

6.2.2 Building Cube Views............................................................................................ 229

6.2.3 Building the Main Query View ......................................................................... 231

6.3 Configuring the Title Area ............................................................................................... 232

6.4 Configuring the Filter Area.............................................................................................. 236

6.5 Configuring the Content Area ....................................................................................... 239

6.5.1 Configuring the Default Chart......................................................................... 239

6.5.2 Configuring the Table ......................................................................................... 241

6.6 Combining All the UI Annotations in the Metadata Extension View .......... 243

6.7 Generating an Analytical List Page from SAP Web IDE ...................................... 247

6.7.1 Adding Key Performance Indicators to the Project ................................... 251

6.7.2 Adding Visual Filters to the Project ................................................................ 253

6.8 Summary ................................................................................................................................. 259

7 Developing a Freestyle Application

261

7.1 Smart Controls ...................................................................................................................... 261

7.1.1 Smart Field.............................................................................................................. 262

7.1.2 Smart Link ............................................................................................................... 263

7.1.3 Smart Form............................................................................................................. 264

7.1.4 Smart Table ............................................................................................................ 266

7.1.5 Smart Filter Bar ..................................................................................................... 268

7.2 Application Development with the SAP Web IDE Full-Stack ........................... 270

7.2.1 Setting Up an OData Service ............................................................................ 270

7.2.2 Object Creation Page Using Smart Fields and Forms............................... 276

7.2.3 List Report Page Using Smart Table and Filter Bar .................................... 283

7.2.4 Add an OPA5 Integration Test.......................................................................... 285

7.3 Summary ................................................................................................................................. 295

11

第 12 页 / 共 465 页

Contents

8 Deploying Applications to the SAP Fiori

Launchpad

297

8.1 Uploading a User Interface to the ABAP Frontend Server ................................ 297

8.1.1 Deploying Applications from SAP Web IDE................................................. 297

8.1.2 Uploading Applications Directly into the Frontend Server.................... 300

8.2 SAP Fiori Launchpad Admin Page ................................................................................ 304

8.2.1 Catalogs................................................................................................................... 305

8.2.2 Groups ..................................................................................................................... 306

8.2.3 Roles ......................................................................................................................... 306

8.3 Creating the Technical Catalog and Business Catalog ....................................... 307

8.4 Creating the Application Tiles ....................................................................................... 309

8.5 Creating Groups for Application Tiles........................................................................ 320

8.6 Creating and Assigning a Transaction PFCG Role to Users............................... 322

8.7 Setting Up Intent-Based Cross-Application Navigation from OVP

to LRP ........................................................................................................................................ 329

8.8 Summary................................................................................................................................. 331

PART III Operating Applications

9 Version Control in SAP Web IDE Using Git

335

9.1 Git Introduction ................................................................................................................... 335

9.2 Git Basics................................................................................................................................. 335

9.2.1 Creating Initial Project Repositories Using GitHub .................................. 337

9.2.2 Initializing the Local Repository for the Projects in SAP Web IDE........ 339

9.2.3 Linking the Local Repository with the Remote Repository in

GitHub ..................................................................................................................... 340

9.2.4 Submitting Code to Repository (Stage, Commit, Push) .......................... 341

9.2.5 Cloning the Project into SAP Web IDE........................................................... 347

9.2.6 Getting Code from the Remote Branch (Fetch, Merge, Pull) ................. 350

9.2.7 Working with Branches ..................................................................................... 355

9.3 Summary................................................................................................................................. 360

12

第 13 页 / 共 465 页

Contents

10 Automated Testing

361

10.1 Backend Test Automation ............................................................................................... 363

10.1.1 Unit Testing (ABAP Unit).................................................................................... 364

10.1.2 Unit Testing (Core Data Services Test Double Framework) ................... 376

10.2 Frontend Test Automation.............................................................................................. 380

10.2.1 Unit Testing (QUnit) ............................................................................................ 381

10.3 End-to-End Test Automation Tools ............................................................................. 386

10.3.1 Setting Up Nightwatch.js .................................................................................. 387

10.3.2 Creating the Create Purchase Document End-to-End

Nightwatch.js Test ............................................................................................... 388

10.3.3 Running the Create Purchase Document End-to-End

Nightwatch.js Test ............................................................................................... 389

10.4 Summary ................................................................................................................................. 390

11 Continuous Integration

393

11.1 Introduction ........................................................................................................................... 394

11.1.1 Continuous Integration...................................................................................... 394

11.1.2 Continuous Delivery ............................................................................................ 395

11.1.3 Continuous Deployment.................................................................................... 396

11.2 Setting Up a Continuous Integration Pipeline for SAPUI5 on the

ABAP Server............................................................................................................................ 397

11.2.1 Setting Up a Local Jenkins Automation Server........................................... 398

11.2.2 Creating an Initial Jenkinsfile ........................................................................... 400

11.2.3 Creating the Continuous Deployment Pipeline ......................................... 401

11.2.4 SAPUI5 Grunt Plug-ins ........................................................................................ 403

11.2.5 Implementing the Build Stage ......................................................................... 404

11.2.6 Automatically Triggering Builds on Git Push .............................................. 407

11.2.7 Implementing the Test Stage........................................................................... 408

11.2.8 Implementing the Deploy Stage ..................................................................... 411

11.3 Continuous Integration on the ABAP Server........................................................... 414

11.3.1 Quality Checking Using the ABAP Test Cockpit.......................................... 415

11.3.2 Scheduling ABAP Unit Tests Using the ABAP Unit Runner..................... 418

11.4 Summary ................................................................................................................................. 421

13

第 14 页 / 共 465 页

Contents

Appendices

423

A Developing Applications on the SAP Cloud Platform ......................................... 423

B The Authors ........................................................................................................................... 453

Index........................................................................................................................................................ 455

Service Pages ..................................................................................................................................... I

Legal Notes ......................................................................................................................................... II

14

第 15 页 / 共 465 页

Preface

1

SAP S/4HANA is SAP’s latest suite of enterprise resource planning (ERP) software cov-

ering all core business processes of enterprises. Although SAP S/4HANA is to a large

extent compatible to its predecessor SAP ERP 6.0 and is still based on the three-tier

architecture consisting of a database, application server, and client layer, a huge tech-

nological shift has happened on how applications are developed for the SAP S/4HANA

platform compared to previous SAP ERP versions. SAP S/4HANA is completely built

on top of SAP HANA, SAP’s in-memory database platform, and naturally one declared

goal of the application architecture is to fully leverage the capabilities of SAP HANA

to enable faster data processing and new types of analytical applications. Conse-

quently, operations on data are supposed to be pushed down to the SAP HANA data-

base as much as possible. Additional business logic is executed in ABAP on the SAP

NetWeaver AS for ABAP. The SAP S/4HANA user interface (UI) is built using the new

SAP Fiori design language, which puts the user in the center of the application devel-

opment process and tailors apps to specific user needs. Specifically, SAP Fiori applica-

tions are developed using the SAPUI5 Software Development Kit (SDK), which is a

responsive JavaScript framework that includes a rich set of UI controls. SAP Fiori apps

run in the SAP Fiori launchpad in the browser, and it’s no longer necessary (or even

possible in the SAP S/4HANA cloud edition) for a business user to access the classic SAP

GUI backend. The connection between the ABAP backend and the SAP Fiori apps run-

ning in the browser is established using the SAP Gateway and the OData protocol.

Purpose of This Book

The new SAP S/4HANA application paradigm and all its associated technologies might

be overwhelming in the beginning, especially when you’re used to the monolithic

development paradigms of previous SAP ERP versions. Our goal with this book is there-

fore to connect all of these different technologies that make up the new SAP S/4HANA

programming model and give you a coherent end-to-end view of how to develop your

own custom applications on the SAP S/4HANA platform. Throughout the book, we’ll

develop several fully functioning SAP S/4HANA SAP Fiori applications step by step, and

you’ll learn all the associated technologies and practices required, ranging from defin-

ing data models using ABAP core data services (CDS) over exposing them as an OData

service to creating SAP Fiori UIs using SAPUI5 and UI annotations.

15

第 16 页 / 共 465 页

Preface

Target Audience

This book is primarily targeted at developers and consultants who want to learn how

to develop applications for SAP S/4HANA. However, it might also be of interest for all

kinds of people interested in SAP S/4HANA application development and its associ-

ated technologies and tools, for instance, technical-oriented business users and man-

agers, project leaders, quality managers, or development managers.

Ideally, readers should be familiar with ABAP, JavaScript, and SQL as the book doesn’t

cover the basics of these programming languages. A basic understanding of SAP Fiori,

SAP Web IDE, SAPUI5, CDS, Eclipse, SAP Gateway, OData, and the SAP Fiori launchpad

is also beneficial, as we won’t introduce those technologies in full depth. However,

you’ll receive all you need to understand and begin developing SAP S/4HANA appli-

cations.

Structure of This Book

Part I: SAP S/4HANA and SAP Fiori

(cid:2) We’ll start the book with Chapter 1: SAP S/4HANA Architecture, which will give

you an introduction to SAP S/4HANA and its architecture in general and how it dif-

fers from previous SAP ERP three-tier architectures. Additionally, we’ll outline the

main differences between the SAP S/4HANA and SAP S/4HANA Cloud from a tech-

nical perspective.

(cid:2) Chapter 2: SAP Fiori and the Design-Led Development Process introduces several

UI-related topics beginning with the five core principles of the SAP Fiori design

language: role-based, delightful, coherent, simple, and adaptive. After that, we’ll

look at the three phases of the design-led development process—discover, design,

develop—and how the process is key to a great user experience. Subsequently, the

different SAP Fiori application types and their characteristics are explained. In

general, we can distinguish between SAP Fiori elements applications, which are

template based, and freestyle applications. Finally, the SAP Build tool is demon-

strated as an easy-to-use cloud-based tool supporting all phases of the design-led

development process.

(cid:2) In Chapter 3: ABAP Programing Model for SAP Fiori, we take a closer look at SAP

S/4HANA’s application programing model and its associated technologies. We

begin with core data services (CDS) as the key technology for exploiting SAP

16

第 17 页 / 共 465 页

Structure of This Book

HANA’s in-memory capabilities by enabling code-pushdown for all types of SAP

S/4HANA applications from analytical to transactional. Then we look at the

OData and SAP Gateway technologies, which enable access to ERP data from dif-

ferent clients and thereby enable the use of new UI technologies in conjunction

with ERP data. We also look at the ABAP Business Object Processing Framework

(BOPF) representing the business logic layer within the programming model. We

close the chapter with the UI layer—SAP Fiori.

Part II: Developing Applications for SAP S/4HANA

(cid:2) In Chapter 4: Developing an SAP Fiori Elements List Report and Object Page, we’ll

develop our first SAP Fiori elements application from the data model up to the UI.

We’ll create new database tables for our business data, put a CDS-based Virtual

Data Model (VDM) on top, expose the data model using an OData service, and

finally create a UI consisting of a list report and an object page. We’ll also add unit

tests for our backend and frontend business logic.

(cid:2) Chapter 5: Developing an Overview Page will introduce the overview page (OVP)

SAP Fiori elements application type in detail. We’ll create an analytical overview

page for our business scenario step by step and show you the end-to-end develop-

ment processes ranging from CDS view creation to OData service exposure and

the definition of the required UI annotations.

(cid:2) In Chapter 6: Developing an Analytical List Page, you’ll get to know another ana-

lytical SAP Fiori elements application type, the analytical list page (ALP). As in the

previous chapters, we’ll also develop an end-to-end application using this applica-

tion type and show all the necessary steps for getting an ALP application up and

running.

(cid:2) If the SAP Fiori elements app types don’t suit your needs, you must develop a free-

style application, which gives you full flexibility in terms of designing and imple-

menting the UI of your application. In Chapter 7: Developing a Freestyle

Application, we’ll show you how to develop a freestyle application step by step

using the SAP Web IDE full-stack. We’ll show you all the necessary steps required to

set up a freestyle application project, connect to an OData service, set up in-app

navigation, and develop the UI using smart controls.

(cid:2) In Chapter 8: Deploying Applications to the SAPFiori Launchpad, we’ll show you

how to make the previously developed apps available to users in the SAP Fiori

launchpad according to their business roles and how to connect all apps using

cross-app navigation.

17

第 18 页 / 共 465 页

Preface

Part III: Operating Applications

(cid:2) As the frontend part of SAP S/4HANA applications is based on JavaScript and no

longer on proprietary ABAP-based technologies such as Web Dynpro, the UI

source code can’t be managed with the classic ABAP Change and Transport System

(CTS) anymore. Usually SAPUI5 code is managed with the Git Source Code Manage-

ment (SCM) system, which is also well integrated into SAP Web IDE full-stack.

Chapter 9: Version Control in SAP Web IDE Using Git will therefore introduce you

to the most important Git commands required when developing SAPUI5 applica-

tions in SAP Web IDE.

(cid:2) Having a comprehensive automated test suite created using test-driven develop-

ment (TDD) is a key enabler for good code quality, earlier detection of regression

bugs, shorter release cycles, and, consequently, earlier customer feedback. There-

fore, Chapter 10: Automated Testing will introduce you to the SAP S/4HANA test-

ing pyramid. We’ll start from the bottom up to show you how to write unit tests,

integration tests, and end-to-end (E2E) tests for your SAP S/4HANA applications.

(cid:2) Another key practice for shortening release cycles and reducing risk is continuous

integration (CI). We’ll teach you how to set up a CI pipeline for your frontend

SAPUI5 code in Chapter 11: Continuous Integration. Additionally, we’ll look at

how you can establish kind of a CI pipeline in the backend as well using the ABAP

Test Cockpit (ATC) and the ABAP Unit Runner.

Because SAP S/4HANA Cloud customers no longer have access to the SAP NetWeaver

backend of SAP S/4HANA, SAP is providing another platform for doing side-by-side

application development: the SAP Cloud Platform. In Appendix A: Developing

Applications on the SAP Cloud Platform, we’ll give you a quick tour of the SAP Cloud

Platform programing model by developing a list report application similar to the

application we developed in Chapter 4 on the SAP S/4HANA core platform.

Acknowledgments

We would like to thank our SAP PRESS editors Will Jobst and Hareem Shafi for the

trust they have placed in us and for providing us with an opportunity to write this

book. A special thanks also to you, the reader, for picking up this book. We hope it’s

helpful and gives you a kick start to developing applications for SAP S/4HANA.

18

第 19 页 / 共 465 页

Acknowledgments

Stefan Haas

I would like to thank my wife, Carolin, and my parents for their continuous support

and understanding throughout the writing process of this book. A big thanks goes to

my coauthor Bince Mathew for sharing this opportunity and experience with me.

Thanks also to my friend Yingding who always has an open ear for technical discus-

sions.

Bince Mathew

I would like to express my sincere gratitude to my parents, my wife, and my brother

who motivated me throughout the whole journey of writing this book. A special

thanks to my wife Suzana who supported and encouraged me to keep up with the

schedule of the book; she also took the time to read through the chapters and gave

her feedback. A big thank you to my co-author Stefan Haas; it was a pleasure working

with you.

19

第 20 页 / 共 465 页

第 21 页 / 共 465 页

PART I

SAP S/4HANA and SAP Fiori

第 22 页 / 共 465 页

第 23 页 / 共 465 页

Chapter 1

SAP S/4HANA Architecture

This chapter explores the technical building blocks of SAP S/4HANA

and how they interact with each other. You’ll learn about the main

technical differences between SAP S/4HANA and the SAP Business

Suite, as well as explore the differences between SAP S/4HANA and

SAP S/4HANA Cloud.

We’ll start with a high-level look at the core architecture of the system and its techni-

cal building blocks. We’ll go more into detail in the next section where we’ll cover the

Virtual Data Model (VDM) of SAP S/4HANA and its underlying technology ABAP core

data services (CDS). The VDM is also the foundation of transactional and analytical

applications in SAP S/4HANA, and we’ll look at the architectures of those app types in

the subsequent sections. Moreover, we’ll explore SAP S/4HANA and SAP S/4HANA

Cloud and their differences. We close the chapter with a short introduction to the SAP

Cloud Platform as the main platform for developing side-by-side extensions for SAP

S/4HANA.

1.1 Core Architecture

SAP S/4HANA is SAP’s latest generation of enterprise resource planning (ERP) soft-

ware and was initially launched in March 2015. Like its predecessor ERP solution, SAP

ERP 6.0 EHP 8, which also serves as the basis for SAP S/4HANA, it offers an integrated

suite of applications covering the key business functions of an organization, includ-

ing Financial Accounting (FI), Controlling (CO) and Asset Accounting (AA) over Sales

& Distribution (SD), Materials Management (MM), Product Planning (PP), Quality

Management (QM), Plant Maintenance (PM), and human resources (HR).

Nevertheless, the technological shift between classic SAP ERP and SAP S/4HANA is

immense as SAP S/4HANA is fully built on SAP’s in-memory computing platform SAP

HANA and offers a completely new consumer-grade user experience (UX) with SAP

Fiori. SAP is, in general, trying to eliminate redundancies and simplify the system,

23

第 24 页 / 共 465 页

1 SAP S/4HANA Architecture

which has grown over the past decades and diverged in many places into overly com-

plex transactions, different data structures, and different architectures. In many

cases, complex transactions are already replaced by several new role-based SAP Fiori

applications to reduce complexity for end users and improve the UX in general,

which will continue in the future. Additionally, the exclusive use of SAP HANA made

it possible for certain application modules to simplify their data models and reduce

their data footprints as SAP HANA significantly speeds up reporting and renders pre-

viously needed aggregate tables obsolete. However, in many cases, these simplifica-

tions are based on functional strategies that already exist in previous ERP versions,

simplifying the transition to SAP S/4HANA. SAP publishes a list of simplifications

periodically for SAP S/4HANA. Currently, SAP is offering three migration scenarios to

SAP S/4HANA: a system conversion, where an already-existing SAP ERP system is con-

verted to an SAP S/4HANA system; a new implementation, which is the “greenfield”

approach; or a landscape transformation, where selective applications are moved to

an SAP S/4HANA installation to consolidate the existing landscape.

1.1.1 Overview

Although SAP S/4HANA is a separate product in its own right, one of its clear goals is

to stay compatible with previous SAP ERP releases to ease migration. Therefore,

almost all of its application, customizing, and system data are stored in the same

database tables as in previous SAP ERP versions. From an architectural perspective,

SAP S/4HANA is still based on the well-established three-tier client-server architec-

ture as depicted in Figure 1.1, with SAP HANA being the one and only Relational Data-

base Management System (RDMS) underlying the system. The three main layers of

the system, from bottom-up, are the database layer consisting of SAP HANA, the SAP

NetWeaver Application Server for ABAP (SAP NetWeaver AS for ABAP), and the SAP

Fiori front-end server (SAP Gateway). The SAP Fiori front-end server receives incom-

ing HTTP client requests for SAP Fiori applications running in the SAP Fiori launch-

pad and the browser as well as for business data via the OData protocol, which uses

HTTP as the data transfer protocol. The classic SAP GUI client has been replaced by

the browser as the single client application and user interface (UI) runtime of the sys-

tem, at least for SAP S/4HANA Cloud users. In SAP S/4HANA, on the other hand, cus-

tomers still can access classic backend transactions but then would miss out on the

new SAP Fiori UX.

24

第 25 页 / 共 465 页

1.1 Core Architecture

R

Search

Browser SAP Fiori Applications Cl H as T s M ic L U , W Is e (S b A D P y G np U r I o f ) or

SAP Fiori launchpad

OData/HTTPs R HTTPs R

Roles

SAP Fiori

frontend SAP Gateway

Server Catalogs

R R R

Service Adaptation Description Language (SADL)

SAP

Enterprise Analytical R R

NetWeaver

Search (ESH) Engine

AS for ABAP R Business Object

Business

Processing

Logic

Framework (BOPF)

Annotations Virtual Data Model (VDM)

SAP HANA Draft

DBMS SAP ERP Database Tables Documents

Figure 1.1 SAP S/4HANA Three-Tier Core Architecture

1.1.2 OData

With the introduction of SAP Gateway and its OData channel, SAP has opened the

ERP system to external systems, clients, devices, and machines. All business entities

of the system can be made network accessible by URIs. The OData protocol provides

a standardized protocol for consuming business entities and their relationships via

the RESTful paradigm based on HTTP. It makes use of the same HTTP verbs GET, PUT,

POST, and DELETE as a normal REST service but extends the standard paradigm with a

set of best practices for building and consuming RESTful application programming

25

R HTTPs
Annotations Virtual Data Model (VDM)
返回ABAP参考资料列表