Introduction
Identifying the changes present between different versions of workflow templates can be a challenge. Unlike other objects, there isn't a built-in functionality for direct comparison. Manually scrutinizing each step of the templates side-by-side can be both tedious and error-prone.
This lack can be frustrating, as I’ve witnessed firsthand through inquiries from few of my colleagues struggling to identify changes between versions for troubleshooting or maintaining consistency across environments. Fortunately, I’ve been able to help them by employing a couple of effective techniques that help bridging this gap.
While there are few solutions available online, I haven’t encountered a comprehensive resource specifically dedicated to guiding users through this process. Therefore, I’m writing this post with the hope of empowering you with effective method for comparing workflow template versions in SAP. Additionally, it serves as a future resource for my colleagues whenever they encounter similar challenges, allowing me to simply direct them to this guide.
Comparing Workflow Templates
Gearing Up:
Now that we’ve got our list of tools prepared, let's explore the steps to identify differences in two workflow templates.
Step 1. Export the templates as XML file.
In this step, we will open both templates in Workflow Builder (SWDD) and export the templates as XML file. The menu option to export the files can be found at Menu > Workflow > Import/Export > Export to XML File > Export Workflow as Internal XML
Step 2. Open exported files in Visual Studio Code
In this Step, we will move the two exported files to a separate folder named “Compare” and open this folder in Visual Studio Code. To open the folder in Visual Studio Code, File > Open Folder command can be used from the menu bar.
Step 3. Formatting the XML files
It can be seen that the exported XML files are compressed and do not contain proper indentation. We will need “XML tool” extension to convert these XML files to readable format so that the changes are easily visible when compared.
The “XML tools” extension can be installed in Visual Studio code by following these simple steps:
Once the “XML Tools” extension is installed, go back to the XML files, right click on the XML code, and choose Format Document With > XML Tools. Do this for both XML files.
After formatting, the files will be transformed into a more readable format, similar to the files in following screenshot.
Step 4. Comparing the two files
In this step we will finally compare the differences between two XML files. To compare two files, right click on first file and chose “Select for Compare”, then right click on the second file and choose “Compare with Selected”.
The difference checker tool should now open in the main panel of Visual Studio code, and the differences between two files should be highlighted in Red and Green. An overview of all changes present throughout the whole file can also be seen at the right-hand side present in a panel called mini-map (highlighted in below screenshot). This mini-map offers a quick glimpse at all modifications throughout the files and facilitates scrolling when clicked on the highlighted part on minimap.
As can be seen in the mini-map every difference present in two XML files is highlighted. However, the changes including workflow IDs, version numbers, and timestamps have also been highlighted. These differences aren't relevant to our goal. These irrelevant differences are creating noise in the difference checker tool, making it harder to identify the actual changes we're interested in. To address this, we'll strategically remove these irrelevant differences from both files, ensuring only the significant modifications remain highlighted.
To eliminate these irrelevant differences, we will leverage the Regular expressions powered “find” feature of Visual studio code.
Let's begin by addressing the discrepancies caused by different workflow IDs within the two XML files. Press Ctrl+F to open find feature, enter the workflow ID in the find box and replace all occurrences of workflow ID with an empty string. Do this for both files.
In my case, removing the workflow IDs significantly reduced irrelevant highlights, however, the differences in "Changed Date" and "Changed Time" were still creating noise (highlighted below). To achieve a cleaner comparison, let's eliminate these discrepancies as well.
Removing individual <CHANGED_ON>, <CHANGED_AT> and similar tags would not be efficient due to their multiple occurrences with different enclosed timestamp within each XML file. Simple find and replace operation would not help because the timestamp enclosed within tags are different in same XML file. Instead, we'll utilize a regular expression to target all such tags effectively.
Here’s how to proceed:
The above regular expression effectively targets all occurrences of Changed/Activated on/at/by tags and replaces those with empty string.
While much of the noise was removed after performing above step, examining the mini-map revealed additional noise in the form of <VCYPOS>, <VCXPOS>, <LCXPOS>, and <LCYPOS> tags (can be seen in below screenshot). My understanding of these tags is that they represent the X and Y coordinates of object/node positions within the workflow. As we're not interested in these changes, we can eliminate them from both XML files as well.
To achieve this, we will use <(LC|VC)(X|Y)POS>\d+ Regular expression. Enter this regular expression in the “find” box and replace all matched occurrences with empty string in both XML files.
Finally, with all the irrelevant differences eliminated, the comparison tool now displays only the four key changes within the XML files that we were originally looking for.
With the help of highlighted differences, I found the following changes that were made in workflow template:
Conclusion:
By following these steps, I was able to identify the exact changes that were made in the workflow template. This approach streamlined the process and ensured accurate identification of modifications made between different versions/templates of workflow.
I hope this guide has proven informative. Feel free to leave comments below with any questions or suggestions for further improvement.
Thank you for your time!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |