Skip to Content
Technical Articles

Automate business processes using Intelligent Robotics Process Automation – Part 3

In the previous blog post, I walked through the steps required to create a RPA project and capture the screens/pages which will be used by the bot. In this part of the blog, I will walk through the steps required to create a workflow/scenario which will bring together all the pages captured earlier.

Within the Desktop studio, navigate to the workflow section of your existing project to create a new workflow. This is where you will connect all the pages together and add activities/actions to each page. To begin with you scenario, add “Start” and “Close” application from the activities tab to the empty canvas.

Select the “Start” application and in the properties, panel select the application as “SAPLogon750”. This is the application created earlier. Repeat the same for the “Close” application too.

In the pages tab, you will be able to see all the pages which have been captured earlier.

Drag and drop all the pages to canvas and connect them as shown below.

Once sequence of the pages has been defined in the workflow, its time to add activities to each page. In the below example, I’ve selected the SAP Logon page. You would recall that earlier in the blog, we had identified QKX as a page element. I have selected the Double-click activity and use drag and drop to place it on QKX element. This is the only action required on this page. When the RPA bot begins, I want it to launch the SAPGUI and issue a double-click on the QKX system.

Build the project using the icon highlighted below.

Navigate to the “Editor” section in the desktop studio to view the generated JavaScript files. There will be a js file with the name of your workflow and within it you will find several methods corresponding to each page. In the example highlighted below, you can see the code for the double-click activity has been generated.

You could also programmatically define all the activities if you are more familiar with the use of the SDK. For example, after the bot logins to SAPGUI, it needs to issue a OK code VA02 to launch the Sales Order Update transaction. You can use the activity “Set” and drag and drop it to the OK code field (as shown below)

You could also achieve the same by using the Editor section and programmatically set a hard code value like VA02 to the OK code field along with the Enter keystroke.

Rather than hard coding values directly in the script, you could create a JSON file in your project directory and maintain the values here. In the below example, I have placed a parameters.json file within the local folder of the project.

I have maintained the login details along with the Sales order number and the customer reference number which needs to be updated.

{
	"session": {
        "client": "014",
		"user": "MYSAPUSER",
		"pass": "MYPASSWORD"
	},
	"so" : {
		"orderNumber" : "1054",
		"customerRef": "REF_RAP_07"
		}
}

Within the js file, look for GLOBAL.events.START.on method. This method is used to initialize the workflow at the beginning. You can use the below set of commands to extract the data from the JSON file and assign to a variable. Refer to the SDK documentation for more information.

	var rootData = ctx.dataManagers.rootData.create();
	var sPath = ctx.options.path.local + '\\parameters.json';
	var sParams = ctx.fso.file.read(sPath) ;
	var oParams = JSON.parse(sParams);

Notice that values are set to a rootData and passed in the context to all the remaining methods.

Within each of the corresponding page methods, you can obtain access to the rootData and use it to set the context for each element.

Once you have finished the development of your project, you can build it to compile the code and finally run/debug your project.

You can add breakpoints within your js file to explore the execution of the methods. You can perform Step in/Step out, view the sequence of events, page flows etc.

I have recorded a video which shows the configuration of the existing project which I have used in this blog. It demonstrates how to execute the project in debug mode in order to see the bot run in the local workstation.

Exporting to package to Cloud Factory

Once the project is ready for deployment, an archive is generated by Desktop Studio in the form of a compressed file. In the Desktop studio, select the project and use the File menu option to “export project”. This will give you a zip file within the export folder of the project location.

Navigate to the Cloud Factory and in the packages menu, use the import option to upload the project archive.

Select the relevant scenario and environment to use. In the below example, I’ve set the mode as “Scheduled” and set the date range along with frequency. Ensure that you have also reserved your machine for unattended executions as shown earlier when setting up the Cloud Factory.

This video walks through the steps of configuring the Cloud Factory to execute the bot in an unattended mode.

I hope you found this blog series useful. In case, you have issues configuring the RPA bot, please do raise a question in the Q&A forums with the appropriate tags.

Troubleshooting tips

 

1) When defining machine hierarchy, note that there is an extra column which needs to be in the file header ‘’selfauthorize‘. This is currently not mentioned in the SAP Help documentation. The system would not provide an error when you upload the file without this field. However, Cloud Factory would not be able to recognize your machine. Note that, login hierarchy file does not require the column ‘selfauthorize’.

2) When using iRPA to capture SAPGUI screens, you might get the below error.

You need to enable and use the SAP GUI Scripting API.

3) When you have trouble launching the Desktop Agent, delete the agent from the process and restart the service

When launching the Desktop agent for the first time, it will provide you a popup requesting you to login with SCP Cloud Foundry credentials. If you dont get to see this, try to delete the “SIRPADA_master” from the Credentials Manager as shown below.

6 Comments
You must be Logged on to comment or reply to a post.
  • Nice Info Murali and Thanks for the blog.

    Is there any document or blog related for end to end scenario automation using IRPA? Import export parameters between the scripts?

  • Hi Murali,

    Really an informative blog, thanks for sharing. As I was trying my hand on this, faced an issue  and seek you input on same : –

    While executing RPA desktop agent, facing exception “Can’t properly setup a tenant socket”, have tried KBA#2796483 (error is same as given in this note) but issue still persist .

    Thanks

    Rahul M

  • Hey
    I read your article and thought you might want to give me a hint.
    As part of SAP iRPA exercises and learning, I wanted to make an automatic data entry machine in an FB60 to SAP transaction based on data from an excel file. and stayed on entering data into the combobox and specific cells in datagreedview. I don’t see all the methods listed in the ctx.SAPScripting documentation for these objects.
    How do you refer to a specific key in cb or a specific cell in dgv?