Business Add-Ins, so-called BAdIs, offer a wide range of customization and enhancement options. BAdIs provide you with a mechanism to customize a functionality according to your own needs, without modifying the delivered source code. This allows you to upgrade NextTables without losing the custom development. The original development and the customer-implemented enhancements are thus strictly separated, but are nevertheless integrated. In this article, you will learn how to set up a BAdI for NextTables.
The BAdI provided with NextTables is a new generation BAdI. These are organized in enhancement spots. An enhancement spot contains BAdI definitions, which in turn provide an interface and ABAP methods. These can be used by customers and customized to incorporate their own extensions.
BAdI Definitions Overview
The /NLY/EDITOR BAdI delivered with NextTables contains the following BAdI definitions:
/NLY/BADI_EDITOR covers all possible table operations. This allows you to show or hide certain columns or block fields. In addition, you can change read and write access, implement your own authorization checks, do custom validations and derive fields automatically.
/NLY/BADI_IMPORT is used during import. This BAdI provides the only way to access the field contents before data type compliance is enforced. For example, you can change the field contents Yes to 1 for a field Flag of type NUMC1.
/NLY/BADI_SEARCH is used in the search. Here you can implement your own value help for special search requirements. You can also customize the display of search results.
Interaction of individual BAdI elements
BAdIs are organized in enhancement spots. For an enhancement spot you can create an enhancement implementation. The enhancement implementation includes several BAdI implementations based on BAdI definitions. The customer-specific logic is executed in implementing classes whose methods are defined by BAdI definition. The following figure provides an overview of the interaction of individual BAdI elements.
Best Practice BAdI Implementations
The BAdI delivered with NextTables is designed for multiple use and is based on a filter. For a better overview and simplified maintenance, you should create your own enhancement implementation for each project or business department that uses NextTables.
This way, all BAdIs used in a project can be found in one location, regardless whether it is a table or search BAdI. Furthermore, you should create an own BAdI Implementation for each table or search function and name the BAdI accordingly for the sake of overview and making it easy to find an implementation.
BAdI Implementation
Subsequently we will show you how to create a BAdI. There are multiple ways to create a BAdI-Implementation:
- using ABAP Development Tools
- using the BAdI-Definition (transaction SE18)
- using the BAdI-Implementations (transaction SE19)
- using the ABAP Workbench (transaction SE80)
In this article we will show you how to create a BAdI using the SE19 transaction. On the initial screen, please select the enhancement spot /NLY/EDITOR on press the Create button.
You will be prompted to create an enhancement implementation first, which encapsulates all BAdI implementation for the respective project. Please enter the name of the enhancement implementation and a short description before you press Enter.
Now, within the extension implementation that has just been set up, a BAdI implementation can be created. Please enter the name of the BAdI implementation and the name of respective class, which carries the logic. Depending on your operation area, you can select one of the BAdI definitions described above. In this example, we will use the /NLY/BADI_EDITOR definition for table operations.
Your business logic is to be implemented inside methods of the class. The structure of methods is inherited from the BAdI definition you selected.
However, the business logic is not executed until the filter criteria are met. In the Filter Values section you can define criteria to ensure the class is executed for a specific table name and table type only.
After implementation, make sure that all involved pieces are activated, not only the implementing class. You need to activate the following objects:
- implementing class together with methods
- BAdI implementation
- Enhancement implementation
Which License is needed for this feature Professional ✘ | Enterprise ✔