SAP NetWeaver®

Process Integration:
A Developer’s Guide

James Wood






Disclaimer
This publication contains references to the products of SAP AG. SAP, R/3,
SAP NetWeaver, Duet, PartnerEdge, ByDesign, Clear Enterprise, SAP
BusinessObjects Explorer, and other SAP products and services mentioned
herin as well as their respective logos are trademarks or registered
trademarks of SAP AG in Germany and other countries.
Business Objects, and the Business Objects logo, BusinessObjects, Crystal
Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business
Objects products and services mentioned herein as well as their respective
logos are trademarks or registered trademarks of SAP France in the United
States and in other countries.
SAP AG is neither the author nor the publisher of this publication and is not
responsible for its content. SAP Group shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP Group
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.

Contents
Disclaimer 2
Contents 3
Introduction 13
Target Group and Prerequisites 13
Tour of the Book 15
Conventions 17
How to Contact Us 18
Acknowledgments 18
1 Foundations 19
1.1 Introducing SAP NetWeaver PI 20
1.1.1 The NetWeaver in SAP NetWeaver PI 20
1.1.2 SAP NetWeaver PI’s Position in the Marketplace 22
1.1.3 Some Historical Perspective 23
1.2 A Platform for SOA 23
1.2.1 The Evolution of Middleware 24
1.2.2 The Origins of SOA 31
1.2.3 Migrating Towards the Enterprise Service Bus 33
1.3 SAP NetWeaver PI: The Dime Tour 34
1.3.1 Architectural Overview 34
1.3.2 Service Development in the ESR 39
1.3.3 Integration Directory Configuration Concepts 48
1.3.4 Process Integration Monitoring 56
1.4 Summary 57
References 58
2 Working with XML 59
2.1 Getting Started with XML 60
2.1.1 What is XML? 60
2.1.2 Understanding XML Syntax 61
2.1.3 Processing XML with XML Parsers 69
2.2 Describing Documents with XML Schema 71
2.2.1 Syntax Overview 72
2.2.2 Component Declarations 75
2.2.3 Working with Data Types 77
2.2.4 Modularization Techniques 82
2.2.5 XML Schema as Documentation 83
2.3 Summary 84
References 85
3 The Web Services Technology Stack 86
3.1 Web Services Overview 87
3.2 SOAPͲBased Messaging 87
3.2.1 What is SOAP? 88
3.2.2 Anatomy of a SOAP Message 88
3.2.3 Processing SOAP Messages 93
3.2.4 SOAP Protocol Bindings 95
3.3 Describing Web Services with WSDL 99
3.3.1 Introduction to WSDL 100
3.3.2 Defining Service Interfaces 103
3.3.3 Creating a Protocol Binding 105
3.3.4 Uses of WSDL 107
3.4 Service Discovery with UDDI 108
3.5 Summary 109
References 110
4 Getting Started with the ESR 111
4.1 ESR Content Organization 112
4.1.1 Software Component Versions 112
4.1.2 Namespaces 113
4.1.3 Folders 114
4.1.4 Repository Objects 115
4.2 Defining Software Components in the SLD 116
4.2.1 What is the SLD? 117
4.2.2 Understanding the SAP Component Model 118
4.2.3 Working with the SLD Software Catalog 120
4.2.4 Software Component Dependencies 124
4.3 Working with the ES Builder 126
4.3.1 Importing Software Component Versions 127
4.3.2 Creating Namespaces 131
4.3.3 Creating Folders 131
4.3.4 Creating Repository Objects 132
4.3.5 Understanding Object References 133
4.3.6 Managing Change Lists 134
4.4 Transporting ESR Content 137
4.4.1 Transport Options 137
4.4.2 Performing Release Transfers 141
4.4.3 Importing PreͲDelivered Content 143
4.5 Summary 143
References 144
5 Service Design Concepts 146
5.1 SOA Explained 147
5.1.1 Why SOA? 147
5.1.2 What are the Benefits of SOA? 148
5.2 Evolving Towards Enterprise Services 149
5.2.1 The Semantic Interoperability Problem 149
5.2.2 Predicable Results through SOA Governance 150
5.2.3 Enterprise Services: Defined 151
5.3 SAP’s Model for Service Development 152
5.3.1 The SAP Enterprise Services Metamodel 152
5.3.2 Business Objects 154
5.3.3 Process Components 155
5.3.4 Service Interfaces 156
5.3.5 Service Operations 157
5.3.6 Data Type Definitions 158
5.3.7 Deployment Units 160
5.4 Modeling Tools in the ES Builder 161
5.4.1 Integration Scenario Models 161
5.4.2 Process Component Models 162
5.4.3 Process Component Interaction Models 164
5.4.4 Process Integration Scenarios 165
5.5 Summary 169
References 170
6 Service Interface Development 171
6.1 Service Interface Overview 172
6.1.1 What are Service Interfaces? 172
6.1.2 Development Approaches 173
6.1.3 Characteristics of Service Interfaces 174
6.2 Development Using the OutsideͲIn Approach 177
6.2.1 Defining Data Types 178
6.2.2 Defining Message Types 187
6.2.3 Defining the Service Interface 191
6.3 Development Using the InsideͲOut Approach 192
6.3.1 Importing External Definitions 192
6.3.2 Importing IDocs & RFCs 200
6.4 Summary 203
References 205
7 Mapping Development 206
7.1 Introduction to Mapping Development 207
7.1.1 Options, Options, Options 207
7.2 Developing Message Mappings 209
7.2.1 What are Message Mappings? 210
7.2.2 Getting Started with the Mapping Editor 211
7.2.3 Structure Mapping Concepts 216
7.2.4 Value Mapping Concepts 223
7.2.5 Creating UserͲDefined Functions 228
7.2.6 Testing Message Mappings 236
7.2.7 Debugging Techniques 238
7.3 Developing Mapping Programs Using Java 239
7.3.1 Java Mapping Overview 239
7.3.2 Creating a Java Mapping Program 243
7.3.3 Importing Java Mapping Programs into the ESR 248
7.3.4 Classloading Concepts 251
7.4 Developing Mapping Programs Using XSLT 253
7.4.1 What is XSLT? 253
7.4.2 Creating XSLT Stylesheets 254
7.4.3 Importing XSLT Stylesheets into the ESR 264
7.5 Summary 265
References 266
8 Advanced Mapping Development 267
8.1 Operation Mappings 268
8.1.1 Creating Operation Mappings 268
8.1.2 Configuration Options 270
8.1.3 Parameterization Techniques 271
8.2 Function Libraries 277
8.2.1 Creating a Function Library 278
8.2.2 Importing Function Libraries 280
8.3 MultiͲMappings 281
8.3.1 Organizational Concepts 282
8.3.2 Developing MultiͲMappings 283
8.3.3 Configuring Operation Mappings 284
8.3.4 Usage Scenarios 285
8.4 Value Mappings 285
8.4.1 Defining Value Mapping Groups 286
8.4.2 Performing Value Mappings in Message Mappings 288
8.4.3 Performing Value Mappings in Java Programs 289
8.4.4 Performing Value Mappings in XSLT Programs 290
8.4.5 Performance Considerations 290
8.5 Mapping Lookups 290
8.5.1 Conceptual Overview 291
8.5.2 Providing Connectivity 292
8.5.3 Implementing Mapping Lookups 292
8.5.4 Performance Considerations 301
8.6 Mapping Development in ABAP 301
8.6.1 Configuring Support for ABAP Mappings 301
8.6.2 Developing Mapping Classes in ABAP 303
8.6.3 Creating XSLT Mappings on the ABAP Stack 315
8.7 Summary 317
References 318
9 Integration Processes 320
9.1 Basic Concepts 321
9.1.1 What are Integration Processes? 321
9.1.2 When Should Integration Processes be Used? 323
9.1.3 Performance Considerations 324
9.2 Working with the Process Editor 324
9.2.1 Creating an Integration Process 324
9.2.2 Navigating within the Process Editor 325
9.3 Functional Overview 328
9.3.1 Step Types 328
9.3.2 Defining Abstract Interfaces 332
9.3.3 Working with Container Elements 334
9.3.4 Switches, Loops, and Forks 337
9.3.5 Sending and Receiving Messages 341
9.3.6 Applying Transformations 345
9.3.7 Determining Receivers 346
9.3.8 Working with Blocks 347
9.3.9 Correlations 354
9.4 Example Usage Scenarios 358
9.5 Summary 362
References 363
10 Working with the Integration Builder 364
10.1 Getting Started 365
10.2 Introduction to Configuration Objects 366
10.2.1 Object Keys in Configuration Objects 367
10.2.2 Change Lists and Version Management 367
10.3 Configuration Scenarios 369
10.3.1 Changing the View in the Navigation Area 371
10.3.2 Creating References to ESR Models 373
10.4 Transporting Directory Content 374
10.4.1 Working with the Integration Directory API 375
10.5 Summary 376
References 377
11 Collaboration Profiles 378
11.1 What are Collaboration Profiles? 379
11.2 Communication Parties 380
11.2.1 Defining Alternative Identifiers 382
11.3 Communication Components 383
11.3.1 Defining Business Systems 384
11.3.2 Defining Business Components 397
11.3.3 Defining Integration Process Components 399
11.3.4 AdapterͲSpecific Identifiers 402
11.4 Communication Channels 403
11.4.1 Adapters 404
11.4.2 Creating Communication Channels 410
11.5 Summary 417
References 418
12 Integration Server Configuration 420
12.1 Basic Concepts 421
12.1.1 Integration Engine Overview 421
12.1.2 Configuration Overview 427
12.2 Receiver Determinations 428
12.2.1 Defining Standard Receiver Determinations 428
12.2.2 Defining Extended Receiver Determinations 438
12.2.3 Defining Reusable Receiver Rules 441
12.3 Interface Determinations 443
12.3.1 Creating an Interface Determination 443
12.3.2 Specifying Receiver Interfaces 444
12.3.3 Operation Mapping Assignments 446
12.4 Collaboration Agreements 448
12.4.1 Defining Sender Agreements 449
12.4.2 Defining Receiver Agreements 452
12.5 Working with the Configuration Wizard 454
12.6 Summary 458
References 459
13 Advanced Configuration Concepts 460
13.1 Overview 461
13.2 Configuring AAEͲBased Communication 461
13.2.1 The Adapter Engine: Reloaded 461
13.2.2 When Can I Use Local Processing? 462
13.2.3 Defining Integrated Configurations 463
13.2.4 Runtime Considerations 466
13.3 Configuring Direct Communication 467
13.3.1 Conceptual Overview 467
13.3.2 System Setup Requirements 469
13.3.3 Defining a Direct Connection 470
13.3.4 Working with the WS Adapter 472
13.3.5 Verifying the Replication of Configuration Data 474
13.3.6 Reliable Messaging and WSͲRM 476
13.4 Summary 477
References 478
14 Process Integration Monitoring 479
14.1 Monitoring Tool Overview 480
14.2 Working with the Runtime Workbench 481
14.2.1 Component Monitoring 482
14.2.2 Message Monitoring 488
14.2.3 EndͲtoͲEnd Monitoring 495
14.2.4 Performance Monitoring 496
14.2.5 Index Administration 497
14.2.6 Alert Configuration and the Alert Inbox 498
14.2.7 Cache Monitoring 505
14.3 Integration Server Monitoring 506
14.3.1 Integration Engine Monitoring 506
14.3.2 BPE Monitoring 511
14.3.3 IDoc Adapter Monitoring 516
14.4 RFC Monitoring 517
14.4.1 Verifying Connections 518
14.4.2 tRFC Monitoring 519
14.4.3 qRFC Monitoring 520
14.5 System Monitoring with NWA and CCMS 521
14.6 PI Monitoring with SAP Solution Manager 522
14.7 Summary 522
References 523
A Proxy Programming Concepts 525
A.1 Conceptual Overview 526
A.2 Proxy Programming with SAP NetWeaver 526
A.3 Case Study: Proxy Programming in ABAP 527
A.3.1 Developing the Client Proxy 528
A.3.2 Developing the Server Proxy 533
A.3.3 Executing the Proxy Call 536
A.3.4 Runtime Considerations 538
A.3.5 Configuring Proxy Calls in PI 540
A.4 Java Proxy Development Concepts 540
References 541
B Enhancing Enterprise Services Provided by SAP
B.1 Introduction 543
B.2 Enhancement Process Overview 544
B.3 Case Study: Enhancing an SNC Service 545
B.3.1 Step One: Creating the Custom SWCV 545
B.3.2 Step Two: Importing the Custom SWCV 546
B.3.3 Step Three: Creating the Data Type Enhancement 547
B.3.4 Step Four: Generating the DTE in SNC 550
B.3.5 Step Five: Implementing the BAdI 555
References 556
C Collecting Mapping Requirements
C.1 Introduction 558
C.2 Creating a Mapping Spreadsheet 558
C.3 Why Requirements Gathering is Important 560
Index 562
About the Author 572



