Skip to Content

Problem with Exception in a Workflow in Fiori

I had to put the approval of a custom Workflow on Fiori. All settings have already been made and the application is working. In the application, we have two options, approve and disapprove.


In Workflow, the approval step is an Activity, and it has four outcomes. One of these outcomes is the default outcome, and the other three of these outputs are defined by exceptions of the DECIDE Method of the INSTMNTPLN Standard Object.

These are the exceptions:

In the method, these exceptions are throwed through the macro EXIT_RETURN when the Workflow is executed normally through SAP GUI.

The problem is that, in FIORI, I can't use this macro in BADI

/IWWRK/ES_WF_WI_BEFORE_UPD_IB (the recommended BADI to implement in FIORI).

So what happens is that for cases where the user approves the WorkItem by FIORI, the flow follows normally because it follows the flow of the "Step Executed". While when the user rejects, I should divert the flow to exception 1001 and by BADI I can't do this.

Does anyone know how to proceed in this case?

bvae8.png (19.9 kB)
h8qgn.png (19.0 kB)
2byf5.png (11.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 16, 2017 at 08:38 AM

    Hi

    I agree with Mike it is bad design eventhough some SAP workflow are design this way (or standard functionality like on the control tab the Flag process can be rejected that raises an exception)

    However note 2378748 – Workflows with Approval steps with Exceptions as outcome are not supported in My Inbox will inform you officially that exception does not work in myInbox.

    Cheers

    Stephane

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 15, 2017 at 11:07 AM

    This is bad design. An exception represents an error (usually technical, or an unexpected or rare situation), and should not be used to model a standard business process.

    Here you present the user with two buttons and handle the outcome using two different processing types. Bad, for exactly the reason as you are experiencing.

    It's a SAP standard object, but it is a very old object created 1997 and released in R/3 3.1g, so among the very first workflow bits ever created. I guess such design considerations and Fiori interoperability were not an issue back then. :-)

    I would seize the opportunity and rewrite the function in OO or at least redesign the WF to use a standard decision task.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Mike! Thanks again.

      I appreciate your answer and all the options that you gave me.

      I agree with you when you say that "Attaching the original object as an adhoc object always leaves the possibility to open the full view if needed." The fact is that the WF is very large, and at this point, if I replace the step (as you say in 1st option), the Workflow Builder delete all the subsequent steps.

      After I read Stéphane's answer, I'm satisfied to know that there's a SAP Note that advise that there's no way to control exceptions with Fiori. So I find my solution redesigning one flow in WF. I created one new attribute in the WF Container and set value to these attribute in case of REJECT. In WF, I check the new attribute for REJECT in APPROVAL flow. It didn't look very nice, but it was the best option.

      Thank you!