Customizing table with texts from an existing table
A few days ago in a group chat room of a messenger the question was asked how texts (name of the supplier, name of the plant, …) are loaded when maintaining a customizing table, if the user enters the entry and confirms with the Enter-key. Since I did not have such a request so far, I had to first look at an example of how SAP does something like that. After a short analysis, I then understood the logic and then created the following example.
Request for the test:
- Create a customizing table and find a way to integrate the texts
- Texts should not be ready for input
Question and decision how to implement:
- Should the textfield include in the customizing table?
- No, as the texts already exist in the database
- Must be developed here?
- No, a maintenance view is created for the customizing table
- Do events of the table maintenance dialog have to be used here?
Info: I haven’t included popup with warning and package assignment. I ignored all warnings that happened in this sample and I assigned all objects to the local package $TMP.
Creating the Customizing table
Transaction SE11: assign name
To create the customizing table, I use transaction SE11. In the initial screen I select database table, assign a name for the table (note: the name should be as self-explanatory as possible) and press the F5 key.
Delivery and Maintenance
First, I give the table short description and choose the delivery class C (Customizing table) for the table.
My table should get the fields MANDT, WERKS and LIFNR.
In order to receive additional tables in a maintenance view for selection, it is important that at least one field in the table receives a foreign key relationship.
Foreign key for WERKS
For the creation of the foreign key for the plant, SAP automatically proposes the table T001W, which I also assume. In the popup for the foreign key creation, I accept all default values and confirm it with Copy.
Foreign key for LIFNR
For the creation of the foreign key for the vendor, SAP automatically proposes the table LFA1, which I also assume. In the popup for the foreign key creation, I accept all default values and confirm it with Copy.
To activate the table I still have to make the technical settings. First I save the table and assign it to a package. For the data class, I chose APPL2 and size category 0. Now I save the settings and jump back into the table, which I can now activate.
Create the maintenance view
Transaction SE11: assign name
To create the customizing table, I use transaction SE11. In the initial screen I select View, give a name for the view (Hint: The name should be as self-explanatory as possible) and press the F5 key.
The type of the view must be a maintenance view.
Description and table selection
First, I give the view a short description and enter in the tables the table just created and confirm with Enter. Using the Relationships button, I can now add the two tables found through the foreign key relationship.
Now I have to determine which fields the view should have. I can call up the selection of fields by choosing the “Table fields” pushbutton. Double-clicking on the table opens the field selection of the table. There I select the field “NAME1” for the tables T001W and LFA1. In addition, I have of course also added the field “LIFNR” from my table.
Maintenance attribute for view field
So that the two name fields are only declared as output fields, I still set the value “R – View field can only be read” in the column Maintenance attribute for view field. Before I can activate the view one of the two fields with the name NAME1 needs to be renamed. Now I can activate the view and assign it to a package.
Table Maintenance Dialog
To maintain data using transaction SM30, I still need a table maintenance dialog.
Table Maintenance Generator
I call the table maintenance generator directly from the maintenance view processing via Utilities-> Table Maintenance Generator.
Technical Dialog Details
I name the function group as well as the maintenance view and under Authorization group I use &NC&. My Maintenance type is one-level and gets the screen number 1. Now I can use the sheet in the application toolbar to have the function group and the associated logics created by SAP. Again, it must be stated again in which package the development should be included.
Dialog Data Transport Details
After creating the function group, I set the flag for the standard recording routine so that changes to this table are transported.
Testing the implementation
Now I have completed all the steps for the request and I can check if everything works as it is desired.
Transaction SM30: Maintain Customizing
I can perform table maintenance using transaction SM30 by specifying the view name.
When adding a new entry, I select one plant and one vendor each.
Confirm entry with Enter-key
After pressing the Enter key, the texts for the plant and the vendor are loaded and updated in the display.
Further explanation why no development is necessary
How does the data selection work? Of course I also looked at it a bit and will explain it here.
Screen of the maintenance view
Since data is reloaded in the screen here, I take a closer look at the flow logic of the screen. There I noticed that SAP implemented the module “COMPLETE_ZMM_V_WERK_LIFNR” in the PROCESS AFTER INPUT. This include always has the same structure “COMPLETE_“. So whenever you find these includs in a screen, it means that more data is loaded here and taken over into the display.
Module for completion
In the module, only the subroutine “COMPLETE_EXPROFIELDS” is called.
Call the subroutine for completion
The subroutine “COMPL_ZMM_V_WERK_LIFNR” is then called in the subroutine “COMPLETE_EXPROFIELDS”. The naming of the subroutine always has the same structure “COMPL_“.
Subroutine of completion
In the subroutine “COMPL_ZMM_V_WERK_LIFNR” the additional data from the database will be loaded. Through this kind of implementation, SAP has taken a lot of work from developers.