Disclaimer: The insights shared in this blog are based on my personal observations and learning. They may not apply universally, and I encourage readers to conduct their own research and make an informed decision before using this content for productive use.
Introduction
Automation is the most natural way to increase efficiency and reduce errors in the current digital ecosystem. SAP: One of the most powerful ERP (enterprise resource planning solutions) in the world, continues to be the centrepiece of business automation. SAP Build Process Automation (previously called SAP Intelligent RPA) is one of SAP’s tools for automating workflows. Businesses can use this tool to automate complex processes, saving time and reducing human intervention.
However, to expand these automation capabilities beyond a specific automation application, most organizations seek to integrate different technologies to address legacy systems or other, more complicated business workflows. Using ActiveX objects is one such method for Windows system.
In this post we will discuss how ActiveX can be used to enhance the functionality of SAP Build Process Automation.
What is ActiveX?
ActiveX is a collection of technologies made by Microsoft that enables intercommunication between software programs. ActiveX controls were intended to be used in Internet Explorer, but they can now be incorporated into other programs and web browsers. They are little programs designed to perform basic tasks in other applications.
ActiveX is commonly used to augment productivity of software applications operating in Windows environments. These include integration with older technologies or legacy systems that do not support modern web services or APIs.
Why Extend SAP Build Process Automation with ActiveX?
On some occasions, the standard solution SDK was missing the exact solution. We then possibly need to extend SAP Build Process Automation using ActiveX objects:
- Legacy System Integration
Many businesses are currently operating using legacy systems (older Windows programs or ActiveX controls). With the integration of SAP Build Process Automation and ActiveX, the gulf between modern and legacy systems can be bridged to allow seamless integration and automated workflow. - Leveraging Different Scripting Using ActiveX Controls
Only JavaScript is supported by Standard SAP Build Process Automation. If one has to use another scripting language, then one can use ActiveX objects. - Enhanced Desktop Automation
ActiveX is commonly employed within desktop automation, where it can interact with installed devices or programs. SAP Build Process Automation has the ability to use ActiveX objects to take greater control over local operations (e.g., manipulation of Excel spreadsheets, managing programs that are installed on the desktop). - Personalization and Adaptability
SAP Build Process Automation can be highly personalized. Using the capability provided through ActiveX, you gain additional flexibility to automate non-SAP functions or operations that require certain interactions with other non-supported SAP technologies.
How to Use ActiveX Objects in SAP Build Process Automation
- Word Automations
The Word SDK has limited capability by default. If more extensive customization is desired, the Word Application ActiveX object can be employed. However, this will need to be installed together with Microsoft Word.
Code –
var wordApp = irpa_core.activeX.create("Word.Application");
wordApp.Visible = true; // Set to false if you don't want to show Word UI
var doc = wordApp.Documents.Add();
// Insert Title
var title = doc.Paragraphs.Add();
title.Range.Text = "Document Title";
title.Range.Font.Bold = true;
title.Range.Font.Size = 16;
title.Range.ParagraphFormat.Alignment = 1; // Center alignment
title.Range.InsertParagraphAfter();
// Insert Description
var desc = doc.Paragraphs.Add();
desc.Range.Text = "This is a description of the document. It explains the content below.";
desc.Range.Font.Size = 12;
desc.Range.InsertParagraphAfter();
// Insert Table (3x3 example)
var table = doc.Tables.Add(doc.Range(doc.Content.End - 1), 3, 3);
table.Borders.Enable = 1; // Enable borders
for (var i = 1; i <= 3; i++) {
for (var j = 1; j <= 3; j++) {
table.Cell(i, j).Range.Text = "Row " + i + ", Col " + j;
}
}
doc.Paragraphs.Add();
var imgAfterRange = doc.Range(doc.Content.End - 1);
var imgAfter = doc.InlineShapes.AddPicture(imagePath, false, true, imgAfterRange);
imgAfter.LockAspectRatio = true;
imgAfter.Width = 200;
imgAfter.Height = 150;
doc.Paragraphs.Add();
Output -
- Windows Automations
Under some circumstances, default SDK to automate Windows popups will not work properly under unattended mode. We employ the use of AutoIt scripts to automate under these types of situations. AutoIt offers an ActiveX object called AutoItX that allows calling the functions of AutoIt directly from within JavaScript. However, the system must be installed using AutoIt, and the following commands must be executed to register the ActiveX component:
Open Command Prompt as Administrator.
Run the following commands:
- cd C:\Program Files (x86)\AutoIt3\AutoItX
- regsvr32.exe AutoItX3.dll #For 32bit Windows Operationg System
- regsvr32.exe AutoItX3_x64.dll #For 64bit Windows Operationg System
On successful registration, popups are easily automated via JavaScript through the use of AutoIt's ActiveX.
Code -
var oAutoIt = irpa_core.activeX.create("AutoItX3.Control");
oAutoIt.WinWait("Save As","&Save",180); // Waiting for the specific window
oAutoIt.WinActivate("Save As","&Save"); // Activate the window popup
oAutoIt.ControlFocus("Save As", "", "Edit1"); // Set focus on the input File Name
oAutoIt.ControlSetText("Save As", "", "Edit1", fileName); // Set the input filename
oAutoIt.Sleep(1000); //wait for 1 sec
oAutoIt.ControlClick("Save As", "", "Button1"); // Click on Save
Output –
Along with these, there are numerous other ActiveX objects that can be employed to integrate SAP Build Process Automation to automate further and streamline automation flows. Some key use cases are:
- Automating system interactions – Retrieving Windows system information via WScript.Network.
- Running command-line operations and scripts – Run commands using WScript.Shell or Shell.Exec.
- Database connection – Set up database connections through ADODB.Connection.
- File system automation – Run operations such as read, write, and delete files using Scripting.FileSystemObject.
- Dynamic script execution – Run VBScript or JScript code at runtime using MSScriptControl.ScriptControl.
Utilizing these components offers more flexibility, higher efficiency, and greater integration with external systems.
Conclusion
SAP Build Process Automation is a great tool for creating business automation, but it sometimes requires additional horsepower to integrate with legacy systems or third-party applications. Integrating with ActiveX objects allows SAP Build access to legacy technologies and custom applications, widening the scope of SAP Build’s automation capabilities.
Although it takes a bit of technical know-how, mastering the use of ActiveX objects can be a key to streamlining business processes to make them adaptable. Just be cautious of security implications and robustly test whatever you implement to ensure automation flows smoothly.