Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cross/zdbbr_info.msag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,12 @@
<MSGNR>104</MSGNR>
<TEXT>The entry is longer than 45 characters and is abbreviated using a &apos;*&apos;</TEXT>
</T100>
<T100>
<SPRSL>E</SPRSL>
<ARBGB>ZDBBR_INFO</ARBGB>
<MSGNR>105</MSGNR>
<TEXT>SQL Console settings were saved succesfully</TEXT>
</T100>
</T100>
</asx:values>
</asx:abap>
Expand Down
25 changes: 25 additions & 0 deletions src/cross/zdbbr_sqlcons_settings_a.tabl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DD02V>
<TABNAME>ZDBBR_SQLCONS_SETTINGS_A</TABNAME>
<DDLANGUAGE>E</DDLANGUAGE>
<TABCLASS>INTTAB</TABCLASS>
<DDTEXT>SQL Console Settings</DDTEXT>
<MASTERLANG>E</MASTERLANG>
<EXCLASS>1</EXCLASS>
</DD02V>
<DD03P_TABLE>
<DD03P>
<FIELDNAME>ADD_ENTITY_TO_FIELD_NAME</FIELDNAME>
<ROLLNAME>SAP_BOOL</ROLLNAME>
<ADMINFIELD>0</ADMINFIELD>
<VALEXI>X</VALEXI>
<SHLPORIGIN>F</SHLPORIGIN>
<COMPTYPE>E</COMPTYPE>
</DD03P>
</DD03P_TABLE>
</asx:values>
</asx:abap>
</abapGit>
43 changes: 43 additions & 0 deletions src/cross/zdbbr_sqlconsus.tabl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DD02V>
<TABNAME>ZDBBR_SQLCONSUS</TABNAME>
<DDLANGUAGE>E</DDLANGUAGE>
<TABCLASS>TRANSP</TABCLASS>
<LANGDEP>X</LANGDEP>
<DDTEXT>User Settings for SQL Console</DDTEXT>
<MASTERLANG>E</MASTERLANG>
<CONTFLAG>E</CONTFLAG>
<EXCLASS>1</EXCLASS>
</DD02V>
<DD09L>
<TABNAME>ZDBBR_SQLCONSUS</TABNAME>
<AS4LOCAL>A</AS4LOCAL>
<TABKAT>0</TABKAT>
<TABART>APPL0</TABART>
<BUFALLOW>N</BUFALLOW>
</DD09L>
<DD03P_TABLE>
<DD03P>
<FIELDNAME>USERNAME</FIELDNAME>
<KEYFLAG>X</KEYFLAG>
<ROLLNAME>USERNAME</ROLLNAME>
<ADMINFIELD>0</ADMINFIELD>
<NOTNULL>X</NOTNULL>
<COMPTYPE>E</COMPTYPE>
</DD03P>
<DD03P>
<FIELDNAME>.INCLUDE</FIELDNAME>
<ADMINFIELD>0</ADMINFIELD>
<PRECFIELD>ZDBBR_SQLCONS_SETTINGS_A</PRECFIELD>
<MASK> S</MASK>
<DDTEXT>SQL Console Settings</DDTEXT>
<COMPTYPE>S</COMPTYPE>
<GROUPNAME>DATA</GROUPNAME>
</DD03P>
</DD03P_TABLE>
</asx:values>
</asx:abap>
</abapGit>
26 changes: 26 additions & 0 deletions src/data_access/zcl_dbbr_usersettings_factory.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ CLASS zcl_dbbr_usersettings_factory DEFINITION
CLASS-METHODS is_experimental_mode_active
RETURNING
VALUE(result) TYPE abap_bool.

CLASS-METHODS set_sql_console_settings
IMPORTING
is_settings TYPE zdbbr_sqlcons_settings_a.

CLASS-METHODS get_sql_console_settings
RETURNING
VALUE(rs_settings) TYPE zdbbr_sqlconsus.
ENDCLASS.


Expand Down Expand Up @@ -137,4 +145,22 @@ CLASS zcl_dbbr_usersettings_factory IMPLEMENTATION.
iv_registered_name = zif_dbbr_main_report_var_ids=>c_s_data ) ).
rr_s_settings = REF #( lr_global_data->settings ).
ENDMETHOD.

METHOD set_sql_console_settings.
DATA(ls_settings) = CORRESPONDING zdbbr_sqlconsus( is_settings ).
ls_settings-username = sy-uname.

MODIFY zdbbr_sqlconsus FROM ls_settings.
COMMIT WORK.
ENDMETHOD.

METHOD get_sql_console_settings.
SELECT SINGLE * FROM zdbbr_sqlconsus
WHERE username = @sy-uname
INTO CORRESPONDING FIELDS OF @rs_settings.

IF sy-subrc <> 0.
rs_settings = VALUE #( add_entity_to_field_name = abap_false ).
ENDIF.
ENDMETHOD.
ENDCLASS.
27 changes: 25 additions & 2 deletions src/ui/controllers/zcl_dbbr_sql_query_editor.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ CLASS zcl_dbbr_sql_query_editor DEFINITION
insert_with_indent TYPE ui_func VALUE 'INSERT_WITH_INDENT',
format_source TYPE ui_func VALUE 'PRETTY_PRINTER',
show_code_completion TYPE ui_func VALUE 'CODE_COMPLETION',
settings TYPE ui_func VALUE 'SETTINGS',
END OF c_functions.

DATA mv_query_name TYPE zsat_query_name.
Expand All @@ -79,6 +80,7 @@ CLASS zcl_dbbr_sql_query_editor DEFINITION
DATA mv_last_tested_query TYPE string.
DATA mo_splitter TYPE REF TO zcl_uitb_gui_splitter_cont.
DATA mo_side_bar TYPE REF TO zcl_dbbr_sqle_sidebar.
DATA ms_settings TYPE zdbbr_sqlconsus.

METHODS toggle_side_bar.
METHODS init_side_bar.
Expand All @@ -88,6 +90,8 @@ CLASS zcl_dbbr_sql_query_editor DEFINITION
it_entities TYPE zdbbr_tabname_range_itab.

METHODS insert_from_clipboard.
METHODS show_settings.

ENDCLASS.


Expand Down Expand Up @@ -147,7 +151,11 @@ CLASS zcl_dbbr_sql_query_editor IMPLEMENTATION.
( function = c_functions-show_code_completion
icon = icon_abap
text = |{ 'Code Completion'(004) }|
quickinfo = |{ 'Show Code completion results'(005) }| ) )
quickinfo = |{ 'Show Code completion results'(005) }| )
( function = c_functions-settings
icon = icon_personal_settings
text = |{ 'Settings'(011) }|
quickinfo = |{ 'Customize Settings'(010) }| ) )
IMPORTING eo_toolbar = mo_toolbar
eo_client = DATA(lo_container) ).

Expand Down Expand Up @@ -238,6 +246,9 @@ CLASS zcl_dbbr_sql_query_editor IMPLEMENTATION.
mo_side_bar->zif_uitb_content_searcher~search_next( ).
ENDIF.

WHEN c_functions-settings.
show_settings( ).

ENDCASE.
ENDMETHOD.

Expand Down Expand Up @@ -269,7 +280,10 @@ CLASS zcl_dbbr_sql_query_editor IMPLEMENTATION.
text = |{ TEXT-008 }| )
( fkey = zif_uitb_c_gui_screen=>c_functions-f9
mapped_function = c_functions-toggle_side_bar
text = |{ TEXT-006 }| ) ) ).
text = |{ TEXT-006 }| )
( fkey = zif_uitb_c_gui_screen=>c_functions-f9
mapped_function = c_functions-settings
text = |{ TEXT-010 }| ) ) ).

IF mf_no_edit_allowed = abap_true.
io_callback->deactivate_function( zif_uitb_c_gui_screen=>c_functions-save ).
Expand Down Expand Up @@ -468,4 +482,13 @@ CLASS zcl_dbbr_sql_query_editor IMPLEMENTATION.

mo_editor->set_selected_text( lv_clipboard_content ).
ENDMETHOD.

METHOD show_settings.
DATA(lr_settings_controller) = NEW zcl_dbbr_sqlcons_settings_sc( ).
lr_settings_controller->show( ).

IF lr_settings_controller->was_saved( ).
ms_settings = zcl_dbbr_usersettings_factory=>get_sql_console_settings( ).
ENDIF.
ENDMETHOD.
ENDCLASS.
12 changes: 12 additions & 0 deletions src/ui/controllers/zcl_dbbr_sql_query_editor.clas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@
<ENTRY>Insert with indentations</ENTRY>
<LENGTH>48</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>010</KEY>
<ENTRY>Customize Settings</ENTRY>
<LENGTH>50</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>011</KEY>
<ENTRY>Settings</ENTRY>
<LENGTH>50</LENGTH>
</item>
</TPOOL>
<DESCRIPTIONS>
<SEOCOMPOTX>
Expand Down
118 changes: 118 additions & 0 deletions src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
"! <p class="shorttext synchronized">Controller for SQL Console settings</p>
CLASS zcl_dbbr_sqlcons_settings_sc DEFINITION
PUBLIC
CREATE PUBLIC.

PUBLIC SECTION.
INTERFACES zif_uitb_screen_controller.

ALIASES show FOR zif_uitb_screen_controller~call_screen.
ALIASES was_saved FOR zif_uitb_screen_controller~was_not_cancelled.
ALIASES pbo FOR zif_uitb_screen_controller~pbo.
ALIASES cancel FOR zif_uitb_screen_controller~cancel.
ALIASES pai FOR zif_uitb_screen_controller~handle_user_command.

"! <p class="shorttext synchronized">CONSTRUCTOR</p>
METHODS constructor.

PROTECTED SECTION.

PRIVATE SECTION.
ALIASES get_report_id FOR zif_uitb_screen_controller~get_report_id.
ALIASES get_screen_id FOR zif_uitb_screen_controller~get_screen_id.
ALIASES mf_first_call FOR zif_uitb_screen_controller~mf_first_call.

CONSTANTS c_r_sqlcon_settings_controller TYPE string VALUE 'GR_SQLCONS_SETTINGS_CONTROLLER' ##NO_TEXT.
CONSTANTS c_add_entity_to_field_name TYPE fieldname VALUE 'P_ENFN' ##NO_TEXT.

DATA ms_sqlcons_settings TYPE zdbbr_sqlcons_settings_a.

DATA:
BEGIN OF ms_sqlcons_settings_refs,
add_entity_to_field_name TYPE REF TO zdbbr_sqlcons_settings_a-add_entity_to_field_name,
END OF ms_sqlcons_settings_refs.
DATA mf_data_changed TYPE abap_bool.

METHODS transfer_ui_data
IMPORTING
if_from_screen TYPE abap_bool OPTIONAL
if_to_screen TYPE abap_bool OPTIONAL.

METHODS save_settings.
ENDCLASS.


CLASS zcl_dbbr_sqlcons_settings_sc IMPLEMENTATION.
METHOD constructor.
" initialize the global data cache
DATA(lr_data_cache) = zcl_uitb_data_cache=>get_instance( get_report_id( ) ).
ms_sqlcons_settings_refs-add_entity_to_field_name = CAST #( lr_data_cache->get_data_ref(
CONV #( c_add_entity_to_field_name ) ) ).
ENDMETHOD.

METHOD save_settings.
zcl_dbbr_usersettings_factory=>set_sql_console_settings(
VALUE #( add_entity_to_field_name = ms_sqlcons_settings-add_entity_to_field_name ) ).
ENDMETHOD.

METHOD transfer_ui_data.
IF if_from_screen = abap_true.
ms_sqlcons_settings-add_entity_to_field_name = ms_sqlcons_settings_refs-add_entity_to_field_name->*.
ELSEIF if_to_screen = abap_true.
ms_sqlcons_settings = zcl_dbbr_usersettings_factory=>get_sql_console_settings( )-data.
ms_sqlcons_settings_refs-add_entity_to_field_name->* = ms_sqlcons_settings-add_entity_to_field_name.
ENDIF.
ENDMETHOD.

METHOD zif_uitb_screen_controller~call_screen.
transfer_ui_data( if_to_screen = abap_true ).
mf_first_call = abap_true.

zcl_uitb_screen_util=>call_screen( iv_screen_id = get_screen_id( )
iv_report_id = get_report_id( )
if_selscreen = abap_true
it_object_map = VALUE #( ( variable_name = c_r_sqlcon_settings_controller
global_ref = me ) )
iv_start_column = 10
iv_start_line = 2 ).
ENDMETHOD.

