diff --git a/src/cross/zdbbr_info.msag.xml b/src/cross/zdbbr_info.msag.xml index d995b93..072b792 100644 --- a/src/cross/zdbbr_info.msag.xml +++ b/src/cross/zdbbr_info.msag.xml @@ -638,6 +638,12 @@ 104 The entry is longer than 45 characters and is abbreviated using a '*' + + E + ZDBBR_INFO + 105 + SQL Console settings were saved succesfully + diff --git a/src/cross/zdbbr_sqlcons_settings_a.tabl.xml b/src/cross/zdbbr_sqlcons_settings_a.tabl.xml new file mode 100644 index 0000000..4cfbe75 --- /dev/null +++ b/src/cross/zdbbr_sqlcons_settings_a.tabl.xml @@ -0,0 +1,25 @@ + + + + + + ZDBBR_SQLCONS_SETTINGS_A + E + INTTAB + SQL Console Settings + E + 1 + + + + ADD_ENTITY_TO_FIELD_NAME + SAP_BOOL + 0 + X + F + E + + + + + diff --git a/src/cross/zdbbr_sqlconsus.tabl.xml b/src/cross/zdbbr_sqlconsus.tabl.xml new file mode 100644 index 0000000..95abfe1 --- /dev/null +++ b/src/cross/zdbbr_sqlconsus.tabl.xml @@ -0,0 +1,43 @@ + + + + + + ZDBBR_SQLCONSUS + E + TRANSP + X + User Settings for SQL Console + E + E + 1 + + + ZDBBR_SQLCONSUS + A + 0 + APPL0 + N + + + + USERNAME + X + USERNAME + 0 + X + E + + + .INCLUDE + 0 + ZDBBR_SQLCONS_SETTINGS_A + S + SQL Console Settings + S + DATA + + + + + diff --git a/src/data_access/zcl_dbbr_usersettings_factory.clas.abap b/src/data_access/zcl_dbbr_usersettings_factory.clas.abap index aa07a74..0f15c31 100644 --- a/src/data_access/zcl_dbbr_usersettings_factory.clas.abap +++ b/src/data_access/zcl_dbbr_usersettings_factory.clas.abap @@ -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. @@ -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. diff --git a/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.abap b/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.abap index e11f209..3beefc7 100644 --- a/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.abap +++ b/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.abap @@ -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. @@ -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. @@ -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. @@ -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) ). @@ -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. @@ -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 ). @@ -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. diff --git a/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.xml b/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.xml index 5514ba9..5a948cc 100644 --- a/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.xml +++ b/src/ui/controllers/zcl_dbbr_sql_query_editor.clas.xml @@ -66,6 +66,18 @@ Insert with indentations 48 + + I + 010 + Customize Settings + 50 + + + I + 011 + Settings + 50 + diff --git a/src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.abap b/src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.abap new file mode 100644 index 0000000..3fde3fe --- /dev/null +++ b/src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.abap @@ -0,0 +1,118 @@ +"!

Controller for SQL Console settings

+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. + + "!

CONSTRUCTOR

