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: 
Harsh_Bansal
Contributor
14,396
This blog post is to share solution of the recent problem I faced in SAP Fiori My Inbox App and Notification Center with all of you

Presumptions

  • My Inbox Fiori App has been configured

  • Notification Center (if required) has been configured


Problem

I faced this problem when I used the Send Mail step to send Notification in a Workflow.


 

In SAP GUI it was working perfectly. These get displayed in Unread Documents/Documents Category of SAP Business Workplace (SBWP) -


 

But these were missing in the My Inbox app and also the Notification Center. While trying to find a solution for this, I saw the SAP Note shown below and came to this conclusion -
My Inbox app and Notification Center in Fiori Launchpad do not support the Background Tasks of the Workflow. Only the workitems of User Decision dialog steps/tasks are shown there. 


 

Solution

Go to the Control Tab of the Workflow Step and open the Task -


 

To make it a User Decision Task, Uncheck the Background Processing Checkbox and Check the Confirm end of Processing as shown below -


 

Confirm end of Processing will provide the decision step button called "Complete Workitem" in SAP Business Workplace (SBWP). The name itself clarifies that this button is used to complete the Workitem. Hence, after user action, workitem will be moved out of the Open Workitems Category in SBWP (Though it will be still in Documents category).

After making this change, the workitem will start appearing in My Inbox and Notification Center. And we have achieved our 1st milestone. 🙂

As you can see in the screenshot below, the User Decision button "Complete" is missing in Fiori My Inbox app -


 

Because of this Send Mail Workitems will never move out of My Inbox, as a result it will get too much of load. So, let's start the next step.

What we need to do is a small configuration to get the Decision Step Button in My Inbox app. Go to -
SPRO -> SAP NetWeaver -> SAP Gateway Service Enablement -> Content -> Workflow Settings -> Maintain Task Names and Decision Options


 

Enter the Workflow ID and Step ID of the Send Mail Task in Workflow. Then, mark the entry and select "Decision Keys" -


 

Enter these values now -

  • Decision Key - Numeric value. This we will get back in return after user action

  • Decision Text - Use any Description for the button which is suitable as per Users

  • Nature of the Decision - Positive/Negative/Neutral, this will manage the color of the button


I have configured it as "Complete" -


 

Now the "Complete" Button will start showing in My Inbox -


 

But pressing this button will not give any result as of now. For that, we need to implement a BADI - /IWWRK/BADI_WF_BEFORE_UPD_IB. In this, we get the "Decision Step" taken by the user and it can be processed as per requirement.

BADI Implementation - Z_MYINBOX_NOTIF_WF


 

Filter values in the BADI Implementation should be filled with the Workflow ID and Step ID of the Send Mail Task in Workflow, so that it gets executed only for these -


 

There is only one method, /IWWRK/IF_WF_WI_BEFORE_UPD_IB~BEFORE_UPDATE, available which is sufficient for our requirement -


 

Code Snippet -
  METHOD /iwwrk/if_wf_wi_before_upd_ib~before_update.
*&--------------------------------------------------------------------&*
*& Revision Log &*
*& Date : 05-Jun-2020 &*
*& Author : Harsh Bansal (BANSAL) &*
*& Revision Tag : Initial Version &*
*& Description : Complete Workitem in MyInbox after User Decision &*
*&--------------------------------------------------------------------&*

* Local Data Declaration
DATA: lv_subrc TYPE sy-subrc,
lv_status TYPE sww_wistat.

CLEAR: lv_subrc,
lv_status.
IF iv_decision_key EQ '0001'.
* Status: Ready to Committed Status
CALL FUNCTION 'SAP_WAPI_WORKITEM_COMPLETE'
EXPORTING
workitem_id = is_wi_details-wi_id
IMPORTING
return_code = lv_subrc
new_status = lv_status.
IF lv_subrc EQ 0
AND lv_status NE 'COMPLETED'.
CLEAR: lv_status.
* Status: Committed to Completed Status
CALL FUNCTION 'SAP_WAPI_WORKITEM_COMPLETE'
EXPORTING
workitem_id = is_wi_details-wi_id
IMPORTING
return_code = lv_subrc
new_status = lv_status.
ENDIF.
ENDIF.

ENDMETHOD.

 

To complete the workitem and move it out of the My Inbox app when user presses the "Complete" button, we have to call the FM - SAP_WAPI_WORKITEM_COMPLETE

As you can see it has been called twice, that's because after running one time, it just changes the status of workitem from "READY" to "COMMITTED" only. That's why it has to be called again and now after execution, status of the workitem gets updated to "COMPLETED" and workitem will be moved out of My Inbox app
Note - Check on Decision Key value is based on the configuration we did earlier

 

Conclusion

Changes to be done -

  • Uncheck Background Processing and Check Confirm end of Processing in Send Mail Task

  • Configuration to get the Decision Step Button in My Inbox

  • BADI Implementation to complete the workitem after user action


 

That's it, now every time this workflow will be triggered, it will be available in SAP Business Workplace (SBWP), Fiori Launchpad My Inbox app and Notification Center. After user action SAP_WAPI_WORKITEM_COMPLETE in BADI will change the status of Workitem to "COMMITTED" and then "COMPLETED". Finally, it will be cleared out from all the platforms.

 

Voila! We have reached our goal 🙂


 

Thank You !!
25 Comments
Labels in this area