Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
mohit_bansal3
SAP Mentor
SAP Mentor
1,829

This is the third and final blog of the series, in which we would like to explain the testing part in detail.

We have kept testing separate in this blog to provide a comprehensive explanation of all scenarios and steps from a technical perspective.

We have prepared the content for this series in three blogs, where we will be diving deep into Design, Development, and Testing.

In the previous blog, @Adwait_Fadnavis  walked you through the complete development process. Now, I would like to start with the testing part.

Detailed Example of the Testing Process

To illustrate the testing process in more detail, let’s walk through an example:

  1. Automation Scheduling: The automation is scheduled to run every 15 minutes. The desktop agent is set up on a virtual machine to ensure it runs in unattended mode.
  2. Dummy Workflow Setup: A dummy workflow is created with fields such as “Request ID,” “Requester Name,” and “Approval Status.” Upon submission, an email is sent to the approver.
  3. Email Response Handling: The approver receives the email and responds with “Approve.” The automation script checks the email subject line and sender’s email address to validate the response.
    1. Invalid Response / Invalid Approver Handling: If the response is not valid or from an unauthorized approver, the system logs the incident and notifies the relevant parties for further investigation.
    2. Approver Handling: If the response is valid or from an authorized approver,  Workflow task will be approved.
    3. Rejection Scenario: If the approver responds with “Reject,” the workflow status is updated to “Rejected,” and an email notification is sent to the requester and other stakeholders.
  4. Workflow Update: The workflow status is updated to “Approved,” and an email notification is sent to the requester and other stakeholders.
  5. Sending Notification Emails: Email Notification to all stake holders involved.

Let's Deep dive above steps in Detail:

Step 1: Automation Scheduled as Background Job

In a real-time scenario, this automation can be scheduled as a background job at intervals of 15 minutes, 30 minutes, or any custom-defined time interval.

The frequency can be adjusted based on the volume of approval tasks. This scheduling ensures that the system checks for new approval requests regularly and processes them in a timely manner.

As mentioned in the first blog, it is mandatory to have the desktop agent running in unattended mode. This setup is crucial for ensuring that the automation runs smoothly without manual intervention.

For real-time business scenarios, we recommend installing the desktop agent on virtual machines to ensure continuous operation and to handle high volumes of approval tasks efficiently.

Job scheduling : SAP Build Process AutomationJob scheduling : SAP Build Process Automation

Step 2: (Optional) Triggering the Workflow -  Prepare the Dummy Workflow for Quick Testing

To facilitate quick testing, we prepared a small workflow using SAP Build Process Automation with a few fields. This dummy workflow simulates the real-time process and helps in validating the automation setup. Although in real-time, the workflow will be triggered via a valid application, here is a snapshot of our dummy workflow for demonstration purposes:

  • Workflow Trigger: Upon clicking the submit button, the workflow is triggered.
  • Email Notification: An email is sent to the approver for approval. This step involves configuring an SMTP outbound email, as mentioned in the previous blog post.

This setup allows us to test the end-to-end process in a controlled environment before deploying it in a live scenarioriggering the Workflow -  Prepare the Dummy Workflow for Quick Testing (Optional)riggering the Workflow -  Prepare the Dummy Workflow for Quick Testing (Optional)

Test for Sending Email for Task CreationTest for Sending Email for Task Creation

Sample Email BodySample Email Body

Triggering Workflow : Testing Demonstrations:

mohit_bansal3_5-1732951671246.png

Process Triggered and Sent for ApprovalProcess Triggered and Sent for Approval

 Step 3: Handling Email Responses

Upon receiving the email, the approver will have three options: a) Approve b) Reject c) Not a valid response

Let’s say the approver starts with “ok” and responds with this in the email.

Upon receiving the response, our automation running as a background job will check if the response is coming from a valid approver and if the subject line is correct (the subject line should not be modified).

This validation step is crucial to ensure that only authorized responses are processed.

Validating Correct ApproverValidating Correct ApproversValidating Correct Approvers Response will be send if the Approver is not valid.

Response will be send if the Approver is not valid.Response will be send if the Approver is not valid.

Validating Correct response: Validating Correct responseValidating Correct response

Step 4: Workflow Update on Approval

If the work item is approved, the workflow will move forward and update the task accordingly. This involves:

  • Updating the Workflow Status: The status of the workflow is updated to “Approved” in the system

Workflow Update on ApprovalWorkflow Update on Approval

  • Notifying Stakeholders: All relevant stakeholders are notified about the approval via email.

Notifying StakeholdersNotifying Stakeholders

Workflow Update on Rejection

Similarly, if the response is “no” or “Rejected,” the work item will be updated, and the workflow will proceed with the rejected branch. This involves:

  • Updating the Workflow Status: The status of the workflow is updated to “Rejected” in the system.

Updating the Workflow Rejection StatusUpdating the Workflow Rejection Status

  • Notifying Stakeholders: All relevant stakeholders are notified about the rejection via email.

Step 5: Sending Notification Emails

An email notification will be sent to all involved parties to inform them of the status of the workflow request. This step ensures transparency and keeps everyone informed about the progress of the approval process.

rejection via emailrejection via email

We hope you enjoyed reading our blog series by me and @Adwait_Fadnavis  on Architecting Email Approval for SAP Build Process Automation Workflows. We trust that this approach provides valuable insights into managing workflow approvals efficiently without relying on manual My Inbox / Task Center approvals.

Thank you for following along with us.

Regards,

Mohit Bansal l, SAP BTP & S/4HANA Architect , Linkedin