In my previous blog “SAP Intelligent RPA – Asset Depreciation Run Automation“, we saw, how we can automate the Asset depreciation Run process and capture all log details in a file like below.
So, as per the log captured, we can see the depreciation run could not be completed as the Cost center is blocked. The same need to be unlocked to run the process successfully.
In this blog, we will take it further and will automate the process to correct the error encountered during the depreciation run .
I have built a separate bot to process the errors, it could be included in same bot as per the need.Also, in this case we will be automating the SAP GUI as we have seen the Fiori Automation in Part1.
Step 1 – Create a project in Desktop studio and make sure to enable the Excel , Outlook, and SAP GUI Scripting libraries as we are going to use them in out project.
Step 2. Create an application and capture all the relevant SAP GUI pages that our bot will be navigating through like SAP Logon Pad, SAP Easy access menu, Controlling area input screen Cost center change screens etc.
Steps 2 – Create Workflow and start with initializing the excel and opening the error log file that we are going to read errors from
Step 3 – Start the loop as we have to read the messages from Log file and process the error record.Also set the loop exit criteria . Here , i have used a stopfag , which i am setting to X when all the records have been read.
Step 4 – Next is to read the content from each row and store in a variable. Here i am extracting the Message description column as i need to extract Controlling Area and cost center.
Step 5 – Fetch the string at specific position in error message as we are looking for specific value at that position i.e Cost Center in this case. Also i am using switch activity to control the flow of actions based on error type. In this case , if error is cost center blocked , bot is going to perform steps related to that. Similarly, we could have multiple branches to process different errors.
Step 6 – The moment loop reaches the cost center error, it transfers the control to specific actions related to cost center unblocking. It starts with login to SAP GUI
Step 7– On the Access menu command bar screen , set the Transaction “KS02” (Cost Center Change) and press enter key
Step 8 – Set the controlling area value , fetched from the error message earlier into the Controlling area field .
Step 9– Wait for Cost center screen to be available and set the cost center value fetched from the error log.
Step 10 – Inside the Cost center change initial screen, we need to navigate to the “Control tab”, so put a click action on the Control tab.
Step 11 – On the control tab properties. Uncheck the “Actual Primary costs” checkbox.
Step 12 – So, we have unblocked the cost center and we update the status in log file for the same. But, there could be more blocked cost center errors in the log, so we need to loop back to the next row in the error log excel we are looping on.
Step 13 – Once all the rows in log file are processed , exit loop will be processed and the control will be out of loop. The next step will be to save the update log file and send the same to user over email.
With the we have automated the blocked cost center error from the Asset Depreciation Run error log. Similarly, other errors could be included as different branches of Switch control and we can automate all possible errors.
The complete workflow looks like this
So, its demo time now 🙂
Keep Learning & Keep Sharing!!