Introduction


These days, there’s a wealth of information out there about SAP
NetWeaver® Process Integration (SAP NetWeaver PI). Indeed, at the time
this book was written, a random Google search on the term SAP NetWeaver
PI yielded approximately 275,000 results. Of course, there’s a fundamental
difference between information and knowledge.
As we set out to write this book, we wanted to develop a holistic curriculum
that provides you with the knowledge you need to become a successful PI
developer and consultant. In order to achieve this, we endeavored to strike a
balance between theoretical concepts, nitty-gritty details, and hands-on
access using real-live examples.
We hope that you’ll find the structure and organization of the material
conducive to learning. So, whether you are new to PI, looking to broaden
your PI development skills, or simply interested in becoming an SAP-certified
PI development consultant
1
, we think this book can provide you with the
tools you need to be successful. Ultimately, our goal is to adequately prepare
you to hit the ground running on an integration project using SAP NetWeaver
PI.
Target Group and Prerequisites
In many ways, determining the target audience for this book was a difficult
challenge. In over 7 years of experience working with SAP NetWeaver PI
technology, we have encountered developers from all walks of life:
¾ ABAP™ developers who do not have much (if any) experience with
Internet-based technologies such as XML, HTTP, etc.
¾ Experienced middleware developers looking to transition their skills
into the world of SAP.

