Thou shalt not use direct code in user-exits
All code to be put in user-exits (BADIs, enhancements, SMOD, etc.) should be encapsulated.
-
It’s common for an user-exit to include multiple independent parts. Each of these parts should be encapsulated in its own method. Even if it is only one line;
-
This should apply to both new implementations and changes to existing code;
-
A change to existing code should always be seen as an opportunity to organize existing code into methods, since it will have to be tested again anyway;
-
If a class associated to the respective user-exit still doesn’t exist, one should be created;
-
The name of the class should be clearly related to the name of the user-exit. Ex: for user-exit ZXF01U01 uses class Z3F_CL_ZXF01U01.
https://abapinho.com/en/2012/03/metodos-privados-em-badis/ (in portuguese)