Skip to Content
Author's profile photo Michal Krawczyk

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

In the first part of my article about FEH and ECH PI/XI: Forward Error Handling (FEH) for asynchronous proxy calls with the use of Error and Conflict Handler (ECH)I’ve described how to prepare a custom proxy call to make it use ECH framework for exception handling instead of using standard fault messages. In this part I will concentrate on simple examples of other available methods:

– retry
– fail
– complete

Once you open a message in the PostProcessing Office you can see that there are a few possible ways to handle en error. You can either repeat (in case the error should not happen anymore), confirm (complete the message in case of an authorization issue the message was processed manually) or discard (fail message in case the processing should not be repeated at all).

Retry Method

Within this method you can call the proxy’s method one more time with the same data. The best idea is to copy the standard method into a new one (let’s say DO_APP_PROCESS as in my example) add the same importing parameter and exception but also add bapiret exporting parameters which will indicate if the retry was successful or not this time. If the call was not successful again you just need to invoke the exception and call collect method as show in the first article. Below you can find a very simplified version of an retry method:

DATA: lr_feh_registration TYPE REF TO cl_feh_registration,
      ls_api_data         TYPE YYMT_TEST.

*— Create FEH instance for Retry —————————–*
  lr_feh_registration = cl_feh_registration=>s_retry( i_error_object_id = i_error_object_id ).
*— Retrieve api data stored in ECH framework as XML ———-*

  CALL METHOD lr_feh_registration->retrieve_data
      i_data              = i_data   “XML data
      e_post_mapping_data = ls_api_data.    “typed DDIC structure
*—– Application processing —————————————–*

    me->DO_APP_PROCESS( exporting input = ls_api_data ).

*in your own method (do_app_process) you can have output parameters (bapiret)
*which you can again use to invoke an exception from this method
*once the processing will not be successful – and call the fault exception again

*——- Update FEH to resolve ticklist ——————————-*

  lr_feh_registration->resolve_retry( ).

Now once you use the repeat button you will see that the repeat call was correct.

Confirm method

Within this method you can do multiple things like sending an e-mail message to a correct use that he needs to reprocess the transaction manually, etc. and as the end thing you need to call the finish method as shown in the code below.

   CALL METHOD cl_feh_registration=>s_finish
       i_data             = i_data
       e_execution_failed = e_execution_failed
       e_return_message   = e_return_message

When you confirm the message in the PostProcessing Office the status should get updated accordingly.

Fail Method

The last method should be used when you cannot do anything with the message and just want to delete it’s status so it will not longer be reprocessed by anyone. You can also send e-mails and other alerts from it prior to calling the s_fail method as shown below.

*— Update status in FEH ——————————————–*

  CALL METHOD cl_feh_registration=>s_fail
      i_data             = i_data
      e_execution_failed = e_execution_failed
      e_return_message   = e_return_message.

Again using this method should update the status of the message in ECH.

Using any of the buttons/methods described should udpate the global message status.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Is this availble on the SAP Provided services? If so do you still need to add code (can you add code) or is it built in? 
      Author's profile photo Former Member
      Former Member

      Hello  Michal,

      I was trying to set up the email alert for one standard interface ERPEmployeeTimerequest_in.

      The software component is CA-SOA-ESM-ERP-HR and business process is EETME_RQ.

      The steps were

      1. Define business process in post processing.

      2. Define priority to Business process.

      3. Define worklist

      4.Assign worklist to business process

      5.Process notification for orders in worklist -- according to worklist.

      6. Print workbench setting - mail.

      Assigned users in the transaction\SAPPPO\WL_CHANGE.

      When the error is thrown the email is nt trigerred. Can any one let meknow what could be missing.


      Author's profile photo Philippe Addor
      Philippe Addor

      How does this look like in the light of SAP Application Interface Framework (AIF)? Afaik AIF boasts about FEH. But as per this blog, this was already available before and without AIF!?