1
Specifically, it will prepare you to sit for the SAP Certified Development
Associate - Process Integration with SAP NetWeaver (PI 7.1) exam. See
http://www.sap.com/services/education/certification/certroles/certificationrol
e.epx?context=[[ROLE_C_TBIT44_71|]]| for more details.
Introduction 14

¾ Novice developers just getting started in their careers.
Given the diverse backgrounds of those interested in learning more about
SAP NetWeaver PI, we decided to approach the writing of this book under
the premise that the reader has little to no experience working with SAP
NetWeaver PI and its surrounding technologies. This is especially evident in
Part 1 of this book as we explore basic concepts and set the foundation for
more advanced topics later on in the book.
The potential downside to this approach is that you run the risk of boring
experienced developers who are already familiar with basic concepts. To
guard against this, we have organized the content into distinct sections such
that you can safely skip over the concepts that you are already familiar with.
An added benefit of this approach is that it makes it easier to refer back to
sections of the book as needed without having to dig and dig looking for
answers to specific questions.
Despite our best efforts, there are certain sections of the book that require
some background knowledge in order to firmly grasp the concepts being
presented. For example, in our discussion on message mappings, you’ll have
an easier time understanding how Java™ or ABAP-based mapping programs
work if you have some experience working with these languages. Where
appropriate, we will supplement this content with links to relevant reference
materials. In many cases, we will also point out alternative techniques which
may be easier to understand based upon your skill sets.
While this book is chock full of screenshots and examples that should help
guide you through the learning process, we cannot stress enough the
importance of getting hands on with the development tools. Therefore, if you
have access to an SAP NetWeaver PI development system
2
, we recommend
that you use it to follow along with the book’s examples. Alternatively, you
might want to look at hosting services such as http://www.sapaccess.com.


