Automatic saving of test data with FBGENDAT
In transaction SE37, it is possible to start function module calls manually and create test data directories. However, entering and creating these test cases manually can be very time-consuming. With FBGENDAT there is a possibility to automatically save the interface calls of self-developed function modules and thus create a test data directory. It is also possible to use FBGENDAT for standard SAP function modules.
FBGENDAT is particularly helpful if a function module is called externally via OData services, RFC interfaces or other programs. With FBGENDAT it is then possible to save the calls together with the transfer data and thus, for example, to understand later why a call returned errors. With the test data, the call can then simply be repeated and debugged.
Steps:
1. activate the function module to be tracked in the FBGENDAT program
2. maintain user parameter FBGENDAT
3. insert code line with fbgenmac into function module
Activate function module in FBGENDAT
First, the function module whose calls are to be automatically saved in the test data directory must be entered in a list.The FBGENDAT program is available for this purpose and can be started via SE38.
Transaction SE 38 > – Program FBGENDAT
1. enter the function module to be monitored
2. mode: B
3. activate this entry: ‘X’
Execute with F8
The function modules that have already been activated are then displayed
.
Function modules can also be deactivated again via the program.
Maintain user parameters
Secondly, the parameter ‘FBGENDAT ‘ must be maintained with an ‘X’ in the user parameters. This should be done for the users whose calls are to be saved.
Transaction SU3 or ‘System -> User defaults -> User data -> Parameters’
Or
Transaction SU01 -> Enter user -> Parameters tab
>Enter FBGENDAT = ‘X’
Integration of fbgendat in the function module program code
The fbgenmac command should be called directly at the beginning of the function module, as the import parameters are then saved directly here, regardless of whether the function module terminates later.
The name of the function module you are currently in is specified after the fbgenmac.
In addition, the include fbgenmac must be included in the top include of the function group in which the function module is located.
Result
If the function module is now executed in the background or actively by a user who has set the fbgendat user parameter, a data record is automatically created in the test data directory. This can then be searched for by date, time and the user in the short text (always: ‘GENERATED BY: ) in the SE37
There are two ways to benefit from fbgendat in SAP function modules. Read how it works.
Do you have any questions?
Get in touch with us.