How to run any functional module with input data from text file

We all know SAP Legacy System Migration Workbench (LSMW) pretty well. We use it in 99% data migration projects, or when we need to do some mass changes in the live system and standard PA70 doesn’t work well because of its limits. Some geek guys like myself dig deeper and use function modules instead of writing ABAP code to make any mass changes. There is a great advantage – you don’t need a Developer license to run the functional module. Open SE37 transaction, select module and run it with some parameters. Today I want to share with you my research how to run any functional module with a dataset from a text file. Just couple clicks and you have a VERY powerful tool to do almost everything in SAP. And, one more advantage, running functional modules directly is much faster, than using batch inputs.

Yes, here comes eCATT to the scene. It’s that flexible that we can use not only for testing purpose but to run mass operations. It has its own script language which could help us to analyze FM output and build a chain of FM calls to accomplish something complex.

In my case we’ll create infotype 0015 from the dataset in a plan file.

Running SAP eCATT test with functional module

Running SAP eCATT test with a functional module

Setup test script in SECATT transaction to run functional module (or class method if you want). The system automatically creates module params. Leave them as is for a while. Further we” match them with test container dataset. This is how data container looks like. If you don’t want to type manually these params use Edit -> Import Parameters to copy interface definition.

 

Download variant to a text file. Pay attention that it’s a tab-delimited file where headers start with # sign. Add some data and upload the file back or choose ‘External Variants / Path’ radio button.

By now we have test script and test data container. All we need is test configuration, which includes both test script and the data container.

Run it and boom, we’re all set.

Then you can analyze FM return code and log it to convenience. Why is eCATT better than LSMW? We can create an additional column in Excel with operation code. If it’s INS we create a new record, if DEL we delete it. In LSMW we’d need to record two different scripts to perform the same.