4 minute read
Cloning data with Object Sync? Leverage eCATT to set exact keys
Ever needed to automate repetitive steps with Object Sync? (Object Sync is part of our Data Sync Manager™ (DSM) suite). Keep reading to find out how I chose to do this recently (other ways are of course possible):
I needed to set up around a thousand customer records that matched some data in a partner’s demo system, so we could showcase consistent masking inside and outside of SAP (more to come on that in a future blog). They sent across their file with keys and names which I wanted to replicate in SAP. So, I took two example customers and wanted to clone them.
The reason I needed two was because it mattered whether they were male or female for the masking that would come later. So the challenge was how to renumber the clones when the keys weren’t a complete range, but rather two sets interspersed within a range (for the uninitiated, Object Sync allows you to clone and choose a ‘Start at’ number and then increments that number with each new record it clones – great if you only need one record cloning to a sequential set of numbers).
I thought through all the renumbering options within DSM, and considered trying to code a renumbering exit on the object that could read my seed table...but then I remembered my rather limited (aka criminally poor) coding skills. So I concluded that using the clone option in Object Sync where you clone once and assign the number would be my best bet. I just needed to do it about a thousand times! With any data challenge like this, I first try to guess what the manual effort would be before weighing up other options, and that was a very very quick decision in this case – I needed to automate.
So for anyone out there looking to develop very specific test sets to match an external system - here’s how to go about it...
Creating the Test Script
Back in the day (Clinton was President, Blair PM of the UK - to give you some context) I was rather nifty with LSMW (if I do say so myself). But unfortunately the basic screen recording of LSMW doesn’t work with our screen libraries, so I had to step out of my comfort zone. The computer aided test tool eCATT is a very flexible successor to LSMW, and is the core of automation run via SolMan. The tcode SECATT starts this adventure:
Enter a name for your new Test Script and Click Create.
Enter a Title, and Application Component then click on Pattern.
Choose UI Control and SAPGUI.
Accept the pop up which means the system we’re in is where the logic will run.
Enter the transaction code you wish to record, in my case the import transaction of DSM to leverage a file I'd previously created with one female customer, and then click Start recording.
In the pop up asking for system information just choose Yes to again choose the system you’re in.
And now start teaching ECATT what it should do in the play back:
For my use case the key is the ‘Start at’ value, which for the recording I entered the first in my list since, just like LSMW, the recording will actually commit the activities tracked.
The file I was importing was already masked since DSM5 does this on exit (great for Hybrid cloud but generally pretty good for data privacy in this brave new world of protecting personal data).
Now my import has been started I can Stop recording by toggling back to the session that started it.
Double click in to the recording by clicking on SAPGUI_1 -.
In here you can now see all the glorious screen activity that was going on underneath the hood.
If you expand the steps you should be able to find the places where values were entered. In my case, this is the new key value for my single cloned record. This is what I now wish to make a variable.
Which we do by double clicking on that step, and then replacing the next key I used in the recording with a variable name of my choosing. I chose the rather imaginative ‘NEWVAL’.
Upon saving we can choose where this variable will come from.
I wanted it to be an Import variable so I chose that radio button and then Yes.
Now we can see the variable as a parameter.
Don’t forget to remove the value you entered in the recording; in my case 93605
Now we must create a ‘Test configuration’, you don’t have to use the same name but I did.
Enter a title and an application component.
Then switch to the Configuration tab and add the test script name.
Then Click on Download variants, the fourth button from the left.
And choose where to save the file.
I just used the default name which is based on the test configuration name.
Say Yes to the pop up.
Now open the file in Excel, making sure you keep it in the same format.
Make sure there is a column blank under description. After I saved it and reopened the file it appeared in column 2 again, move it back or the script won’t find it.
Once you’ve added all your data, save (keeping the file format as it was).
Now on the Variants tab change to External Variants/Path and choose your file.
Save and now Execute.
Choose to process in the Foreground and set your error handling choices. If your file isn't processed then having the error message is handy. Then Execute.
Now you should see your script processing in a new session with the values from your file being used each time.
And in my case, it gave me the 1300 customers ready to mask with gender specific rules.
If your file doesn’t process or you get error messages, make sure your GUI has scripting active.
Make sure the client settings in SCC4 allow scripting.
And make sure the parameter sapgui/user_scripting is TRUE.
There are always at least three ways to do something with DSM, so in a future blog I’ll report back on trying to achieve the same outcome via a user exit on the object. Also, look out for the masking story that used this data I generated with eCATT.