Introduction – Use Case
We are introducing a simpler and faster way to enhance business efficiency and agility with confidence using SAP Build Process Automation. The SAP Build Process Automation gives an opportunity to develop a solution to automatically fetch supplier invoices from five Microsoft 365 email accounts, push them to SAP Business ByDesign and scan for verification and validation. This solution helps to manage labor-intensive, error-prone manual processing of invoices from suppliers.
Challenge
Monitoring five email accounts and downloading a large number of attachments manually from emails and saving them on the computer as well as entering suppliers' invoices into SAP Business ByDesign one by one is a tedious task. The current process is wasting resources while keeping manual processes alive. Additionally, there is a high probability of committing mistakes, while performing repetitive tasks.
In this blog, we are describing a few important aspects that we learned while developing a solution to automate supplier invoice processing with SAP Build Process Automation and setting up a Desktop Agent to run the automation in unattended mode.
Solution
Solution Diagram
The following setup was crucial for this automation to work:
- Enabling the invoice scanning in SAP ByDesign project scope
- Enabling external authentication for accessing multiple Microsoft 365 email accounts
- Creating a service Agent in SAP Business ByDesign
As a first step, we enabled integration with SAP Build Process Automation in the Business Configuration and Implementation Project questions.
We also enabled supplier invoices via PDF scanning. However, we didn’t select the automated invoice creation as we wanted the user to review scanned files before creating an invoice.
To use Microsoft 365 Cloud SDK in our automation and create external authentication for the Desktop Agent to access emails, we first configured an Azure application. In the Azure Active Directory, we created an application registration. We ensured the following:
- Under Certificates & Secrets, we created a new client secret.
- Under API Permissions, we added ‘Mail: Mail.ReadWrite’ as a delegated permission and application permission.
- Under Authentication, we added the following URL as a redirect URI:https://login.microsoftonline.com/common/oauth2/nativeclient
- Under App roles, we created a default app role with a value ‘Agent’.
- Finally, we checked that in the admin section of My apps, in the email apps management, ‘Authenticated SMTP’ was selected.
We created new authentications separately for five email accounts in the Control Tower in SAP BPA using relevant IDs (Client ID, Client Secret, Tenant ID) when configuring the Azure application. The following scope was selected for all authentications: User Read, Offline Access, Open ID, Mail Read/ Write, Mail Send, Files Read/ Write.
Once created, we registered each external authentication on the Desktop Agent. Under Settings/ External Authentication, we entered email addresses of each identity to authenticate and verified the identities with a password.
To use these external authentications in the automation, we added authentication name for each email account in a configuration excel file and used authentication name as part of the input parameter in the 365 online authentication step of the automation.
We discovered that a business user is needed for pushing the PDF attachment to SAP Business ByDesign and kicking off the content recognition, triggered by an API call. As this automation is running in unattended mode, we wanted to create logins that do not expire. Therefore, we created a new Service Agent in the Business Partner Data Work Center in ByDesign and requested a user.
Once saved, we created a new security policy for the newly created business user. In this security policy we left the password validity field blank.
Also, we made sure to give the new business user the appropriate access rights.
Outcome
With the automated supplier invoice scanning process, we reduced the manual invoicing process and the risk of human errors associated with repetitive tasks.