In this post, I shall talk about enhancing the standard bot which is available in the SAP Bot store.
Let us take an example of John who works for company, say, ABC. He has several material document lists in the system for which he would like to generate respective GR (Goods Receipt) for a Production Order. He needs the process to be automated where the bot needs to perform the following steps:
- Read the excel template as input which consists of material list
- Automate the Goods Receipt list according to the defined input criteria,
- Download the list
- Send an email to the respective stake holders with the details of the list downloaded in the previous step.
How can this be achieved using SAP bot?
SAP Standard provides MB51 bot which is a “List of Goods-Receipt”. Standard MB51 bot performs the process 1,2 and 3. However, MB51 bot provided by standard does not have the feature of sending emails. We shall now see below how John could automate the standard bot with few simple steps.
Step 1: John logs into the RPA(Robotic process automation) tenant and navigates to the SAP Bot store. He can search for the bot using the Search Criteria “Goods Receipt”. As his design tool is SAP Cloud studio, he selects the highlighted option “Cloud Studio” as shown in the Fig1.
Step 2: Click Get to acquire the bot as shown in Fig2.
Step 3: Now, go to Packages as seen in the below screenshot where you will be able to view the standard bot acquired as shown in Fig3.
Step 4: Select the package and click on the 3 dots as highlighted in the screenshot below.
Click “Save As… New Project” which in turn will create a new project for you as shown in Fig4.1.
A new project has been created using which John will be able to modify the standard bot as shown in Fig4.2.
Step 5: Click on the project to navigate to bot design tool “cloud studio” where the standard bot can be enhanced. Fig5, shows the Cloud studio to design the bot.
Step 6: Amongst the automation steps in Fig 5,
“MB51 Start” is the first step to run as soon as the bot execution starts.
This automation script will first read the Excel template using the path provided in the environment variables. Once the excel contents are read, SAP logon is then initiated to log into relevant system. On successful login, the automation script “MB51 process” is executed.
“MB51 Process” performs the following steps:
- Navigate to t-code MB51,
- Select the required variant to fetch the goods receipts for the material documents read from the excel input in a list.
- The list is saved in the format of an excel file which is saved with a timestamp to uniquely identify the download for current transaction. The excel file will be saved in the file path specified in one of the steps.
- Exit the SAP system.
John identifies that “MB51 process” automation step is the place where he can extract the file name and the path where excel with Goods Receipt list is saved. As shown in the screenshot Fig 6.1, he would need to automate the process after the step name “closeSAP-Application – 3”.
- For email service, Outlook SDK is required to automate this process.
So, he will check whether the outlook SDK is available in the dependencies tab as shown in Fig 6.2.
- If it is unavailable, click “Manage the Project Properties”, a pop-window opens as shown in the Fig 6.3.
- Navigate to Dependencies option.
- Click Add dependency as shown in the Fig 6.4.
- Select the package as “SAP Intelligent RPA Outlook SDK” and click ADD as shown in the Fig 6.5 and 6.6.
- The Outlook SDK gets added in the dependency tab as shown in Fig6.7.
- Once Outlook SDK is available in the dependency tab, John will search in the Tools section for Outlook SDK and he will find all the relevant outlook activities as shown in the Fig 6.8.
Step 7: Add the activities such as Open Outlook Instance, Send Email and Release Outlook instance after the “closeSAP-Applications” as highlighted in the Fig7.
Step 8: John now needs to edit “Send Email” step with relevant information. Before that he needs to identify the File path of excel file with the Goods Receipt list. To retrieve the file path, he needs to click Step set file path and then he can see the Input Parameters.
In the value section there is “outputPath”, he needs to click edit option and can find the file path information as highlighted in the Screenshot Fig 8.1.
It is also critical for John to identify the right excel before emailing to the respective stakeholders. As already mentioned in Step 6 excel is saved with timestamp to uniquely identify the downloaded excel file. John uses the timestamp of the current excel downloaded to identify the excel file uniquely. There is a script provided by SAP for generating the timestamp which can be used as highlighted in the screenshot Fig8.2.
- To set the file path in the email section click the activity “Send email”.
- Select Input parameter as Custom Data as shown in the Fig 9.1.
- Enter the relevant information such as To, CC, Subject, attachment path and so on as shown in the Fig9.2.
- The Excel file name should be unique such that one can identify the excel. So, we identify using the timestamp as shown in the Fig9.3.
- Subject of the Email is uniquely identified using the timestamp as shown in the Fig9.4
Step 10: Save the automation and click test to run the Project as shown in the Fig10.1
- Once the project starts, it will open the excel template from the below folder and reads the excel template as shown in the Fig10.2.
- System details are read along with MB51 transaction parameters as shown in the Fig10.3 and 10.4.
- Opens the SAP GUI and logins to relevant system as shown in the Fig10.5.
- Once logged in, navigates to the MB51 transaction as depicted in the Fig10.6.
- Selects the required variant and it runs the report as shown in the screenshot Fig10.7 to 10.9.
- After the report run, the file will be saved and then downloaded message will be displayed as shown in the Fig 10.10 to 10.12.
- Subsequently, bot sends an email to relevant stake holder as shown in the Fig10.13.
Note: In the above example, John has hardcoded the email id in the step. However, it can also be passed as an input in excel template or as a variable while executing the BOT.