Excerpted from the book 'SAP Exchange Infrastructure for Developers', Authors V. Nicolescu, B. Funk, P. Niemeyer, M. Heiler, H. Wittges, T. Morandell, F. Visintin, and B. Kleine Stegemann, ISBN 1-59229-118-2, Copyright 2007. Written permission from SAP PRESS is required for all other uses. Copyright © 2007 SAP PRESS America. All rights reserved. Email: email@example.com. SAP PRESS America, 11300 Rockville Pike, Suite 1100, Rockville, MD 20852-3030, USA.
Download chapter 4: 'Technical Exercises'
4 Technical Exercises
Use of the available concepts and adapters of the SAP NetWeaver Exchange Infrastructure (XI) is the basis for implementing complex integration scenarios. This chapter shows you how to configure adapters, create mappings, and monitor the course of scenarios. The individual exercises build on each other and get more complex so you gain the knowledge necessary to implement the case studies presented in Chapters 5 and 6. Although the individual exercises depend on each other, you can use the lists of every exercise to track which objects are reused so you can start with a more advanced lesson. Predefined objects aren't used in the exercises, so you can reproduce all of the steps for completing the integration scenario at any time.
All exercises are designed in such a way that they can be performed by a group of participants at the same time. Still, some steps can only be carried out once. For steps that must be performed by the instructor, you will be notified either prior to or during the course.
Although the exercises are appropriate for workgroups, you can also complete them on your own. In this case, perform the steps to be implemented by the instructor as well. Even if you are going to complete the exercises alone, we recommend you to use a user number as this simplifies the comparison of your work with the described procedure. In this case, you should use the instructor's number of 00.
Most exercises are completed as a development consultant, and particularly in the beginning of the exercise block, you will assume the role of the system administrator or the lead developer. In some places, you will have the opportunity to develop your own small applications in ABAP or Java. You hardly need any prerequisites because the sample listings can be found in the Appendix of this book as well as in digital form on the web site for this book under http://www.sap-press.com and http://www.sap-press.de/1383.
The exercises deal with selected adapters and aspects of the XI environment. Various elements played a role when selecting the integration scenarios. When an adapter can be reused in a later exercise, its necessary aspects are discussed in that section. In hands-on exercises that are independent of each other, you will get to know the elements of SAP XI.
Even though the individual exercises do not have to be completed in the given order, there is a reason why we chose this order. In this chapter, you will implement integration scenarios that can be regarded as a preparation for the case study in the next chapter. Using XI messages, you will create a material in another system and verify its success. In a final step, the creation of material master data is reported to the person responsible for all material. A business process ensures that these reports are delivered in bundles per agent.
At first, you will use an ABAP program in System A, which records the data of a material to be created and transfer this data to the XI system using the RFC adapter (see Section 4.1). There, the material master record is converted to a file in XI format via the file adapter. In the next exercise, this file is read via the file adapter and converted into an IDoc which is transferred to and directly processed on System B (see Section 4.2). In the third example, you will check to ensure that the material has been created successfully. Based on an ABAP proxy, you will send a call to the XI system. This request is converted to a web service call provided by System B. The response of this control is returned synchronously to the calling System A (see Section 4.3). The agent uses an ABAP program to report the successful creation of the material master records using a business process (see Section 4.4).
Even though the contents of the individual exercises are based on one another, you can start with any of the exercises by using the appropriate templates.
4.1 Exercise 1: RFC-to-File
In the first exercise you will use your own ABAP program to call a remote-enabled function module that transfers the entered material master data via the RFC adapter to the XI system. Once there, data is converted to the XI XML format and stored as a file. To keep things simple, the file is created directly on the file system of the XI server. Later, you will see what changes are necessary to store the file per FTP on another machine.
Although the file technically remains on the XI system, from a logical viewpoint you will configure the receiving file adapter for System B. The communication in this integration scenario is asynchronous because no business response is returned after sending the material data. The roles of System A and B, as well as the adapters used in this exercise, are schematically illustrated in Figure 4.1.
4.1.1 Basic Principles
Because this book does not focus on development of ABAP programs and remote-enabled function modules, we will only give you a basic explanation of the used program and the function module. You can get an appropriate transport with the function module and the program for 20 participants and 1 instructor from the book's web page and implement it in your System A. For implementing the transport, consult your landscape administrator, if necessary.
If you want to create the program and the function module yourself, you will find the corresponding sample source code in Appendix A of this book.
First, log on to the client of System A as the user SYS_A-##, where ## is your participant number. There, you can view the remote-enabled function module using the Function Builder in Transaction SE37. Select the function module Z_RFM_MATERIALINPUT.
You will see that from the function module's point of view the parameters are only imported and no value is returned. This is one of the two prerequisites for asynchronous communication from a sending RFC adapter.
Except for the interface definition, the function module does not contain any ABAP code. This means that the function module is used as a kind of dummy that forwards the transferred data to SAP XI and serves as the definition of an interface. The information about where the data transferred to the function module is to be forwarded is contained in the calling program.
The program Z_PROG_MATERIALINPUT_##, which you can find together with the function module in the same transport request and that you can view in Transaction SE38, has two functions:
- First, it accepts the basic material master data that will be used to create a new material in System B.
- Second, it calls the function module (described earlier) with the parameters listed in Table 4.1.
The calling of these parameters is explained in the second exercise, in Section 4.2.
In this call, two things need to be mentioned, in particular:
- The remote-enabled function module is called in a specific destination (i.e., in the system behind this RFC connection). In the case of the destination SystemA_Sender-##, this is the XI system, so the values transferred to the function module are forwarded to the XI system.
- The second aspect is the call in the background that causes the communication to be asynchronous.
Visit the SAP Press website for a detailed description and to learn how to purchase this title.