2
Unfortunately, unlike other SAP NetWeaver products, SAP NetWeaver PI is
not available for trial download on the SAP Developer Network (SDN).
Introduction 15

Tour of the Book
One of our goals in writing this book was not to simply compile a bunch of
loosely related information together into a reference manual. While this book
can certainly be used as a reference in your day-to-day work, we also hope
that you’ll find each chapter to be an interesting read in and of itself. Though
each of the chapters are designed to be self-contained, we think you’ll get
the most out of your experience by reading the book in order as each
chapter builds upon previous concepts. The chapters are organized as
follows:
¾ Chapter 1: Foundations
In this first chapter, we attempt to lay some groundwork by
describing what SAP NetWeaver PI is, where it came from, and what
value it brings to the table in the world of enterprise software
development. As such, this chapter is a microcosm for the entire
book.
¾ Chapter 2: Working with XML
For developers new to the world of interfacing in the Internet age,
this chapter will introduce you to the eXtensible Markup Language
(XML) and some of its surrounding technologies such as XML Schema.
¾ Chapter 3: The Web Services Technology Stack
If you’re not familiar with Web service technologies such as SOAP,
WSDL, and UDDI, then this chapter will provide you with a gentle
overview to bring you up to speed. Having an understanding of these
concepts is important for being able to comprehend how interfaces
are defined and processed within the SAP NetWeaver PI runtime
environment.
¾ Chapter 4: Getting Started with the ESR
In this chapter, we begin getting our hands dirty with the PI design
time environment. Here, you will learn how to organize and
manipulate SOA assets within the Enterprise Services Repository
(ESR).
¾ Chapter 5: Service Design Concepts
This chapter sets the stage for service interface development by
introducing you to some SAP and industry-best practices for designing
and modeling business processes in the SOA context. Along the way,
you will become familiar with some SOA modeling tools that can be
Introduction 16

