Upload
duongtram
View
255
Download
5
Embed Size (px)
Citation preview
SAP NetWeaver
How-To Guide
How To Setup Forward Error
Handling in PI Scenarios
Applicable Releases:
SAP NetWeaver Process Integration 7.11 and higher
Topic Area:
SOA Middleware
Capability:
Forward Error Handling
Version 1.0
December 2012
i
© Copyright 2012 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any
form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior
notice.
Some software products marketed by SAP AG and its distributors
contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and
Visual Studio are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p,
System p5, System x, System z, System z10, z10, z/VM, z/OS,
OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems,
POWER7, POWER6+, POWER6, POWER, PowerHA, pureScale,
PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS,
HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX,
Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet
are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the United
States and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are
trademarks or registered trademarks of Adobe Systems Incorporated
in the United States and other countries.
Oracle and Java are registered trademarks of Oracle and its affiliates.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the
Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame,
VideoFrame, and MultiWin are trademarks or registered trademarks
of Citrix Systems Inc.
HTML, XML, XHTML, and W3C are trademarks or registered
trademarks of W3C®, World Wide Web Consortium, Massachusetts
Institute of Technology.
Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-
Touch, Objective-C, Retina, Safari, Siri, and Xcode are trademarks or
registered trademarks of Apple Inc.
IOS is a registered trademark of Cisco Systems Inc.
RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold,
BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm, BlackBerry
Storm2, BlackBerry PlayBook, and BlackBerry App World are
trademarks or registered trademarks of Research in Motion Limited.
Google App Engine, Google Apps, Google Checkout, Google Data
API, Google Maps, Google Mobile Ads, Google Mobile Updater,
Google Mobile, Google Store, Google Sync, Google Updater, Google
Voice, Google Mail, Gmail, YouTube, Dalvik and Android are
trademarks or registered trademarks of Google Inc.
INTERMEC is a registered trademark of Intermec Technologies
Corporation.
Wi-Fi is a registered trademark of Wi-Fi Alliance.
Bluetooth is a registered trademark of Bluetooth SIG Inc.
Motorola is a registered trademark of Motorola Trademark Holdings
LLC.
Computop is a registered trademark of Computop
Wirtschaftsinformatik GmbH.
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 Business Objects
Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL
Anywhere, and other Sybase products and services mentioned
herein as well as their respective logos are trademarks or
registered trademarks of Sybase Inc. Sybase is an SAP company.
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are
registered trademarks of Crossgate AG in Germany and other
countries. Crossgate is an SAP company.
All other product and service names mentioned are the
trademarks of their respective companies. Data contained in this
document serves informational purposes only. National product
specifications may vary.
These materials are subject to change without notice. These
materials are provided by SAP AG and its affiliated companies
("SAP Group") for informational purposes only, without
representation or warranty of any kind, and 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.
These materials are provided “as is” without a warranty of any
kind, either express or implied, including but not limited to, the
implied warranties of merchantability, fitness for a particular
purpose, or non-infringement.
SAP shall not be liable for damages of any kind including without
limitation direct, special, indirect, or consequential damages that
may result from the use of these materials.
SAP does not warrant the accuracy or completeness of the
information, text, graphics, links or other items contained within
these materials. SAP has no control over the information that
you may access through the use of hot links contained in these
materials and does not endorse your use of third party web pages
nor provide any warranty whatsoever relating to third party web
pages.
SAP NetWeaver “How-to” Guides are intended to simplify the
product implementation. While specific product features and
procedures typically are explained in a practical business
context, it is not implied that those features and procedures are
the only approach in solving a specific business problem using
SAP NetWeaver. Should you wish to receive additional
information, clarification or support, please refer to SAP
Consulting.
Any software coding and/or code lines / strings (“Code”)
included in this documentation are only examples and are not
intended to be used in a productive system environment. The
Code is only intended better explain and visualize the syntax and
phrasing rules of certain coding. SAP does not warrant the
correctness and completeness of the Code given herein, and SAP
shall not be liable for errors or damages caused by the usage of
the Code, except if such damages were caused by SAP
ii
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP
BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP
products and services mentioned herein as well as their respective
logos are trademarks or registered trademarks of SAP AG in
Germany and other countries.
intentionally or grossly negligent.
Disclaimer:
Some components of this product are based on Java™. Any code
change in these components may cause unpredictable and severe
malfunctions and is therefore expressively prohibited, as is any
decompilation of these components.
Any Java™ Source Code delivered with this product is only to be
used by SAP’s Support Services and may not be modified or
altered in any way.
iv
Document History
Document Version Description
1.00 First official release of this guide
v
Typographic Conventions
Type Style Description
Example Text Words or characters quoted
from the screen. These
include field names, screen
titles, pushbuttons labels,
menu names, menu paths,
and menu options.
Cross-references to other
documentation
Example text Emphasized words or
phrases in body text, graphic
titles, and table titles
Example text File and directory names and
their paths, messages,
names of variables and
parameters, source text, and
names of installation,
upgrade and database tools.
Example text User entry texts. These are
words or characters that you
enter in the system exactly as
they appear in the
documentation.
<Example
text>
Variable user entry. Angle
brackets indicate that you
replace these words and
characters with appropriate
entries to make entries in the
system.
EXAMPLE TEXT Keys on the keyboard, for
example, F2 or ENTER.
Icons
Icon Description
Caution
Important
Note
Recommendation or Tip
Example
vi
Table of Contents
1. Business Scenario ......................................................................................................... 1
2. Background Information ............................................................................................... 2
3. Prerequisites ................................................................................................................ 2
3.1 Software ....................................................................................................................... 2
4. Step-by-Step Procedure ................................................................................................ 3
4.1 Process Integration Configuration Steps ...................................................................... 3
4.1.1 Enterprise Service Repository .......................................................................... 3
4.1.2 Integration Directory ....................................................................................... 8
4.2 Proxy Generation and Service Implementation ......................................................... 11
4.3 Action Class Creation .................................................................................................. 14
4.4 ECH/PPO Customizing ................................................................................................ 23
4.5 Test Run ...................................................................................................................... 36
5. Appendix ................................................................................................................... 57
How To... Setup Forward Error Handling in PI Scenarios
December 2012 1
1. Business Scenario
In PI asynchronous communication, the errors on the receiver side are handled in the receiving
system as the error details are not returned to the sender application and sender does not receive
message transfer confirmation.
Forward Error Handling is a functionality which allows the processing of the errors returned by the
receiver application. The provider side errors can be resolved using this feature provided by the ABAP
runtime. It allows you to collect and classify errors and conflicts that occur during message transfer.
Error and Conflict Handler (ECH) is used to handle the business errors and conflicts which arise
during asynchronous processing. ECH uses Post processing Office (PPO) for creation and processing
of post processing orders and Hierarchical derivation Service (HDS) for determining the resolution
strategy for error correction.
Figure 1: Error Conflict Handler in Asynchronous Processes
To better understand this feature, the following business scenario is used in this guide:
The sender system sends a file containing the employee address details to SAP Process Integration
(PI).The PI system sends this data to the target ERP system using ABAP proxy.
The BAPI BAPI_ADDRESSEMP_CREATE is called in the server proxy interface implementation
method for the creation of employee address details. If any error occurs during the creation of the
address data, BAPI returns an error. For handling the error, Forward Error Handling is used.
NOTE
Please refer to the help link given below for understanding the ECH process flow:
http://help.sap.com/erp2005_ehp_05/helpdata/en/f4/362e841d13473995af706b0472430f/content.
htm?frameset=/en/50/b4c373544e425891e128994ea4c9aa/frameset.htm
Here, for the creation of the PI scenario, two clients (Integration Server and Application system) of a PI
system are used. A remote function call is made to an ECC system in the proxy Interface method
How To... Setup Forward Error Handling in PI Scenarios
December 2012 2
Implementation. The RFC destination to the ECC system is configured using SM59 transaction for this
purpose.
2. Background Information
This guide explains how to configure Forward Error Handling to handle errors in the receiver system.
The automatic reprocessing of the PPO orders is not elaborated in this document.
FEH can be used in handling various error situations like application failure due to missing
customizing, locks, incorrect input parameters, etc.
3. Prerequisites
3.1 Software
Error and Conflict Handler (ECH) is located in:
ABAP package FS_ECH in software component SAP_BS_FND with release >= 7.01
Software component SAP_ABA in SAP NetWeaver release 7.11 and 7.30.
It uses:
Local PI runtime in every AS ABAP.
Post processing office (PPO) software component in package /SAPPO/MAIN in software
component SAP_ABA.
Hierarchical Derivation Service (HDS) framework in software component SAP_BS_FND.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 3
4. Step-by-Step Procedure
This section covers the following:
1. Design and Configuration of Process Integration Scenario Employee Address Create.
2. Server proxy generation and implementation in the receiver.
3. Action class creation for the usage of Postprocessing Office for error handling.
4. ECH/PPO Customizing.
5. Testing.
4.1 Process Integration Configuration Steps
This section covers the configuration steps in Enterprise Service Repository (ESR) and Integration
Directory of PI.
4.1.1 Enterprise Service Repository
The Software Component version will be referred as SWCV in this document. It is assumed that the
SWCV DEMO_SWCV 1.0 of test.com is available in the ESR for building the scenario.
1. Create the namespace http://test.com/EmployeeAddressCreate under the SWCV and
Save.
Figure 2: Create Namespace
2. Create the Data Type EmpAddress_DT with the structure in Figure 3 and Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 4
Figure 3: Create Data Type
3. Create the Message Type EmployeeAddress_MT and select the Data Type created above and
Save.
Figure 4: Create Message Type
How To... Setup Forward Error Handling in PI Scenarios
December 2012 5
4. Create a Fault Message Type EmployeeAddress_Fault and Save.
NOTE
This fault message type will be used for raising an exception in the server proxy implementation
Figure 5: Create Fault Message Type
A popup Edit Fault Message Type appears. Click on Create button.
Figure 6: Create Exchange Fault Data
Save the Fault Message Type.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 6
Figure 7: Create Exchange Fault Message Type
5. Create Service Interface EmployeeAddress_In. Select Category as Inbound. Change the
Operation name to Create. Select the Message type EmployeeAddress_MT and the Fault Message
type EmployeeAddress_Fault. Click on Save.
Figure 8: Create Inbound Service Interface
How To... Setup Forward Error Handling in PI Scenarios
December 2012 7
6. Create the Service Interface EmployeeAddress_Ob. Select the Category as Outbound.
Change the Operation name to Create. Select the Message Type EmployeeAddress_MT and click
on Save button.
Figure 9: Create Outbound Service Interface
7. Go to the Change Lists tab and Activate the Change List.
Figure 10: Change List
How To... Setup Forward Error Handling in PI Scenarios
December 2012 8
4.1.2 Integration Directory
This section provides the configuration steps performed in Integration Directory.
1. Create a Communication Component BS_SENDER and add the Outbound Service Interface
EmployeeAddress_Ob in the Sender tab and Save.
Figure 11: Add Outbound Service Interface to Business Component
2. Create the Sender Communication Channel and select the Adapter Type as File. Enter the
Channel parameters and click on Save.
Figure 12: Sender Communication Channel
NOTE
It is assumed that the receiver system is created in the SLD and imported to the Integration
Directory. For building this scenario, application system client of the PI is used. The Business
System name is BS_RECEIVER. The HTTP Destination HTTP_DEST of type H pointing to the
receiver system is created in the SM59 transaction of the PI system.
3. Create the receiver Communication Channel and select Adapter Type as XI. Enter the channel
parameters and Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 9
Figure 13: Receiver Communication Channel
4. Create the Sender Agreement and select the Sender Communication channel and Save.
Figure 14: Sender Agreement
5. Create the Receiver Determination. Choose the receiver as BS_RECEIVER and click on Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 10
Figure 15: Receiver Determination
6. Create the Receiver Agreement and choose the Receiver Communication Channel and Save.
Figure 16: Receiver Agreement
How To... Setup Forward Error Handling in PI Scenarios
December 2012 11
7. Create the Interface Determination. Select the Inbound Interface and Save.
Figure 17: Interface Determination
8. Go to the Change Lists tab and Activate the change list.
Figure 18: Activation
4.2 Proxy Generation and Service Implementation
...
This section describes the steps involved in service interface method implementation.
NOTE
It is assumed that the ABAP proxy connection settings for SLD/ESR Connection are already done.
1. Go to the transaction SPROXY in the Receiver Application system. Right click on the Inbound
Service Interface EmployeeAddress_In and select Create Proxy.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 12
Figure 19: Create Proxy
2. Create Service Provider Wizard appears. Choose Local Object and enter the prefix as ZPI
and click on Continue.
Figure 20: Create Service Provider
Click on Finish button.
Click on Finish button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 13
Figure 21: Create Service Provider
3. The proxy interface is created. Click on Save button. Right click on the inbound Service
Interface and select Activate Proxy.
Figure 22: Activate Proxy
Figure 23: Proxy Provider Class
4. Double click on the Provider proxy class ZPICL_EMPLOYEE_ADDRESS_IN for implementation.
NOTE
In addition to the proxy class generated, one more class (ZCL_FEH_ACTION) is required for
the service implementation. This class is described in section 4.3. The purpose of this class is to have all the business logic and FEH processing. (The class is not a must but it is an advised way of doing implementation)
In the proxy class, the following steps need to be implemented:
Set update task local.
Call the EXECUTE method of the service implementation class.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 14
In the EXECUTE method of the service implementation class,
Initialize FEH.
Execute the PROCESS method and raise an exception if the method is not executed
successfully.
The PROCESS method calls the BAPI for creating the Employee Address details.
The errors during the address creation are returned by the BAPI.
If any error occurs, categorize the error and call the collect method. The error symptom is
transferred to FEH using the COLLECT method.
Raise an exception corresponding to the fault message created.
5. The interface method is displayed. Double click on the method to implement it.
The interfa ce met hod is displaye d. Double cli ck on the method to implement it.
6. In the proxy method, SET UPDATE TASK LOCAL. The EXECUTE method of the
ZCL_FEH_ACTION class is called.
Figure 24: Proxy Interface Method
7. Copy and paste the proxy implementation code from Appendix C->Proxy Method and click on
Save.
4.3 Action Class Creation
1. For using Postprocessing Office for error handling, the callback interface IF_ECH_ACTION must
be implemented. For implementing this interface, create the class ZCL_FEH_ACTION in transaction
SE24.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 15
Figure 25: Create FEH Action Class
Figure 26: Create FEH Action Class
2. Enter Description and Save. Go to the Interfaces tab and add the Interface IF_ECH_ACTION
and press Enter.
Figure 27: Create FEH Action Class Interfaces
How To... Setup Forward Error Handling in PI Scenarios
December 2012 16
3. Go to the Methods tab. The following methods will appear.
Figure 28: Create FEH Action Class Methods
4. Go to the Attributes tab and add the attribute GO_ECH_ACTION. Select Level as Static and
Visibility as Protected. Select Typing Type Ref To and enter the Associated Type same as the
class name i.e. ZCL_FEH_ACTION.
Figure 29: Create FEH Action Class Attributes
5. Now, select the Methods tab and double click on the IF_ECH_ACTION~S_CREATE method. Copy
and paste the code from Appendix C->S_CREATE Method .Click on Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 17
Figure 30: Create FEH Action S_Create method
6. Go back to the Methods tab and Click on the Insert Method button. Enter the name CREATE. Select
Level as Static Method and Visibility as Public. Click on Save.
Figure 31: Create FEH Action Create method
7. Go to Parameters tab. Enter the following parameters:
Parameter RO_FEH, Type Returning, check Pass Value and Associated Type
ZCL_FEH_ACTION
How To... Setup Forward Error Handling in PI Scenarios
December 2012 18
Figure 32: Create FEH Action Create method
8. Save. Select Methods tab. Double click on the CREATE method. Copy and paste the code
available in Appendix C->CREATE and Save.
9. Double click on the IF_ECH_ACTION~FAIL method. This method is used for cancelling the
messages which are not required to be processed. Copy and paste the code available in Appendix C-
>FAIL Method.
The s_fail method of the cl_feh_registration class is called in this method.
Figure 33: Create FEH Action Fail Method
10. Double click on the IF_ECH_ACTION~FINISH method. This method is used for confirming the
message, for e.g. when the user manually reprocesses the message after correction of the error.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 19
Copy and paste the code available in Appendix C->FINISH Method. The s_finish method of the
cl_feh_registration class is called in this method. Click on Save.
Figure 34: Create FEH Action Finish Method
8. Double click on the IF_ECH_ACTION~RETRY method. This method is used for reprocessing the
messages after the correction of error. You have the option of editing the payload and saving it before
reprocessing. Copy and paste the code available in Appendix C->RETRY and Save.
The s_retry method of the cl_feh_registration class is called to create a retry instance. After this, the
XML data can be retrieved using the retrieve_data method. For reprocessing, a custom method
(process) can be created and called in the retry method. Finally, call the resolve_retry method to
resolve the tick list.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 20
Figure 35: Create FEH Action Retry Method
9. Add the PROCESS method to do the message processing. In this method the
BAPI_ADDRESSEMP_CREATE is called. If the BAPI returns any errors, error symptom is
transferred to the FEH Instance using the COLLECT method and an exception is raised.
Click on the Insert Method button in the Methods tab to add the method.
Figure 36: Create FEH Action Insert
10. Enter the name PROCESS. Select Level as Instance and Visibility as Private. Click on Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 21
Figure 37: Create FEH Action Process
11. Go to Parameters tab. Enter the following parameters:
Parameter INPUT, Type Importing and Associated Type ZPIEMPLOYEE_ADDRESS_MT
(Message Type)
Parameter I_REF_REGISTRATION, Type Importing, Typing TypeRefTo and Associated
Type CL_FEH_REGISTRATION.
Parameter I_REPROCESS, Type Importing, Typing Type and Associated Type XFELD.
Parameter ES_RETURN_MESSAGE, Type Exporting and Associated Type BAPIRET2
Figure 38: Create FEH Action Process Parameters
12. Save. Select Methods tab. Double click on the Process method. Copy and paste the code
available in Appendix C->PROCESS and Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 22
13. Click on the Insert Method button in the Methods tab and add the EXECUTE method. In this
method an instance of CL_FEH_REGISTRATION class is created and the PROCESS method is
called. If any errors occur, an exception is raised.
14. Enter the name EXECUTE. Select Level as Instance and Visibility as Public. Click on Save.
Figure 39: Create FEH Action Execute
15. Go to Parameters tab. Enter the following parameters:
Parameter IS_INPUT, Type Importing and Associated Type ZPIEMPLOYEE_ADDRESS_MT
(Message Type)
Figure 40: Create FEH Action Execute
16. Save. Select Methods tab. Double click on the Execute method. Copy and paste the code
available in Appendix C->EXECUTE and Save.
17. Create the text symbol as seen in Figure 41.Activate it.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 23
Figure 41: Create Text Symbol
18. Activate the class ZCL_FEH_ACTION and its methods.
Figure 42: Activate Class
19. Also Activate the proxy method ZPIII_EMPLOYEE_ADDRESS_IN~CREATE.
4.4 ECH/PPO Customizing
This section provides the details of the various customizing options available for ECH in the receiver
application system.
NOTE
The customizing settings described in this section are based on SAP NetWeaver release 7.3
onwards.
Activate Forward Error Handling
Go to Transaction SPRO->Cross-Application Components ->General Application Functions ->Error
and Conflict Handler -> Activate Error and Conflict Handler.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 24
NOTE
The view FEHV_ACTIVE can also be used for activating the Error and Conflict Handler.
Figure 43: Activate FEH
Define Software Component
Go to Transaction SPRO->Cross-Application Components ->General Application Functions -
>Postprocessing Office ->Software Components->Define Sofware Components.
The Software Components other than standard components used by PPO can be defined here.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 25
Figure 44: Define Software Component
Click on New Entries.
Figure 45: Create Entries
Add a new entry YFEH_DEMO and give the transactions /SAPPO/PPO2 and /SAPPO/PPO3 for the
Editing and Display Transactions.Give any Description and Title.Please refer to the Figure 46 for
creating the SWCV.Save.
NOTE
The table/view /SAPPO/C_CMPNT can be used in maintaining the SWCV.
Figure 46: Create Software Component
Define Business process for ECH
Go to Transaction SPRO->Cross-Application Components ->General Application Functions ->Error
and Conflict Handler ->Define Business Processes
Here, the business processes in Error and Conflict other than the business proceses in the standard
delivery can be defined.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 26
Figure 47: Define Business Process
NOTE
The table/view ECHVC_PROCESSES can be used in maintaining the Business Process.
Create a new entry with values mentioned in the Figure 48.The action class created in Section 4.3 is
entered as the Action Class. Click on Save button.
Figure 48: Create Process Data for ECH
Define Business Process for PPO
Go to Transaction SPRO->Cross-Application Components ->General Application Functions ->Post
processing Office ->Business Processes->Define Business Processes.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 27
Figure 49: Define Business Processes
Click on New Entries.
Figure 50: Create Entries
NOTE
The table/view /SAPPO/C_BPROC can be used in maintaining the Business Processes.
Add the entry YPPO_BP .Please refer to the Figure 51 for the creation of the Business Processes.Click
on Save button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 28
Figure 51: Define Business Process for PPO
Assign Business Processes for PPO
Go to Transaction SPRO->Cross-Application Components ->General Application Functions ->Error
and Conflict handler ->Define Business Processes for Postprocessing Office.
In this activity you map the ECH Process to PPO Process.
Figure 52: Define Business Processes for PPO
Click on New Entries.
Figure 53: Map ECH Process to PPO
NOTE
The table/view ECHVC_PP_PROCESS can be used in maintaining the mapping of ECH to PPO
Processes.
Enter the details as mentioned in the Figure 54.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 29
Figure 54: Create Entries
Assign Caller to a Business Process
Go to Transaction SPRO->Cross-Application Components ->General Application Functions ->Error
and Conflict handler ->Assign Caller to a Business Process.
In this activity, the components and business processes defined are assigned to your own Application
Programming Interface (API).
Figure 55: Assign Caller to Business Process
Click on New Entries
Figure 56: Map API and API Method to FEH Process
How To... Setup Forward Error Handling in PI Scenarios
December 2012 30
NOTE
The table/view FEHVC_PROXY2CMPR can be used in maintaining the mapping of the API and
API Method to FEH Process.
Enter the API Name ZPIII_EMPLOYEE_ADDRESS_IN, API Method name CREATE, Software
Component YFEH_DEMO name and Business process YFEH_DEMO_BP and Save. Please refer to the
Figure 57.
Figure 57: Map API and API Method to FEH Process
Define Object Types
Go to Transaction SPRO->Cross-Application Components ->General Application Functions ->Post
processing Office ->Object Types->Define Object Types
Custom object types can be defined here and can be processed in the Postprocessing Office.
Figure 58: Define Object Types
How To... Setup Forward Error Handling in PI Scenarios
December 2012 31
Click on New Entries.
Figure 59: Define Object Types
NOTE
The table/view /SAPPO/OBJECT can be used in maintaining object types.
Specify the Component YFEH_DEMO,Object Type YPER_OBJTY and valid Description.
NOTE
The description entered here will be displayed in the Postprocessing Order Edit Overiview page.
Figure 60: Define Object Types
NOTE
There are options for assigning processing methods for object Types. The customizing options
available under SPRO->Cross-Application Components ->General Application Functions -
>Postprocessing Office ->Object Types can be used for this purpose.
Activation of Creation of Postprocessing Orders
Goto SPRO->Cross-Application Components ->General Application Functions ->Postprocessing
Office ->Activate Creation of Postprocessing Orders
The creation of Postprocessing orders for each business process can be activated using this activity.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 32
Figure 61: Activate Creation of Post processing Orders
Click on New Entries.
Figure 62: New Entries
NOTE
The table/view /SAPPO/A_BPROC can be used for maintaining the Active Business Processes.
Enter the details as given in Figure 63.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 33
Figure 63: Activate Creation of Postprocessing Orders
Define Work Lists
Goto SPRO->Cross-Application Components ->General Application Functions ->Postprocessing
Office ->WorkList->Define WorkLists.
Worklists can be defined for the various employees who manually process Postprocessing orders.
Figure 64: Define Work Lists
Click on New Entries.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 34
Figure 65: Define Work Lists
Enter Component YFEH_DEMO, WorkList YWLS and the Work List description. Check Std. Save.
Figure 66: Define Work lists
Assign Work List to Business processes
Goto SPRO->Cross-Application Components ->General Application Functions ->Postprocessing
Office ->WorkList->Assign Worklists to Business processes.
The worklists can be assigned to the Business processes created by you in this activity.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 35
Figure 67: Assign Work lists
Click on New Entries.
Figure 68: Define Distribution Criteria
Enter the details as mentioned in Figure 69.
Figure 69: Define Distribution Criteria
Edit Notifications for Orders in the WorkList
Goto SPRO->Cross-Application Components ->General Application Functions ->Postprocessing
Office ->WorkList->Edit Notifications for Orders in the WorkList
You can make the settings for notifications for newly created Postprocessing orders in this activity.
Figure 70: Edit Notification for Orders in the WorkList
How To... Setup Forward Error Handling in PI Scenarios
December 2012 36
Figure 71: Notifications for Orders in the WorkList
4.5 Test Run
This section describes how the scenario is tested.
As this is a file to proxy scenario, the message can be triggered by placing the file in the source File
folder. Here the RWB Test tool is used for testing the scenario. There are three scenarios which are
tested here.
Test Invalid Data
Go to Runtime Workbench->Component Monitoring->Integration Engine->Test Message->Enter the
Header Information and paste the payload from Appendix D-> Test Invalid Input and click on Send
Message.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 37
Figure 72: Runtime Workbench Test tool
Here the Employee No 00000000 is entered in the message payload.
Go to Transaction SXI_MONITOR in the PI Integration Server for Monitoring messages.
Figure 73: Message Monitoring in Integration Server
Go to the transaction SXI_MONITOR in the Receiver Application System for Monitoring messages.
Figure 74: Message Monitoring in Receiver System
A green arrow is displayed as the message is transferred to ECH.
The Postprocessing Orders can be displayed using the transaction ECH_MONI_SEL
Figure 75: ECH Message Monitoring
The Orders can be filtered based on various filter Criteria.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 38
Figure 76: ECH Postprocessing Orders
Figure 77: ECH Postprocessing Orders
How To... Setup Forward Error Handling in PI Scenarios
December 2012 39
Figure 78: ECH Postprocessing Orders
Figure 79: ECH Postprocessing Orders
The Post Processing Order corresponding to the message sent from PI is as seen in Figure 80.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 40
Figure 80: ECH Message Monitoring for Pernr 00000000
Expand it and double click on the item.
Figure 81: PPO Edit Order for Pernr 00000000
The Order details and the Message data can be viewed here. If the Processing Method Display is
selected, the message details can be viewed.
As this order has invalid data i.e. Personnel No 00000000, it cannot be processed further. Select the
Process button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 41
Figure 82: PPO Edit Order: Process
Enter the Comment as seen in Figure 83 and click on Save button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 42
Figure 83: PPO Edit Order: Cancel
Click on Discard button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 43
Figure 84: PPO Edit Order: Discard
The message text is updated with the discard information.
Figure 85: PPO Edit Order: Discard
Press Back button. The Order is updated with the new information in the Postprocessing Desktop Edit
Order: Overview.
Figure 86: PPO Edit Order: Discard
How To... Setup Forward Error Handling in PI Scenarios
December 2012 44
Test Payload Edit
Go to RWB->Component Monitoring->Integration Engine->Test Message->Enter the Header
Information and paste the payload from Appendix D-> Test Payload Edit and click on Send
Message.
Figure 87: Runtime Workbench
A valid employee number is entered. The fields Address Type and Region are having invalid data.
In the Receiver, go to transaction ECH_MONI_SEL and click on Execute.
A new Postprocessing Order is created. The Personnel no is ‚00000001.Double click on the Item.
Figure 88: PPO Edit Order: Overview
How To... Setup Forward Error Handling in PI Scenarios
December 2012 45
The Postprocessing Edit Order details are displayed. Click on Process button.
Figure 89: PPO Edit Order: Process
Click on Change under Processing Methods in the Message Data tab.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 46
Figure 90: PPO Edit Order: Change
The Payload Details are displayed. The Region and the Address type are changed to 10 and 3
correspondingly and the Comment is updated. Click on Save.
Figure 91: PPO Edit Order: Change payload
The following message is displayed. Click on the tick mark.
Figure 92: Payload Version
Enter the Comment Reprocess in the Edit Order Details page.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 47
Figure 93: PPO Edit Order: Reprocess
Click on Repeat button. This will reprocess the data with the new payload.
Figure 94: PPO Edit Order: Repeat
How To... Setup Forward Error Handling in PI Scenarios
December 2012 48
The order is updated with the new status.
Figure 95: PPO Edit Order: Overview
To verify whether the data is updated in the system, go to the transaction PA20 in the ERP system.
Figure 96: Transaction PA20
Enter the Personnel No 1.Select the Infotype I0006 and Subtype as 3.Here 3 denotes the Address
Type. i. e Home Address. Click on Display.
Figure 97: Transaction Display HR Master Data
The address details are displayed.The new data is updated in the ERP system.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 49
Figure 98: Display Address
Test Confirmation
Go to RWB->Component Monitoring->Integration Engine->Test Message->Enter the Header
Information and paste the payload from Appendix D->Test Payload Confirmation and click on Send
Message.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 50
Figure 99: Runtime Workbench
The Address Type used here is 2.
In the Receiver, go to transaction ECH_MONI_SEL and click on Execute.
A new Postprocessing Order is created. The Personnel no is ‚00000001.Double click on the Item.
Figure 100: Postprocessing Desktop Edit Order
Here the error occurred as the Region is given as KAR which is not defined for country IN. In this test,
the address details will be manually created using the transaction PA30.
Go to the ECC system->transaction PA30.Enter the Personnel No 1.Select the Infotype I0006
and Subtype 2 as the Address Type is 2.Click on Create button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 51
Figure 101: Transaction PA30
Enter the following details as in Figure 102 and click on Save.
Figure 102: Create Address
The Address Details are created manually.
Go to transaction ECH_MONI_SEL in the Receiver Application System and Execute. Double click on
the Item. Click on Process button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 52
Figure 103: Postprocessing Desktop Edit Order: Process
Enter the Comment as seen in Figure 104 and click on Save.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 53
Figure 104: Postprocessing Desktop Edit Order: Confirm
Click on Confirm button.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 54
Figure 105: Postprocessing Desktop Edit Order: Confirm
The Message Text is updated with the confirmation message.
How To... Setup Forward Error Handling in PI Scenarios
December 2012 55
Figure 106: Postprocessing Desktop Edit Order: Confirm
The message status is updated in the overview page.
Figure 107: Postprocessing Desktop Edit Order: Confirm
NOTE
For viewing the messages for your user the transaction ECH_MONI also can be used.
Figure 108: Transaction ECH_MONI
How To... Setup Forward Error Handling in PI Scenarios
December 2012 56
Figure 109: ECH Message Monitoring
How To... Setup Forward Error Handling in PI Scenarios
December 2012 57
5. Appendix
Appendix A - Help Documentation
http://help.sap.com/erp2005_ehp_05/helpdata/en/50/b4c373544e425891e128994ea4c9aa/content.ht
m
http://help.sap.com/saphelp_nw70ehp3/helpdata/en/cd/798aa3c7754c61b2f2d50ea7b66aac/content.h
tm
Appendix B - SDN References
http://wiki.sdn.sap.com/wiki/display/ABAPConn/Error+and+Conflict+Handler+%28ECH%29
http://scn.sap.com/community/pi-and-soa-middleware/blog/2011/02/24/pixi-forward-error-handling-feh-
for-asynchronous-proxy-calls-with-the-use-of-error-and-conflict-handler-ech
http://scn.sap.com/community/pi-and-soa-middleware/blog/2011/02/27/pixi-forward-error-handling-feh-
for-asynchronous-proxy-calls-with-the-use-of-error-and-conflict-handler-ech-part-2
http://scn.sap.com/blogs/ttrapp/2011/02/23/forward-error-handling-part-1-outline
http://scn.sap.com/blogs/ttrapp/2011/02/28/forward-error-handling-a-short-look-at-sap-business-suite-
ehp-4
How To... Setup Forward Error Handling in PI Scenarios
December 2012 58
Appendix C – Source Code References
Proxy Method
METHOD zpiii_employee_address_in~create.
DATA: lr_fault_msg TYPE REF TO zpicx_employee_address_fault.
DATA: lo_feh TYPE REF TO zcl_feh_action.
SET UPDATE TASK LOCAL.
CALL METHOD zcl_feh_action=>create
RECEIVING
ro_feh = lo_feh.
TRY.
CALL METHOD lo_feh->execute
EXPORTING
is_input = input.
CATCH zpicx_employee_address_fault INTO lr_fault_msg.
RAISE EXCEPTION lr_fault_msg.
ENDTRY.
ENDMETHOD.
S_CREATE Method
METHOD if_ech_action~s_create.
r_action_class = create( ).
ENDMETHOD.
CREATE Method
METHOD create.
IF NOT go_ech_action IS BOUND.
CREATE OBJECT go_ech_action.
ENDIF.
ro_feh = go_ech_action.
ENDMETHOD.
FINISH Method
method IF_ECH_ACTION~FINISH.
CALL METHOD cl_feh_registration=>s_finish
How To... Setup Forward Error Handling in PI Scenarios
December 2012 59
EXPORTING
i_data = i_data
IMPORTING
e_execution_failed = e_execution_failed
e_return_message = e_return_message.
endmethod.
FAIL Method
method IF_ECH_ACTION~FAIL.
CALL METHOD cl_feh_registration=>s_fail
EXPORTING
i_data = i_data
IMPORTING
e_execution_failed = e_execution_failed
e_return_message = e_return_message.
endmethod.
RETRY Method
METHOD if_ech_action~retry.
DATA: lr_feh_registration TYPE REF TO cl_feh_registration,
lr_fault_msg TYPE REF TO zpicx_employee_address_fault,
ls_post_mapping TYPE zpiemployee_address_mt,
ls_pre_mapping TYPE zpiemployee_address_mt,
ls_return TYPE bapiret2.
***FEH Instance for Retry created
lr_feh_registration = cl_feh_registration=>s_retry( i_error_object_id = i
_error_object_id ).
***Retrive data
CALL METHOD lr_feh_registration->retrieve_data
EXPORTING
i_data = i_data
IMPORTING
e_pre_mapping_data = ls_pre_mapping
e_post_mapping_data = ls_post_mapping.
TRY.
***Repeat the Application processing
me-
>process( EXPORTING input = ls_post_mapping i_ref_registration = lr_feh_reg
istration i_reprocess = abap_true
IMPORTING es_return_message = ls_return ).
CATCH zpicx_employee_address_fault INTO lr_fault_msg.
***Resolve Retry
How To... Setup Forward Error Handling in PI Scenarios
December 2012 60
lr_feh_registration->resolve_retry( ).
ENDTRY.
ENDMETHOD. "if_ech_action~retry
PROCESS Method
METHOD process.
*Types Definition for Employee Address Data
TYPES: BEGIN OF gtty_p0006,
employee_no TYPE pernr_d,
begin_date TYPE begda,
end_date TYPE endda,
address_type TYPE subty,
coname TYPE pad_conam,
street_and_house_no TYPE pad_stras,
sec_address_line TYPE pad_locat,
city TYPE pad_ort01,
district TYPE pad_ort02,
postal_code TYPE pstlz_hr,
state TYPE regio ,
country TYPE land1,
telephone_no TYPE telnr,
END OF gtty_p0006.
*Data Definition
DATA :ls_bapireturn TYPE bapireturn1,
ls_bapireturn1 TYPE bapireturn1,
ls_bapiret2 TYPE bapiret2,
lt_bapiret2 TYPE bapiret2_tab,
ls_standarddata TYPE zpiexchange_fault_data,
ls_logdata TYPE zpiexchange_log_data,
ls_p0006 TYPE gtty_p0006,
ls_object TYPE ech_str_object,
employeenumber TYPE pernr_d,
subtype TYPE subty,
objectid TYPE objps,
lockindicator TYPE sprps,
validitybegin TYPE begda,
validityend TYPE endda,
recordnumber TYPE seqnr.
*Constants
CONSTANTS: lc_error TYPE c VALUE 'E',
lc_high TYPE c LENGTH 4 VALUE 'HIGH',
lc_errcat TYPE ech_dte_error_category VALUE 'CON'.
*Variable Definition
DATA: lo_fehreg TYPE REF TO cl_feh_registration,
lo_exc TYPE REF TO cx_root,
How To... Setup Forward Error Handling in PI Scenarios
December 2012 61
lv_objkey TYPE ech_dte_objkey.
*Address Details moved to the structure
MOVE-CORRESPONDING input-employee_address_mt TO ls_p0006.
*Personnel No assigned as Object key
lv_objkey = ls_p0006-employee_no.
*Enqueue
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
DESTINATION 'ER1CLNT001'
EXPORTING
number = ls_p0006-employee_no
IMPORTING
return = ls_bapireturn1.
*Address create
CALL FUNCTION 'BAPI_ADDRESSEMP_CREATE'
DESTINATION 'ER1CLNT001'
EXPORTING
employeenumber = ls_p0006-employee_no
validitybegin = ls_p0006-begin_date
validityend = ls_p0006-end_date
addresstype = ls_p0006-address_type
coname = ls_p0006-coname
streetandhouseno = ls_p0006-street_and_house_no
scndaddressline = ls_p0006-sec_address_line
city = ls_p0006-city
district = ls_p0006-district
postalcodecity = ls_p0006-postal_code
state = ls_p0006-state
country = ls_p0006-country
telephonenumber = ls_p0006-telephone_no
IMPORTING
return = ls_bapireturn
employeenumber = employeenumber
subtype = subtype
objectid = objectid
lockindicator = lockindicator
validitybegin = validitybegin
validityend = validityend
recordnumber = recordnumber.
*Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
DESTINATION 'ER1CLNT001'
EXPORTING
number = ls_p0006-employee_no
IMPORTING
return = ls_bapireturn1.
*If BAPI returns error
How To... Setup Forward Error Handling in PI Scenarios
December 2012 62
IF ls_bapireturn-type EQ lc_error OR ls_bapireturn1-type EQ lc_error .
IF ls_bapireturn-type EQ lc_error.
ls_bapiret2-type = ls_bapireturn-type.
ls_bapiret2-id = ls_bapireturn-id.
ls_bapiret2-number = ls_bapireturn-number.
ls_bapiret2-message = ls_bapireturn-message.
ELSE.
ls_bapiret2-type = ls_bapireturn1-type.
ls_bapiret2-id = ls_bapireturn1-id.
ls_bapiret2-number = ls_bapireturn1-number.
ls_bapiret2-message = ls_bapireturn1-message.
ENDIF.
APPEND ls_bapiret2 TO lt_bapiret2.
*Forward Error Handling
IF i_ref_registration IS BOUND.
* Provide information for FEH
ls_object-objcat = '1'.
ls_object-objtype = 'YPER_OBJTY'. "Object Type defined
ls_object-objkey = lv_objkey. "Personnel No
ENDIF.
TRY.
*Error symptom transferred to the FEH Instance using the collect method
CALL METHOD i_ref_registration->collect
EXPORTING
i_single_bo = input
i_component = 'YFEH_DEMO' "SWCV Defined
i_process = 'YFEH_DEMO_BP' "ECH Business process
i_error_category = lc_errcat
i_main_message = ls_bapiret2
i_messages = lt_bapiret2
i_main_object = ls_object.
CATCH cx_ai_system_fault.
ENDTRY.
*Populating the Fault Message Type
CONCATENATE text-001 input-employee_address_mt-
employee_no INTO ls_standarddata-fault_text SEPARATED BY space.
ls_logdata-severity = lc_high.
IF ls_bapireturn-type EQ lc_error.
ls_logdata-text = ls_bapireturn-message.
ELSE.
ls_logdata-text = ls_bapireturn1-message.
ENDIF.
APPEND ls_logdata TO ls_standarddata-fault_detail.
CLEAR:ls_bapireturn,ls_bapireturn1,ls_logdata.
*Raising the Fault Message
RAISE EXCEPTION TYPE zpicx_employee_address_fault
How To... Setup Forward Error Handling in PI Scenarios
December 2012 63
EXPORTING
standard = ls_standarddata.
ENDIF.
ENDMETHOD.
EXECUTE Method
METHOD execute.
*Data Definition
DATA: ls_bapireturn TYPE bapiret2,
ls_standarddata TYPE zpiexchange_fault_data,
ls_logdata TYPE zpiexchange_log_data.
*Constants
CONSTANTS: lc_high TYPE c LENGTH 4 VALUE 'HIGH'.
*Variable Definition
DATA: lr_exception TYPE REF TO zpicx_employee_address_fault,
lr_fehreg TYPE REF TO cl_feh_registration.
*Implementation of Forward Error Handling
*Create instance of CL_FEH_REGISTRATION
TRY.
IF lr_fehreg IS INITIAL.
lr_fehreg = cl_feh_registration=>s_initialize( ).
ENDIF.
CATCH cx_ai_system_fault.
ENDTRY.
TRY.
*Executing the process method
CALL METHOD me->process
EXPORTING
input = is_input
i_ref_registration = lr_fehreg
IMPORTING
es_return_message = ls_bapireturn.
*Catch the Exception
CATCH zpicx_employee_address_fault INTO lr_exception.
CONCATENATE text-001 is_input-employee_address_mt-
employee_no INTO ls_standarddata-fault_text SEPARATED BY space.
ls_logdata-severity = lc_high.
ls_logdata-text = ls_bapireturn-message.
APPEND ls_logdata TO ls_standarddata-fault_detail.
CLEAR: ls_bapireturn,ls_logdata.
*Raise Exception
How To... Setup Forward Error Handling in PI Scenarios
December 2012 64
RAISE EXCEPTION TYPE zpicx_employee_address_fault
EXPORTING
previous = lr_exception
standard = ls_standarddata.
ENDTRY.
ENDMETHOD.
Appendix D - Test Data
Test Invalid Input
<?xml version="1.0" encoding="UTF-8"?>
<ns0:EmployeeAddress_MT xmlns:ns0="http://test.com/EmployeeAddressCreate">
<EmployeeNo>00000000</EmployeeNo>
<BeginDate>20120802</BeginDate>
<EndDate>99991231</EndDate>
<AddressType>Z</AddressType>
<COName>SM</COName>
<StreetAndHouseNo>Street1</StreetAndHouseNo>
<SecAddressLine/>
<City>Bangalore</City>
<District/>
<PostalCode>101010</PostalCode>
<State>KAR</State>
<Country>IN</Country>
<TelephoneNo>1110000000</TelephoneNo>
</ns0:EmployeeAddress_MT>
Test Payload Edit
<?xml version="1.0" encoding="UTF-8"?>
<ns0:EmployeeAddress_MT xmlns:ns0="http://test.com/EmployeeAddressCreate">
<EmployeeNo>00000001</EmployeeNo>
<BeginDate>20120802</BeginDate>
<EndDate>99991231</EndDate>
<AddressType>Z</AddressType>
<COName>SM</COName>
<StreetAndHouseNo>Street1</StreetAndHouseNo>
<SecAddressLine/>
<City>Bangalore</City>
<District/>
<PostalCode>101010</PostalCode>
<State>KAR</State>
<Country>IN</Country>
<TelephoneNo>1110000000</TelephoneNo>
</ns0:EmployeeAddress_MT>
Test Confirmation
How To... Setup Forward Error Handling in PI Scenarios
December 2012 65
<?xml version="1.0" encoding="UTF-8"?>
<ns0:EmployeeAddress_MT xmlns:ns0="http://test.com/EmployeeAddressCreate">
<EmployeeNo>00000001</EmployeeNo>
<BeginDate>20120802</BeginDate>
<EndDate>99991231</EndDate>
<AddressType>2</AddressType>
<COName>SM</COName>
<StreetAndHouseNo>Street1</StreetAndHouseNo>
<SecAddressLine/>
<City>Bangalore</City>
<District/>
<PostalCode>101010</PostalCode>
<State>KAR</State>
<Country>IN</Country>
<TelephoneNo>1110000000</TelephoneNo>
</ns0:EmployeeAddress_MT>
www.sdn.sap.com/irj/sdn/howtoguides