source code https://github.com/AntonSikidin/global_settings
Time-to-time constants appear in your code. Some time constants are less constant. They have different types for example date of feature start, rfc_dest to other system, and number of parallel tasks.
To maintain settings you have to create a table of 1 row or class for constant. Both this way has different costs to create settings, add settings, and change settings. Less is better.
And you have tens of tables of 1 row that replicate each other.
I have a solution that has the best part of both ways to maintain settings. Easy to create, easy to add, and easy to maintain. As a bonus, you can have documentation for settings like flag_25 type xfeld.
We can hold
to hold this different variable in one table I serialized them in JSON and saved them in the table of text255
to read settings:
We need to adjust something
Make layout bigger
from
to
Change field size: Double click
Visible length 50
Double click
Visible length 15
Double click
Text “Is Table?”
Activate!
To describe your settings go to ZTR_GS_CONFIG (Global Settings Configuration).
First level – project name
Second-level variables of this project
The third level is a long description of what these settings are for, how they change program flow, and what possible value can hold
Changes save in transport requests.
To edit the value of settings go to ZTR_GS_EDITOR in each system( development, quality, production )
Enter the project name or search.
In the variable block list all settings of this project. You can view or change by clicking on the var name.
Long description in Description block.
to view history.
use for navigation.
You can easily work with these settings in the program.
REPORT Z_TEST_NEW_SETTINGS.
DATA
: lr_gs TYPE REF TO zcl_gs " settings object
* variable to hold settings data
, lv_data TYPE datum
, lv_struct TYPE SCARR
, lt_table_of_date TYPE TABLE OF datum
, lt_table_of_struct TYPE TABLE OF SCARR
.
START-OF-SELECTION.
*create object
lr_gs = NEW zcl_gs( 'FIRST_PROJECT' ).
*read settings
lr_gs->get_object( EXPORTING iv_var_name = 'DATE'
IMPORTING ev_data = lv_data ).
lr_gs->get_object( EXPORTING iv_var_name = 'STRUCT'
IMPORTING ev_data = lv_struct ).
lr_gs->get_object( EXPORTING iv_var_name = 'TABLE_OF_DATE'
IMPORTING ev_data = lt_table_of_date ).
lr_gs->get_object( EXPORTING iv_var_name = 'TABLE_OF_STRUCT'
IMPORTING ev_data = lt_table_of_struct ).
*display
cl_demo_output=>write( lv_data ).
cl_demo_output=>write( lv_struct ).
cl_demo_output=>write( lt_table_of_date ).
cl_demo_output=>write( lt_table_of_struct ).
cl_demo_output=>display( ).
You cannot use a structure or table with includes with suffixes like this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |