Skip to Content
Event Information
Author's profile photo Rajannya Sarkar

SAP Fiori Collaboration With Finance Payment Proposal Workflow

Introduction :

As you already aware regarding the Payment Proposal Workflow in SAP Finance, earlier it was triggered from SAP GUI and the decision whether it should be approved or rejected, this action was performed from SAP GUI itself. However, I came across this solution in S4 with Fiori integration with Payment Proposal Workflow.

In this solution, once the workflow is triggered from SAP GUI, it will be sent to Fiori inbox of the respective Approver. Now from Fiori inbox, approver can review the workflow and accordingly approve or reject the proposal from Fiori itself.

Hence I wanted to share my experience and concept on how this Fiori collaboration with business workflow can be implemented in S4. Hope this blog will be beneficial to everyone.

 

  1. Current Functionality (AS-IS):

Standard workflow WS23200018 creates payment proposal workitem in My Inbox Fiori app with buttons like below. There is no explicit Approve and Reject button. Approvers needed to go to the ‘Open Task’ and approves from there or from SAP GUI. Till now Rejection was not possible from here.

 

                                                             Fig 1: Fiori My Inbox

 

  1. Business Needs & Requirements (TO-BE):

As per the business requirement, need to add ‘Approve’ and ‘Reject’ button explicitly in this workitem and Functionality needs to be implemented like below –

  1. Once the Payment Proposal is created in SAP, a workitem is sent to My Inbox of Approver with Approve & Reject Button. Once this is sent, a notification mail needs to be triggered to Approver’s outlook mail that a workitem is ready for your approval.
  2. Once he Approves, a mail needs to be triggered to initiator and a group mail id that this workitem is approved. For this approval, Payment run is processed in background. Once all process is done, a confirmation mail is sent to initiator that the whole process is completed.
  3. Once he Rejects, a mail needs to be triggered to initiator and a group mail id that this workitem is rejected. Once this is rejected, no payment run will be triggered. Initiator can delete the proposal from F110 and recreate it and send for approval accordingly.

 

  1. Proposed Solution:

 

  • Standard workflow and sub workflow needs to be copied to Custom workflow and sub workflow. Make required changes in custom ones.
  • Approve and Reject custom buttons will be added for Fiori by setting configuration in SPRO.
  • A Filter BADI needs to be implemented for these two buttons functionality.

 

  1. Implemented Solution Steps:

          Flow Chart of Entire Process –

  • Solution Approach: Requirement 1:

 

Once the Payment Proposal is created in SAP, a workitem is sent to My Inbox of Approver with Approve & Reject Button. Once this is sent, a notification mail needs to be triggered to Approver’s outlook mail that a workitem is ready for your approval.

 

  • Goto F110 Tcode – we create payment proposal

                                               Fig 2:  Proposal Creation – F110 Tcode

  • For this development, we have created custom workflow WS90200005 and subworkflow WS90200006 by coping below standard workflow WS23200018 and subworkflow WS23200017.
  • Once the proposal is created from F110, a workitem will be sent to My Inbox Fiori with Approve and Reject

To add this functionality, Approve and Reject button to a specific workitem ‘Payment Proposal Processing’ of the sub WF WS90200006, we need to do a settings in SPRO with the Corresponding Task No. and Step No.

                                            Fig 3: Proposal Processing Task & Step

 

Copy this Task no – TS23200014,

Step no – 000053,

Workflow no – WS90200006.

Go to SPRO -> Maintain Task Names and Decision Options -> Follow the below steps

 

                                     Fig 4: Workflow Task & Step config path in SPRO

                                       Fig 5: Adding Custom Decision Keys in SPRO

  • Save and Activate SPRO.

Now check Fiori Workitem of Approver – Approve and Reject Button is added to workitem.

                                             Fig 6: Custom Buttons are added in Fiori

  • Now once this workitem is triggered, a notification mail needs to be sent to approver that some workitem is ready for your approval.

To cater this, we put a Custom mail step ‘Notification Mail To Approvers’ in sub WF WS90200006 just before the workitem creation step. Approver got the mail in Outlook.

                                        Fig 7: Notification Mail step in Workflow to Approvers

 

  • Solution Approach: Requirement 2 and 3:

 

  • Once he Approves, a mail needs to be triggered to initiator and a group mail id that this workitem is approved. For this approval, Payment run is processed in background. Once all process is done, a confirmation mail is sent to initiator that the whole process is completed.

 

  • Once he Rejects, a mail needs to be triggered to initiator and a group mail id that this workitem is rejected. Once this is rejected, no payment run will be triggered. Initiator can delete the proposal from F110 and recreate it and send for approval accordingly.

 

To implement the Approval and Rejection Functionality of Fiori, SAP has provided a Filter BADI ‘/IWWRK/BADI_WF_BEFORE_UPD_IB’. As we want to activate the BADI only for Payment Proposal decision purpose, we need to put filter condition which would be same as SPRO setting’s workflow and step number i.e.

Workflow No. – WS90200006 and Step No. – 53.

                                      Fig 8: Filter Values of the BADI Implementation

 

The entire logic for Approve and Reject buttons functionality is written in the config part in the above mentioned BADI.

  • For Approval and Rejection, custom mail step is created in sub WF as shown below:

                                     Fig 9: Custom Notification Mail step to Initiators

From ‘Payment Proposal Processing’ step, 3 things will be passed to sub WF through binding from Fiori and BADI –

  • Decision Key – ‘A’ for Approve or ‘R’ for Reject
  • Reviewer Name
  • Attachment – if approver puts any comment during approval/rejection and attach any attachment.

After taking decision, in sub WF it will check the Decision in ‘Check Decision’ step. Accordingly, it will send mail with these Attachments and Reviewer Name.

Here one Attachment of comment and Reviewer name is passed to mail for both Approval and Rejection. Outlook mail will be triggered to Initiator’s mail id accordingly.

                               Fig 10: Payment run carried out for Approval – F110 Tcode

 

  • Once Payment run is carried out, a Confirmation mail will be sent to a group of mail ids. This mail step will be added in main WF –

                               Fig 11: Confirmation mail after Payment run carried out

 

Proposal will be in ‘Confirmed’ status in case of Approval. Outlook mail will be triggered to intended   recipient.

  • Similarly For Rejection – Mail will be sent to initiator, Sub and Main WF will not be completed. So Payment run will not happen. Proposal will be reopened again.

 

Hopefully, this blog will help you to get a better understanding and configuration related to Fiori and SAP Business Workflow Solution in SAP S4.

If you like this blog, please give rating and let me know your view. Your comments and feedback are always appreciated.

Please follow my page for upcoming blogs on SAP HANA :