+ 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. diff --git a/src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.xml b/src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.xml new file mode 100644 index 0000000..fb987ad --- /dev/null +++ b/src/ui/controllers/zcl_dbbr_sqlcons_settings_sc.clas.xml @@ -0,0 +1,43 @@ + + + + + + ZCL_DBBR_SQLCONS_SETTINGS_SC + E + Controller for SQL Console settings + 1 + X + X + X + + + + I + 001 + Entry screen + 23 + + + I + 002 + ALV List Output + 25 + + + I + 003 + Favorites + 19 + + + + + CONSTRUCTOR + E + CONSTRUCTOR + + + + + diff --git a/src/ui/controls/zcl_dbbr_sqle_sb_entity_tree.clas.abap b/src/ui/controls/zcl_dbbr_sqle_sb_entity_tree.clas.abap index 175c99d..c554132 100644 --- a/src/ui/controls/zcl_dbbr_sqle_sb_entity_tree.clas.abap +++ b/src/ui/controls/zcl_dbbr_sqle_sb_entity_tree.clas.abap @@ -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(). lv_sep = COND #( WHEN sy-tabix < lv_node_count THEN ',' ). - lv_content = ->fieldname. + lv_content = COND #( WHEN ->node_type = c_node_type-field AND lv_add_entity_to_field_name = abap_true + THEN |{ ->entity_id }~{ ->fieldname }| + ELSE ->fieldname ). IF ->node_type = c_node_type-parameter. lv_content = |{ lv_content } = '{ ->param_default_value }'|. diff --git a/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingss01.abap b/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingss01.abap index 05cb936..a606277 100644 --- a/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingss01.abap +++ b/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingss01.abap @@ -10,6 +10,9 @@ AT SELECTION-SCREEN. WHEN zif_dbbr_screen_ids=>c_show_eb_settings. gr_eb_settings_view->pai( CHANGING cv_function_code = sscrfields-ucomm ). + + WHEN zif_dbbr_screen_ids=>c_sqlcons_settings. + gr_sqlcons_settings_controller->pai( CHANGING cv_function_code = sscrfields-ucomm ). ENDCASE. AT SELECTION-SCREEN ON EXIT-COMMAND. @@ -20,6 +23,10 @@ AT SELECTION-SCREEN ON EXIT-COMMAND. WHEN zif_dbbr_screen_ids=>c_show_eb_settings. gr_eb_settings_view->cancel( ). + + WHEN zif_dbbr_screen_ids=>c_sqlcons_settings. + gr_sqlcons_settings_controller->cancel( ). + ENDCASE. AT SELECTION-SCREEN OUTPUT. @@ -48,4 +55,8 @@ AT SELECTION-SCREEN OUTPUT. WHEN zif_dbbr_screen_ids=>c_show_eb_settings. gr_eb_settings_view->pbo( ). + + WHEN zif_dbbr_screen_ids=>c_sqlcons_settings. + gr_sqlcons_settings_controller->pbo( ). + ENDCASE. diff --git a/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingstop.abap b/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingstop.abap index 0117a38..a3167d4 100644 --- a/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingstop.abap +++ b/src/ui/zdbbr_user_settings.fugr.lzdbbr_user_settingstop.abap @@ -8,6 +8,7 @@ TABLES sscrfields. " global data definitions DATA gr_user_settings_controller TYPE REF TO zcl_dbbr_user_settings_sc. DATA gr_eb_settings_view TYPE REF TO zcl_dbbr_eb_settings_view. +DATA gr_sqlcons_settings_controller TYPE REF TO zcl_dbbr_sqlcons_settings_sc. SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE TEXT-s01 AS WINDOW. SELECTION-SCREEN BEGIN OF TABBED BLOCK setting_type FOR 15 LINES. @@ -378,3 +379,14 @@ SELECTION-SCREEN BEGIN OF SCREEN 200 TITLE TEXT-s02 AS WINDOW. SELECTION-SCREEN END OF SCREEN 200. " ----------------------------------------------------- + +" ... Screen for user settings of sql console +" ----------------------------------------------------- +SELECTION-SCREEN BEGIN OF SCREEN 300 TITLE TEXT-s03 AS WINDOW. + + SELECTION-SCREEN BEGIN OF BLOCK sqlcons_settings WITH FRAME TITLE TEXT-b10. + PARAMETERS p_enfn TYPE abap_bool AS CHECKBOX. + SELECTION-SCREEN END OF BLOCK sqlcons_settings. + +SELECTION-SCREEN END OF SCREEN 300. +" ----------------------------------------------------- diff --git a/src/ui/zdbbr_user_settings.fugr.saplzdbbr_user_settings.xml b/src/ui/zdbbr_user_settings.fugr.saplzdbbr_user_settings.xml index 8e20aa7..5abcf2d 100644 --- a/src/ui/zdbbr_user_settings.fugr.saplzdbbr_user_settings.xml +++ b/src/ui/zdbbr_user_settings.fugr.saplzdbbr_user_settings.xml @@ -98,6 +98,12 @@ Virtual Elements 17 + + I + B10 + SQL Console Settings + 25 + I S01 @@ -110,6 +116,12 @@ DB Browser - Central Search - Settings 50 + + I + S03 + DB Browser - SQL Console - Settings + 50 + I T01 @@ -368,16 +380,75 @@ Disable automatic 'Max Row Count' Determination 94 + + S + P_ADVM + ?... + 12 + S P_ASNVMO Selection Mode for Association 38 + + S + P_ASSLST + ?... + 12 + + + S + P_AUTHEC + ?... + 12 + + + S + P_AUTOL + ?... + 12 + + + S + P_CALCVE + ?... + 12 + + + S + P_COLAT + ?... + 12 + + + S + P_COLCF + ?... + 12 + + + S + P_COLFF + ?... + 12 + + + S + P_COLSO + ?... + 12 + S P_CVTHME - 33 + + + S + P_DEFALV + ?... + 12 S @@ -397,6 +468,18 @@ Mode for Link Click 27 + + S + P_ENFN + Add Entity Name to Field Name + 37 + + + S + P_EXPM + ?... + 12 + S P_FAVMO @@ -404,6 +487,18 @@ 30 D + + S + P_FLUSED + ?... + 12 + + + S + P_IGEVEC + ?... + 12 + S P_IOBBRM @@ -416,6 +511,150 @@ Initial Navigator Mode 30 + + S + P_KCOLNF + ?... + 12 + + + S + P_MAXL + ?... + 12 + + + S + P_NOCVEX + ?... + 12 + + + S + P_NOSRTM + ?... + 12 + + + S + P_NOTRSG + ?... + 12 + + + S + P_ONAST + ?... + 12 + + + S + P_RDDBSZ + ?... + 12 + + + S + P_REDMEM + ?... + 12 + + + S + P_TFIRST + ?... + 12 + + + S + P_TNAMES + ?... + 12 + + + S + P_TVIEW + ?... + 12 + + + S + P_XAMRDE + ?... + 12 + + + S + P_XATSCR + ?... + 12 + + + S + P_XDAMRD + ?... + 12 + + + S + P_XDBEDT + ?... + 12 + + + S + P_XDD2TC + ?... + 12 + + + S + P_XDDLFS + ?... + 12 + + + S + P_XDHLQE + ?... + 12 + + + S + P_XDONOR + ?... + 12 + + + S + P_XFLLIV + ?... + 12 + + + S + P_XIGNCS + ?... + 12 + + + S + P_XLDVAS + ?... + 12 + + + S + P_XSCCCW + ?... + 12 + + + S + P_ZERASB + ?... + 12 + diff --git a/src/ui/zif_dbbr_screen_ids.intf.abap b/src/ui/zif_dbbr_screen_ids.intf.abap index a05626d..5b18b0f 100644 --- a/src/ui/zif_dbbr_screen_ids.intf.abap +++ b/src/ui/zif_dbbr_screen_ids.intf.abap @@ -34,6 +34,7 @@ INTERFACE zif_dbbr_screen_ids cds_view_settings TYPE dynnr VALUE '0106' ##NO_TEXT, END OF c_user_settings. CONSTANTS c_show_eb_settings TYPE dynnr VALUE '0200' ##NO_TEXT. + CONSTANTS c_sqlcons_settings TYPE dynnr VALUE '0300' ##NO_TEXT. CONSTANTS c_maintain_join_table TYPE dynnr VALUE 1700 ##NO_TEXT. CONSTANTS c_maintain_join_cond TYPE dynnr VALUE 1701 ##NO_TEXT. ENDINTERFACE.