Using eCATT to automate loading records with specific keys

By Paul Hammersley
Paul Hammersley

Paul has for many years been a remarkable technical force at EPI-USE Labs. As VP of the ALM Products, his portfolio includes System Landscape Optimization, and his hands-on experience of implementing Data Sync Manager and helping clients to manage data across the breadth of their SAP landscapes is unique. He has specialised knowledge about data security and how GDPR (the General Data Protection Regulation) impacts companies running SAP.

Written on Oct 31, 2019 9:07:37 AM

4 minute read


automating-Header-image-3

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:Extented-Computer-aided-test-tool-Initial-screen

Enter a name for your new Test Script and Click Create.create-test-script-zph

Enter a Title, and Application Component then click on Pattern.insert-pattern

Choose UI Control and SAPGUI.system-data-container-is-missing

Accept the pop up which means the system we’re in is where the logic will run.record-sap-gui-command

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.record-sap-gui-command-2

In the pop up asking for system information just choose Yes to again choose the system you’re in.object-sync-select-sync

And now start teaching ECATT what it should do in the play back:object-sync-sync-details

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.object-sync-import-sync

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).dsm-monitor-desk-object-function

recording-running

Now my import has been started I can Stop recording by toggling back to the session that started it.create-test-script-zph-os-load-cust

Double click in to the recording by clicking on SAPGUI_1 -.create-test-script-zph-os-load-cust-2

In here you can now see all the glorious screen activity that was going on underneath the hood.load-cust-f

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.load-cust-f-2

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’.parameter-maintenance

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.zph-os-load-cust-editor

Now we can see the variable as a parameter.
Don’t forget to remove the value you entered in the recording; in my case 93605Extented-Computer-aided-test-tool-Initial-screen-1

Then Save.
Now we must create a ‘Test configuration’, you don’t have to use the same name but I did.create-test-configuration-zph-os-load-cust-f-3

Enter a title and an application component.create-test-configuration-zph-os-load-cust-f-4

Then switch to the Configuration tab and add the test script name.download-variants

Then Click on Download variants, the fourth button from the left.sap-gui-save-as

And choose where to save the file.
I just used the default name which is based on the test configuration name.downloaded-variant-data

Say Yes to the pop up.excel-1

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.excel-2

Once you’ve added all your data, save (keeping the file format as it was).ecatt-default

Now on the Variants tab change to External Variants/Path and choose your file.ecatt-file

Save and now Execute.start-option

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.
data-secure

 

If your file doesn’t process or you get error messages, make sure your GUI has scripting active.sap-logon

Make sure the client settings in SCC4 allow scripting.display-view-details

And make sure the parameter sapgui/user_scripting is TRUE.maintain-profile

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.

 

OBJECT SYNC: FIND OUT MORE

 

Topics: data secure data scrambling Object Sync Data Sync Manager test data management Automation SAP systems Infotype 41 masking rules ECATT


Add a comment