METHOD zif_uitb_screen_controller~cancel.
zcl_dbbr_screen_helper=>leave_screen( ).
ENDMETHOD.

METHOD zif_uitb_screen_controller~get_report_id.
result = zif_dbbr_c_report_id=>user_settings.
ENDMETHOD.

METHOD zif_uitb_screen_controller~get_screen_id.
result = zif_dbbr_screen_ids=>c_sqlcons_settings.
ENDMETHOD.

METHOD zif_uitb_screen_controller~handle_user_command.
CHECK sy-dynnr = zif_dbbr_screen_ids=>c_sqlcons_settings.

DATA(lv_function) = cv_function_code.
CASE lv_function.

WHEN 'SAVE'.
transfer_ui_data( if_from_screen = abap_true ).
save_settings( ).
MESSAGE s105(zdbbr_info).
zcl_dbbr_screen_helper=>leave_screen( ).
ENDCASE.
ENDMETHOD.

METHOD zif_uitb_screen_controller~pbo.
zif_uitb_screen_controller~set_status( ).
ENDMETHOD.

METHOD zif_uitb_screen_controller~set_status.
zcl_uitb_screen_util=>set_selscreen_status( iv_status = '0200'
iv_repid = get_report_id( ) ).
ENDMETHOD.

METHOD zif_uitb_screen_controller~was_not_cancelled.
rf_not_cancelled = mf_data_changed.
ENDMETHOD.
ENDCLASS.
43 changes: 43 additions & 0 deletions src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>ZCL_DBBR_SQLCONS_SETTINGS_SC</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Controller for SQL Console settings</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
<TPOOL>
<item>
<ID>I</ID>
<KEY>001</KEY>
<ENTRY>Entry screen</ENTRY>
<LENGTH>23</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>002</KEY>
<ENTRY>ALV List Output</ENTRY>
<LENGTH>25</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>003</KEY>
<ENTRY>Favorites</ENTRY>
<LENGTH>19</LENGTH>
</item>
</TPOOL>
<DESCRIPTIONS>
<SEOCOMPOTX>
<CMPNAME>CONSTRUCTOR</CMPNAME>
<LANGU>E</LANGU>
<DESCRIPT>CONSTRUCTOR</DESCRIPT>
</SEOCOMPOTX>
</DESCRIPTIONS>
</asx:values>
</asx:abap>
</abapGit>
5 changes: 4 additions & 1 deletion src/ui/controls/zcl_dbbr_sqle_sb_entity_tree.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,14 @@ CLASS zcl_dbbr_sqle_sb_entity_tree IMPLEMENTATION.
RETURN.
ENDIF.

DATA(lv_add_entity_to_field_name) = zcl_dbbr_usersettings_factory=>get_sql_console_settings( )-add_entity_to_field_name.
DATA(lv_node_count) = lines( lt_nodes_info ).

LOOP AT lt_nodes_info ASSIGNING FIELD-SYMBOL(<lr_node>).
lv_sep = COND #( WHEN sy-tabix < lv_node_count THEN ',' ).
lv_content = <lr_node>->fieldname.
lv_content = COND #( WHEN <lr_node>->node_type = c_node_type-field AND lv_add_entity_to_field_name = abap_true
THEN |{ <lr_node>->entity_id }~{ <lr_node>->fieldname }|
ELSE <lr_node>->fieldname ).
IF <lr_node>->node_type = c_node_type-parameter.
lv_content = |{ lv_content } = '{ <lr_node>->param_default_value }'|.

Expand Down
Loading