2/1/2016 5:43:36 PM

This blog will give you how to create test data, how to execute a list of function module with single session and how to save test sequence in SAP function module using the transaction SE37. 

Overview about this blog:

This blog will give you how to create test data, how to execute a list of function module with single session and how to save test sequence in SAP function module using the transaction SE37. Also explained about function module changing from one group to another group.

 When debugging an issue in IDoc testing or from external calls or posting program using BAPI's. The ability to save test data for these function modules is vital in the analysis of any issue.

1) Saving Test data directory in SE37 while debugging.

For example I am testing a Inbound Invoice post in custom posting function module. Inside the custom posting function module I am calling BAPI_SALESORDER_CREATEFROMDAT2 which will create Sales invoice in SAP. during IDOc testing we may perform multiple time and new IDoc also will be generated and which can be avoided. Before calling the BAPI BAPI_SALESORDER_CREATEFROMDAT2 we can save the export / tables data(ie variant in report program). In this method you can try to execute multiple time with small changing input values in BAPI_SALESORDER_CREATEFROMDAT2 and finally you can test end to end like testing IDocs. This method we are saving time and avoiding unwanted IDocs. During debugging time you can keep an break point and execute from IDocs, external calls 

Above screenshot you could see data inside the work area and table parameters.

Now press F5 or click single step.

Here you can see what ever passed before calling this BAPI BAPI_TRANSACTION_COMMIT


Now click the yellow marked icon

And select Save Parameters as Test Data(SE37)


Give name of the test data.


Go to SE37 and give BAPI_TRANSACTION_COMMIT and execute it. System will shows the test variant, you can change the small data and execute it. So we need not enter the inputs again and again so directly you can execute and choose the variant(as everyone aware of report variant)


2) Creating test sequence in SE37.

In real time we may test multiple BAPI's and many of ABAPers not using the BAPI BAPI_TRANSACTION_COMMIT which will be used to complete the database save. So we can create any number of function modules and execute the same and system will execute the sequence of registered function modules.

You can maintain the sequence of function modules and click execute icon. Now system will execute the FM BAPI_TRANSACTION_COMMIT and it will continue the next sequence of function module, in our case the next function module is BAPI_TRANSACTION_COMMIT.

Execute the second function module. Now the system ask name of test sequence. This test sequence will gives about list of function modules which can be reused and need not maintain the sequence of function modules again and again.

3) Get sequence in SE37

After completing of sequence of function module we can save the same sequence and wich can be used to perform and need not enter the list of function modules again and again.

Now go to SE37->Function module->Test->Test sequences


4) Can we change the Function module from one group to another group?

Yes, its possible using reassign option in transaction SE37.

Click reassign button and go to SE80, now you can see two function modules with one function group.