https://people.sap.com/rajannyasarkar

 

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Hao Shi
      Hao Shi

      Hello, thanks a lot for this informative blog. May I also get the detailed steps on how the reject/approve button appear in the Fiori inbox app. Any sample coding in the BADI?

      Author's profile photo Rajannya Sarkar
      Rajannya Sarkar
      Blog Post Author

      Hi Hao,

      Thanks for your appreciation. To answer your questions -

      1. As I mentioned in this blog, approve/reject buttons will be appear only from SPRO config.
      2. Sample reference code in the BADI is like below -

      method /IWWRK/IF_WF_WI_BEFORE_UPD_IB~BEFORE_UPDATE.

      “1. data definition

      DATA ls_object TYPE swr_obj_2.

      DATA lv_objtype TYPE swr_struct-object_typ.

      DATA lv_objkey TYPE SWR_STRUCT-OBJECT_KEY.

      DATA lv_retcode TYPE sy-subrc.

      DATA lt_container TYPE TABLE OF swr_cont.

      DATA ls_container_line TYPE swr_cont.

      DATA lt_msg_lines type sapi_msg_lines.

      DATA lt_msg_struc type sapi_msg_struc.

      DATA FORMNUMBER TYPE SWXFORMABS-FORMNUMBER.

      DATA ls_formabs TYPE swxformabs.

      “2. get workitem ID

      CALL FUNCTION ‘SAP_WAPI_GET_OBJECTS’

      EXPORTING

      WORKITEM_ID            = is_wi_details-wi_id

      *   LANGUAGE               = SY-LANGU

      *   USER                   = SY-UNAME

      *   BUFFERED_ACCESS        = ‘X’

      IMPORTING

      *   LEADING_OBJECT         =

      RETURN_CODE            = lv_retcode

      LEADING_OBJECT_2       = ls_object

      TABLES

      *   OBJECTS                =

      MESSAGE_LINES          = lt_msg_lines

      MESSAGE_STRUCT         = lt_msg_struc

      *   OBJECTS_2              =

      .

      “3. Get document number

      MOVE ls_object-instid TO formnumber.

      *4. Get decision result

      CLEAR lt_container.

      CALL FUNCTION ‘SAP_WAPI_READ_CONTAINER’

      EXPORTING

      WORKITEM_ID                    = is_wi_details-wi_id

      *   LANGUAGE                       = SY-LANGU

      *   USER                           = SY-UNAME

      *   BUFFERED_ACCESS                = ‘X’

      IMPORTING

      RETURN_CODE                    = lv_retcode

      *   IFS_XML_CONTAINER              =

      *   IFS_XML_CONTAINER_SCHEMA       =

      TABLES

      SIMPLE_CONTAINER               = lt_container

      MESSAGE_LINES          = lt_msg_lines

      MESSAGE_STRUCT         = lt_msg_struc

      *   SUBCONTAINER_BOR_OBJECTS       =

      *   SUBCONTAINER_ALL_OBJECTS       =

      .

      “5. Get application data

      select single * from swxformabs into ls_formabs where formnumber = formnumber.

      “6. set decision value to the container.

      CASE iv_decision_key.

      WHEN 0001. “Approved

      ls_container_line-value = ‘A’.

      ls_formabs-procstate = ‘A’.

      WHEN 0002. “Rejected

      ls_container_line-value = ‘R’.

      ls_formabs-procstate = ‘R’.

      ENDCASE.

      “7. Set result

      “_WI_RESULT is what the workflow keys off to determine

      “which path to follow – Approve or Reject path

      ls_container_line-element = ‘_WI_RESULT’.

      “Modify the workflow’s container data – we are updating the row that

      “holds _WI_RESULT which will be in the second row of the table

      MODIFY lt_container INDEX 3 FROM ls_container_line TRANSPORTING value.

      “8. update container

      CALL FUNCTION ‘SAP_WAPI_WRITE_CONTAINER’

      EXPORTING

      WORKITEM_ID                        = is_wi_details-wi_id

      *   LANGUAGE                           = SY-LANGU

      *   ACTUAL_AGENT                       = SY-UNAME

      DO_COMMIT                          = ‘X’

      *   IFS_XML_CONTAINER                  =

      *   OVERWRITE_TABLES_SIMPLE_CONT       = ‘ ‘

      *   CHECK_INBOX_RESTRICTION            = ‘ ‘

      IMPORTING

      RETURN_CODE                        = lv_retcode

      TABLES

      SIMPLE_CONTAINER                   = lt_container

      MESSAGE_LINES          = lt_msg_lines

      MESSAGE_STRUCT         = lt_msg_struc

      .

      “9. Update the application data

      ls_formabs-approvdate = sy-datum.

      ls_formabs-approvby = sy-uname.

      update swxformabs from ls_formabs.

      *10. Complete the task

      CALL FUNCTION ‘SAP_WAPI_WORKITEM_COMPLETE’

      EXPORTING

      WORKITEM_ID                     = is_wi_details-wi_id

      *   ACTUAL_AGENT                    = SY-UNAME

      *   LANGUAGE                        = SY-LANGU

      *   SET_OBSOLET                     = ‘ ‘

      DO_COMMIT                       = ‘X’

      *   DO_CALLBACK_IN_BACKGROUND       = ‘X’

      *   IFS_XML_CONTAINER               =

      *   CHECK_INBOX_RESTRICTION         = ‘ ‘

      IMPORTING

      RETURN_CODE                     = lv_retcode

      *   NEW_STATUS                      =

      TABLES

      *   SIMPLE_CONTAINER                = lt_container

      MESSAGE_LINES          = lt_msg_lines

      MESSAGE_STRUCT         = lt_msg_struc

      .

      *11. Set confirm

      CALL FUNCTION ‘SAP_WAPI_WORKITEM_CONFIRM’

      EXPORTING

      WORKITEM_ID                   = is_wi_details-wi_id

      *   ACTUAL_AGENT                  = SY-UNAME

      *   LANGUAGE                      = SY-LANGU

      DO_COMMIT                     = ‘X’

      *   CHECK_INBOX_RESTRICTION       = ‘ ‘

      IMPORTING

      RETURN_CODE                   = lv_retcode

      *   NEW_STATUS                    =

      TABLES

      MESSAGE_LINES          = lt_msg_lines

      MESSAGE_STRUCT         = lt_msg_struc

      .

      endmethod.

      Author's profile photo Hao Shi
      Hao Shi

      Thank you much again for your further sharing. We understood, from the note 2765633 - Workflow-ased release of payment proposal and payment approval in BCM, that the original purpose of the workflow is not used for payment approval. However, with your blog, it looks like the payment approval process can be achieved. We then even tried to enhance the workflow with 2 level approval email notification process. However, we met 1 issue, which is, after check decision condition step, how to link approve outcome to Confirmation event so that the background payment run can be executed, and likewise, how to link reject outcome to Reopen event so that the payment proposal can then be further edit or deleted by the initiator.

      Could you kindly shed some lignt on our issue so that we can solve it? Thanks a lot!

      Author's profile photo Rajannya Sarkar
      Rajannya Sarkar

      Hi Hao,

      Hope you are doing great !

      To answer your question that after check decision condition step to link approve/reject outcome to Confirmation event, you need to call event 'Raise_event_confirmed' for Approval and 'Raise_event_reopened’ 'for Rejection of standard class 'CL_PAYMENT_PROPOSAL_WF’, which is running behind the workflow.

      Both will be triggered after Function Module  'SAP_WAPI_WRITE_CONTAINER'. Please check that in debugging mode in which position you need to put that.

      Hope this helps you.

      Regards,

      Rajannya Sarkar

      Author's profile photo Saumya Nair
      Saumya Nair

      First of all thanks for the blog.
      I have created the workflow and implemented the BAdi.

      You have mentioned that we get the decision key, approver name and the attachment in the sub workflow after the approver takes action. I can't find these details in any containers . Can you please elaborate more on this step. Also I was not able to find the _WI_RESULT container, so where can I find the container that we are setting in the BAdi implementation.

      Author's profile photo Bradly Ali
      Bradly Ali

      I'm new to WF , could you share how you combine the main workflow with the subworkflow

      "For this development, we have created custom workflow WS90200005 and subworkflow WS90200006 by coping below standard workflow WS23200018 and subworkflow WS23200017."

      Thank you so much.

       

      Author's profile photo Bradly Ali
      Bradly Ali

      Already found it , its under Steps00016

       

      Author's profile photo Jency Bala Muthiah
      Jency Bala Muthiah

      Hi Rajannya,

      We have copied the main and sub-workflow as suggested in the blog and added a Decision Task in the Sub-Workflow after Step 53, but the tasks are going into error "Error While defining for successor node 000000053"

       

      Not sure what is missing, it would be really helpful if you could help us .

      Regards,

      Jency