used to visualize various aspects of a business process at different
levels of abstraction.
¾ Chapter 6: Service Interface Development
In this chapter, you learn about the various approaches to service
development supported by SAP NetWeaver PI. Here, you’ll learn how
to develop custom services from scratch, or leverage pre-existing
services.
¾ Chapter 7: Mapping Development
This chapter introduces you to some of the basics of mapping
development in SAP NetWeaver PI. In particular, we will show you
how to implement graphical message mappings and import custom
mapping programs written in Java and XSLT.
¾ Chapter 8: Advanced Mapping Development
This chapter picks up where Chapter 7 left off by showing you some
advanced mapping development concepts. Here, you will learn how to
define and configure operation mappings, perform value mappings
and mapping lookups, and much more.
¾ Chapter 9: Integration Processes
In this chapter, we will show you how to implement sophisticated
message processing requirements using integration processes. As
you’ll see, these workflow-like components can be used to implement
stateful processing, conditional logic, and much more.
¾ Chapter 10: Working with the Integration Builder
This chapter introduces the Integration Builder tool which is used to
define configuration objects within the Integration Directory.
¾ Chapter 11: Collaboration Profiles
In this chapter, you will learn how collaboration profiles are used to
model the endpoint systems that will participate in collaborative
business processes.
¾ Chapter 12: Integration Server Configuration
This chapter shows you how to configure collaborative business
processes for execution within the Integration Server, which is an
ABAP-based runtime component of SAP NetWeaver PI. Here, you will
learn how to define logical routing rules and some of the other
configuration-time objects used to influence the behavior of the
messaging components at runtime.
Introduction 17

¾ Chapter 13: Advanced Configuration Concepts
In this chapter, we will introduce you to some advanced
communication variants that are supported in version 7.1 of SAP
NetWeaver PI. Here, you will learn how to configure local processing
within the Advanced Adapter Engine (AAE) as well as point-to-point
scenarios between SAP-based Web service runtime environments.
¾ Chapter 14: Process Integration Monitoring
This final chapter presents some of the various monitoring tools
provided with SAP NetWeaver PI. Here, we’ll show you how these
tools can be used to monitor the flow of messages, the health of
messaging components, and so on.
¾ Appendix A: Proxy Programming Concepts
In this appendix, you’ll learn about proxy programming concepts.
Specifically, we’ll show you how to develop proxy objects in ABAP that
can communicate with the PI Integration Server using the native XI
protocol.
¾ Appendix B: Enhancing Enterprise Services Provided by SAP
This appendix demonstrates techniques for enhancing enterprise
services provided by SAP.
¾ Appendix C: Collecting Mapping Requirements
In this appendix, we’ll provide you with some tips for collecting
mapping requirements from the various stakeholders involved in a
collaborative business process.
Conventions
This book contains many examples demonstrating programming language
syntax, etc. Therefore, to distinguish these sections, we use a monospaced
font type similar to the one used in many integrated development
environments to improve code readability:
public class MyMappingProgram
extends AbstractTransformation
{
...
}
As new syntax concepts are introduced, these statements will be highlighted
using a bold face font like the code snippet shown above.
Introduction 18

How to Contact Us
If you have questions, comments, (or even complaints!) about this book,
we’d love to receive your feedback. You can e-mail the author directly at
james.wood@bowdarkconsulting.com.
We will post errata, updates, and any additional information out on the
book’s companion site at http://www.bowdark.com/books/pibook.
Acknowledgments
This project has been in incubation for the better part of two years. During
that time, I would have never gotten to this point without the help of some
very special people:
¾ First, I would like to thank Shelly Adamie, Mike Trinka, John Worley,
Brande Sanson, Shaan Parvaze, and Chris Smith for their useful and
informative feedback concerning various topics within the book.
¾ To my wife, Andrea, thank you for your tremendous support
throughout the entire publication process. I would have never gotten
through this without you.
¾ And finally, to the people who take the time out of their busy lives to
contribute to the SAP Developer Network (SDN), a hearty thanks.
Whenever we needed clarification or insight into different topics, we
were always able to find what we needed on the SDN. It is truly
amazing how far this community has come in the past several years.