Skip to Content

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 Handler (ECH) part 2

 

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.

To report this post you need to login first.

29 Comments

You must be Logged on to comment or reply to a post.

  1. Jose Nunes
    Hi Michal,

    It`s nice to see this new (at least, for me) feature. I thought that SAP would never give us a solution for this kind of problems.

    Once, I`ve developed a ABAP program to handle failed messages at receiver side, allowing the user to resend a failed message, search messages based on payload, edit the payload (for some specific cases) etc.

    Thanks for you valuable blog! Keep bloggin`!

    (0) 
    1. Michal Krawczyk Post author
      hi Jose,

      > I thought that SAP would never give us a solution for this kind of problems.

      yes, finally something like we02 🙂
      and the best part is that SAP will also be using that for proxies so we need to start using that for customer messages as well 🙂

      Regards,
      Michal Krawczyk

      (0) 
    2. Christoph Gollmick
      Hi Jose,

      the first version is out with Suite 7 (SAP_BS_FND 7.01). Significant enhancements are coming with Suite 7 Innovations 2010 (SAP_BS_FND 7.02), especially a new and much more comfortable payload editor. Further improvements are planned for Suite 7i2011.

      @Michael, @Tobias, I appreciate your blogs very much, keep on blogging!

      Regards,
      Christoph Gollmick

      (0) 
    1. Michal Krawczyk Post author
      Hi Tobias,

      I was looking for something like that on SDN and did not find any blog so I started writing also yesterday but I didn’t manage to get the printscreens till today 🙂

      Regards,
      Michal Krawczyk

      (0) 
      1. Tobias Trapp
        Your blog is really great – and ECH/FEH ist so useful that there should be even more blogs about it. I already thought about creating a page in the wiki to collect the information which is spread on many different places in help.sap.com. What do you think?

        Best Regards,
        Tobias

        (0) 
  2. Lalit Chaudhary
    Michael
    Search is already there as I am using FEH in SRM here, all you have to do is get the correct XPATH for the field whose value you are searching for.
    Report is ROPS_SE_PUR_SELECT_MESSAGES
    (0) 
  3. Pablo Lopez
    Hi Michal, I’ve been looking for a blog like this for a long time.
    Just a quick question what is r_action_class for? It hasn’t been declared.

    Thanks,
    Pablo

    (0) 
  4. Daniel Graversen
    Hi

    This seems to be something that will remove the use for IDOCs because it is easy for the business to monitor. This seems to be possible to provide the same and more abilities than Bd87.

    Daniel

    (0) 
  5. Pablo Lopez
    Hi Michal, I don’t know in your version of ECC, but in mine I get short dumps if I don’t pass values to the message fields of the bapiret2 table like the the following in the i_main_message parameters.

      ls_bapiret-message = ‘Error message’.
      ls_bapiret-message_v1 = ‘Error message 1’.
      ls_bapiret-message_v2 = ‘Error message 2’.
      ls_bapiret-message_v3 = ‘Error message 3’.
      ls_bapiret-message_v4 = ‘Error message 4’.

    Thanks for helping on this, I think this is the only useful documentation existing around FEH, other than SAP code within the standard Enterprise Services.

    Regards,
    Pablo

    (0) 
  6. Swati Singasane

    Hi Michal

    This is a nice blog on FEH. We are working on ECC 6.0 Enhp 5 and trying to setup FEH.

    I request you to please let us know the view name for Step 2 as we are not able to find the SPRO path for step 2. Are these settings different for Enhp 5?

    Also could you please elaborate on purpose of YDEMOTEST business process. Can we use existing business process in Step 3 and skip step 2. What would be impact?

    Appreciate your help.

    Thanks

    Swati

    (0) 
    1. David Encinas Fernandez

      Hi,

        I also had the same problem but you can find back the menu:

          * Goto SE24 and display IF_ECH_ACTION

           * Click on Documentation

           * And the use the link to ‘Define Process Data’.

         Regards,

              David.

      (0) 
  7. Sivakumar Bandla

    Hi,

    From the last screen shot, where i can see the data of message. Now i select ‘Display’ or ‘Change’ and navigate to list of fields, I could only see the data element behind the fields, but not the field names. Is there any way to see the field names instead of data elements?

    Thanks in advance.

    Regards,

    Siva

    (0) 
  8. Uday Kumar

    Hi Michal,

       I am working on a custom ESR in which we are handling the FEH using the same methods which you have mentioned. Now issue is when there is any error in the proxy FEH is getting called but the status in SXMB_MONI is still showing the checkers flag (Processed successfully) where in for the standard ESR whenever the FEH is called flag set will be Transfer to External Application flag. Can we achieve this through custom ESR’s.

    Thanks & Regards,

    Uday S.

    (0) 
    1. Michal Krawczyk Post author

      Hi,

      >>>. Can we achieve this through custom ESR’s.

      as you see I’m using a custom ESR content in my example and the flag is “transfer to external app” so it’s working,

      Regards,

      Michal Krawczyk

      (0) 
  9. Tushar Das

    Hi michal,

    We are on ECC6 EHP6, I don’t the see the menu you have shown in SPRO, instead I see the below menu. I don’t see the “Define Process Data”, Please guide.

     

    —Error and Conflict Handler

      –Activate Error and Conflict Handler

      –Create Process for a Service Operation

      –Define Business Processes

      –Define Business Process for Postprocessing office

      –Assign Caller to a Business Process

      –Define Resolution Strategy

      –Define Payload attributes

      –Make Payload-Specific settings

    Regards,

    Tushar.

    (0) 
  10. Samiullah Qureshi

    Hi Folks,

    We are using standard proxy(Enterprise services) between SRM and ECC. Our one of the inbound proxy is failing in ECC with status ‘Transfer to external system‘. We are not able to process any of the error messages.

    Do we need to configure ECH to process errored inbound ES (proxy) messages?

    If yes, do i need to configure all the steps shown above(I am not sure as this is standard ES proxy).

    Regards,

    Sami.

    (0) 
  11. Laurie Howard

    Hi all,

    On my current project we are looking to set up include FEH & ECH on PI to our existing PPO setup. However, our PI has just been upgraded to Java single stack and I cannot find any information how these ABAP elements are taken up in a Java only installation.

    If anyone can point me in the right direction, send me a link or some material it would be greatly appreciated.

    Thanks

    Laurie

    (0) 

Leave a Reply