Hi guys, in this article I want to share on tip about SAP PROCESS AUTOMATION when working with Outlook.
REQUIREMENT
In somecases we want get all attachment email, ex: Invoices, Purchase Order List… which parter send through email. After that save attachment into local folder.
Another business process will read attachment in this folder and extract data from it and process next step, ex: approval, import to backend ERP…
DIAGRAM BOX

PREREQUISITES
- SAP BTP Trial account
- Microsoft Outlook with account configured
HOW TO ?
CREATE AUTOMATION PROJECT
- Go to SAP Process Automation Application

- Create new project with type Build an automated process



CONFIGURATION AUTOMATION AND WORKING WITH GET EMAILS NUMBER CONTEXT
- Next you have to install and confguration Desktop Agent on your local machine. In this article I do not talk about how to install and configure Desktop Agent. It will be in another tip in my blog.
- Consider you installed and configured Desktop Agent, next we will choose right version of Desktop Agent which installed in our local machine.

- Put name for project


- Add Outlook SDK Dependency



- Drag Open Outlook Instance

- Drag Search Email

- Configure for Search Email

folder | Folder name which you want to get email |
storeName | Email address which you want to search mail in there. This mail address have to configure in Microsoft Outlook |
- Drag Get Emails Number context to count how many email in folder and test it by using Log Message context



- Save and Test automation.


WORKING WITH SEND REPLY


- Test automation

HOW TO LOOP EMAIL AND DOWNLOAD ATTACHMENT
- Add Forever loop

- Add Check Current Mail Context

- Base on value isContextCurrentEmailExist of context (true/false) to configure for Condition. If false then LOG MESSGE and end loop, else next loop.


- Else, write log index of email

- Get email ‘s subject


- Add Get Next Email Context in Forever Loop

- Test Automation

- Create variable for folder name
In this step, we will create variable and set value is time stamp.

- Create folder with name is value of variable above


- Add
- Save mail attachment: If you want save one attachment with property attachmentFileName
- Save all mail attachment: If you want to save all attachment with all extension

- Test automation


SUMMARY
In this article I shared how to working with Outlook SDK in SAP Process Automation. This is step 1 and step 2 in diagram box above. After save attachment into folder local, we can create another automation read this attachment file and extract data in there. Thanks for your reading and any advise, kindly leave your comment on this.
Thanks.
Joseph.