Step 1: Table
Create a database table.
Make sure its delivery class is set to C (Customizing) and data maintenance is allowed. Otherwise the generator will throw an error.
Enable table logging in the technical settings, if you want you want to “Display Change Logs” in the app.
Step 2: Open Generator
Right-click your table in the ADT and select “Generate ABAP Repository Objects”.
In the popup that opens up, select the Generator “Business Configuration Management” –> “Maintenance Object”.
Press “Next”.
Step 4: Package
Select a development package the generated objects should be added to.
Press “Next”.
💡 Hint
Create a sub-package for the maintenance objects, as there will be 16 objects generated, that would reduce the clarity of your main development.
Step 5: Configuration
Modify the “Description”, it will be visible to the end user as the column “Description” in the app Custom Business Configurations.
If you don´t need a copy-Action clear the “Copy Parameter Entity”.
Select “BC Management”.
💡 Hint
Select “Add Data Consistency Check” if you want a validation to be generated, that will make sure fields with a value list or value table have a valid input.
Step 6: Configuration
Modify the “BC Mantenance Object” according to your naming convention for “Business Configuration Maintenance Objects”.
Clear the field “Transport Object”.
Select “Data Model”.
Step 7: Configuration
Modify the “Entity Name” of the group Customizing Table, it will be visible to the end user as the column “Name” in the app Custom Business Configurations.
Modify all fields except Entity Name and Entity Label to match your naming convention for those development objects (CDS Views and Database Tables).
Select “Behavior Implementation”.
Step 8: Configuration
Modify the “Implementation Class” according to your naming convention for “Behavior Pool Classes”.
Select “Business Service”.
Step 9: Configuration
Modify the “Service Definition” and “Service Binding” to match your naming convention for those development objects.
Press “Next”.
Step 10: Generation
Make sure all development objects that will be generated are named according to your naming conventions.
Press “Next” to select a transport request or press “Finish” to directly start the generation.
Step 11: BC Maintenance Object
After the generation is done, the Business Configuration Maintenance Object will be opened.
Make sure under the group Table Settings the TableType is set to “Grid Table” and the “Table Creation Mode” is set to “Creation Row”. Those differ sometimes and prevent a consistend user experience.
💡 Hint
If you want your end users to be able to group Custom Business Configurations in the app, add a Data Element to the “Configuration Group”. It´s label will be used in the app as the group name.
Step 12: Publishing
Open the generated service binding and press “Publish”, as this doesn´t happen automatically.
💡 Hint
If that does not work in the ADT because you also have a customing client in your development system, you can instead do the publishing via the transaction /iwfnd/v4_admin.
Step 13: Remove transport selection
Open the Metadata Extension of the Singleton CDS view.
Delete the Transport-facet and the Transport-action.
This will remove the visual interfaces for the transport selection.
Step 14: Remove transport selection
Open the generated projection behavior definition and remove the line use action SelectCustomizingTransptReq;.
This will remove the projected transport action.
projection;
strict;
use draft;
define behavior for ZCAC_DatabaseTable_S alias DatabaseTableAll
{
...
use action Prepare;
use association _DatabaseTable { create; with draft; }
}
define behavior for ZCAC_DatabaseTable alias DatabaseTable
{
...
}
managed with additional save implementation in class ZCA_CL_BP_I_DATABASETABLE_S unique;
strict;
with draft;
define behavior for ZCAI_DatabaseTable_S alias DatabaseTableAll
draft table ZCA_TABLE_D_S
with unmanaged save
lock master total etag LastChangedAtMax
authorization master( global )
{
...
draft determine action Prepare {
validation DatabaseTable ~ ValidateDataConsistency;
}
association _DatabaseTable { create ( features : instance ); with draft; }
}
define behavior for ZCAI_DatabaseTable alias DatabaseTable
persistent table ZCA_TABLE
draft table ZCA_TABLE_D
lock dependent by _DatabaseTableAll
authorization dependent by _DatabaseTableAll
{
...
association _DatabaseTableAll { with draft; }
validation ValidateDataConsistency on save { create; update; }
}
Step 15: Remove transport selection
Open the generated behavior definition and remove the lines action ( features : instance ) SelectCustomizingTransptReq parameter D_SelectCustomizingTransptReqP result [1] $self; and validation ValidateTransportRequest on save ##NOT_ASSIGNED_TO_DETACT { create; update; delete; }.
This will remove the transport action and the transport validation.
Step 16: Remove transport selection
Open the generated behavior pool and remove the following: The local class LHC_RAP_TDAT_CTS, the definition and implementation of method SELECTCUSTOMIZINGTRANSPTREQ as well as VALIDATETRANSPORTREQUEST, the coding of the method SAVE_MODIFIED, line 1, 4-14, 19-21 and 26 of the method GET_INSTANCE_FEATURES, the last line of the method GET_GLOBAL_AUTHORIZATIONS and the lines 2-6 of the method GET_GLOBAL_FEATURES.
This will remove implemented logic for the transport selection.
CLASS LHC_ZCAI_DATABASETABLE_S DEFINITION FINAL INHERITING FROM CL_ABAP_BEHAVIOR_HANDLER.
PRIVATE SECTION.
METHODS:
GET_INSTANCE_FEATURES FOR INSTANCE FEATURES
IMPORTING
KEYS REQUEST requested_features FOR DatabaseTableAll
RESULT result,
GET_GLOBAL_AUTHORIZATIONS FOR GLOBAL AUTHORIZATION
IMPORTING
REQUEST requested_authorizations FOR DatabaseTableAll
RESULT result.
ENDCLASS.
CLASS LHC_ZCAI_DATABASETABLE_S IMPLEMENTATION.
METHOD GET_INSTANCE_FEATURES.
DATA: edit_flag TYPE abp_behv_flag VALUE if_abap_behv=>fc-o-enabled.
READ ENTITIES OF ZCAI_DatabaseTable_S IN LOCAL MODE
ENTITY DatabaseTableAll
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(all).
result = VALUE #( (
%TKY = all[ 1 ]-%TKY
%ACTION-edit = edit_flag
%ASSOC-_DatabaseTable = edit_flag ) ).
ENDMETHOD.
METHOD GET_GLOBAL_AUTHORIZATIONS.
AUTHORITY-CHECK OBJECT 'ZCAI_DATABASETABLE' ID 'TABLE' FIELD 'ZCA_TABLE' ID 'ACTVT' FIELD '02'.
DATA(is_authorized) = COND #( WHEN sy-subrc = 0 THEN if_abap_behv=>auth-allowed
ELSE if_abap_behv=>auth-unauthorized ).
result-%UPDATE = is_authorized.
result-%ACTION-Edit = is_authorized.
ENDMETHOD.
ENDCLASS.
CLASS LSC_ZCAI_DATABASETABLE_S DEFINITION FINAL INHERITING FROM CL_ABAP_BEHAVIOR_SAVER.
PROTECTED SECTION.
METHODS:
SAVE_MODIFIED REDEFINITION,
CLEANUP_FINALIZE REDEFINITION.
ENDCLASS.
CLASS LSC_ZCAI_DATABASETABLE_S IMPLEMENTATION.
METHOD SAVE_MODIFIED.
ENDMETHOD.
METHOD CLEANUP_FINALIZE ##NEEDED.
ENDMETHOD.
ENDCLASS.
CLASS LHC_ZCAI_DATABASETABLE DEFINITION FINAL INHERITING FROM CL_ABAP_BEHAVIOR_HANDLER.
PRIVATE SECTION.
METHODS:
VALIDATEDATACONSISTENCY FOR VALIDATE ON SAVE
IMPORTING
KEYS FOR DatabaseTable~ValidateDataConsistency,
GET_GLOBAL_FEATURES FOR GLOBAL FEATURES
IMPORTING
REQUEST REQUESTED_FEATURES FOR DatabaseTable
RESULT result.
ENDCLASS.
CLASS LHC_ZCAI_DATABASETABLE IMPLEMENTATION.
METHOD VALIDATEDATACONSISTENCY.
...
ENDMETHOD.
METHOD GET_GLOBAL_FEATURES.
DATA edit_flag TYPE abp_behv_flag VALUE if_abap_behv=>fc-o-enabled.
result-%UPDATE = edit_flag.
result-%DELETE = edit_flag.
ENDMETHOD.
ENDCLASS.
METHOD GET_GLOBAL_AUTHORIZATIONS.
AUTHORITY-CHECK OBJECT 'S_TABU_NAM' ID 'TABLE' FIELD 'ZCA_TABLE' ID 'ACTVT' FIELD '02'.
DATA(is_authorized) = COND #( WHEN sy-subrc = 0 THEN if_abap_behv=>auth-allowed
ELSE if_abap_behv=>auth-unauthorized ).
result-%UPDATE = is_authorized.
result-%ACTION-Edit = is_authorized.
ENDMETHOD.
Step 17: Authorization
Delete the two generated Access Controls. The access validation will be done in the code of the behavior pool.
Open the generated behavior pool and replace the FIELD-value of the authority object S_TABU_NAM in the method GET_GLOBAL_AUTHORIZATIONS with the name of the database table created in Step 1.
Step 18: UI Texts
Open the non-singleton metadata extension and replace the values typeName, typeNamePlural, label and the facets label with fitting texts. They will be visible to the end user in the app.
Done!
This is what the custom business configuration in display mode looks like. It can be opened in the app Custom Business Configurations.