Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
MichalKrawczyk
Active Contributor


Forward Error Handling is a relatively new (as it already existed in the past in some scenarios) concept of monitoring and solving errors in asynchronous message processing on the receiver's endpoint. SAP application systems use Error and Conflict Handler (ECH) to implement FEH into real scenarios with the use of PostProcessing Office. As of EhP4 for ERP (and generally SAP Business Suite 7.0) ECH is integrated with PI/XI's local monitor and you can start handling all the proxy errors with it's use. What does it mean in general? It means that as of now you don't need to relay on handling proxy errors with XI monitor but you can a much better tool which (PostProcessing Office) which works more like IDOC monitor for IDOC messages.

Why would I want to use it?

As soon most of SAP's proxy messages (also Web Services) will be using that as a standard way to handle errors.

How can I implement it then?

At first I will show you a typical customizing and configuration on how you can forward all of your proxy messages into ECH and in the next blogs I will continue with the rest of ECH's functionalities, like reprocessing messages, changing messages, setting different statuses (complete, fail) and also how to configure some of those post processing activities to run automatically.

Scenario's Description

Our inbound proxy in ERP system normally used to throw an exception in case something went wrong. We will try to change this behavior and whenever an exception should be thrown we will pass the message to the ECH service in order to be able to process it in PostProcessing Office.


Step 1.

At first you need to active FEH in your SAP Application client and you can do that using SPRO menu:

- Cross Application Components
- -  Processes and Tools for Business Applications  
- - - Enterprise Services
- - - - Error and Conflict Handler
- - - - - Activate Error and Conflict Handler (view - FEHV_ACTIVE)



Step 2.

The second step is to create an ECH business process - YDEMOTEST in my example - which you need to assign to your proxy class and set up it's persistence with CL_FEH_MESSAGE_PERSISTENCY

- Cross Application Components
- -  Processes and Tools for Business Applications  
- - - Enterprise Services
- - - - Error and Conflict Handler
- - - - - Define Process Data



Step 3.

Now you also need to create a business process in the PostProcessing Office - via a view - /SAPPO/VS_BPROC




Step 4

Then you need to assign ECH business process to PPO business process using

- Cross Application Components
- -  Processes and Tools for Business Applications  
- - - Enterprise Services
- - - - Error and Conflict Handler
- - - - - Define Postprocessing  (view ECHS_PP_PROCESS)





Step 5
The only configuration left would be to assign proxy method to the FEH process and you can do this using a view - FEHV_PROXY2CMPR.





Now it's time to do the coding in our proxy where we'll need to call ECH whenever the exception should be thrown.

Step 6


We need to add a new interface IF_ECH_ACTION to the proxy class as shown in picture below.



and once you add this you should see a few new methods in your class.



Step 7

The only last thing you need to add is an attribute - GO_ECH_ACTION which is a static attribute assigned to your class.




Step 8

The code below will call ECH once the proxy's exception is thrown (so please remember to call the proxy exception with the use of fault messages) and you need to insert it into your main proxy's method. As you can see we need to call method collect of the class cl_feh_registration in order to send the message to ECH. You need to populate at least ls_bapiret struture in order to send an error description to the ECH.

 

DATA:  lr_feh_registration   TYPE REF TO cl_feh_registration,
       l_error_category      TYPE ech_dte_err_category,
       ls_main_object        TYPE ech_str_object.

     lr_feh_registration = cl_feh_registration=>s_initialize( ).
     l_error_category = 'DCE'. "as per table  /SAPPO/SERR_CAT.

     ls_main_object-objcat  = '1'.
     ls_main_object-objtype = 'SFLIGHT'.
     ls_main_object-objkey  = l_flight_id.

*for objtype please have a look at table /SAPPO/S_OBJECT


*====IMPORTANT=====
*please  remember that you can put anything (like Order, Delivery number,  Partner ID, etc.) into the objkey value and this can later on help you  in selecting the correct message in the PostProcessing Office
*====IMPORTANT=====

     TRY.

       CALL METHOD lr_feh_registration->collect
         EXPORTING
           I_SINGLE_BO      = ls_api_data
           I_ERROR_CATEGORY = l_error_category
           I_MAIN_MESSAGE   = ls_bapiret
           I_MESSAGES       = lt_bapiret
           I_MAIN_OBJECT    = ls_main_object.

      CATCH cx_ai_system_fault. "messages are not forwarded to FEH, XI monitor is used

     ENDTRY.



Step 9


We also need to instantiate the s_create method of the new interface with the code below. 

  if NOT go_ech_action IS BOUND.
    CREATE OBJECT go_ech_action.
  endif.
  r_action_class = go_ech_action.

 

Testing the scenario

 

Once you run the message and the error should happen you should be able to see the message with a new status in local PI monitor (transferred to external application)




and also from the PostProcessing Office - /SAPPO/PPO2 transaction.





Once you select the message you should be able to see the details (like all errors) and also be able to view the content of the message.


Second part of the article:

PI/XI: Forward Error Handling (FEH) for asynchronous proxy calls with the use of Error and Conflict ...

 


NOTES:

There are some new features planned for future releases of ECH like new payload editor, attachments handling, support for payload attribute searches but for details on those we need to wait for SAP's official info.

30 Comments
Labels in this area