From 8fa1eac08d1c4dd2fcf0824a932f64f6fb871aa1 Mon Sep 17 00:00:00 2001 From: oblomov <102328295+oblomov-dev@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:53:46 +0100 Subject: [PATCH] bugfix startup app (#890) * bugfix startup app * Update abaplint.jsonc --- abaplint.jsonc | 14 +++++++++++- src/01/01/z2ui5_cl_util.clas.abap | 6 ++++- src/01/01/z2ui5_cl_util_stmpncfctn.clas.abap | 22 +++++++++---------- src/01/03/z2ui5_cl_core_app_startup.clas.abap | 14 +++++++----- src/02/02/z2ui5_cl_app_search_apps.clas.abap | 18 +++++++++------ 5 files changed, 48 insertions(+), 26 deletions(-) diff --git a/abaplint.jsonc b/abaplint.jsonc index e8aded0d..3190b2a3 100644 --- a/abaplint.jsonc +++ b/abaplint.jsonc @@ -34,7 +34,19 @@ ] }, "ambiguous_statement": true, - "avoid_use": true, + "avoid_use": { + "exclude": ["z2ui5_cl_util_stmpncfctn.clas.abap"], + "severity": "Error", + "skipQuickFix": false, + "define": true, + "statics": true, + "defaultKey": true, + "break": true, + "testSeams": true, + "describeLines": true, + "exportToMemory": true, + "exportToDatabase": true +}, "begin_end_names": true, "begin_single_include": true, "call_transaction_authority_check": true, diff --git a/src/01/01/z2ui5_cl_util.clas.abap b/src/01/01/z2ui5_cl_util.clas.abap index b7d245ad..bcff371c 100644 --- a/src/01/01/z2ui5_cl_util.clas.abap +++ b/src/01/01/z2ui5_cl_util.clas.abap @@ -89,7 +89,11 @@ CLASS z2ui5_cl_util IMPLEMENTATION. AND handle2 = @handle2 AND handle3 = @handle3 INTO CORRESPONDING FIELDS OF TABLE @lt_db. - ASSERT sy-subrc = 0. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE z2ui5_cx_util_error + EXPORTING + val = `No entry for handle exists`. + ENDIF. DATA(ls_db) = lt_db[ 1 ]. diff --git a/src/01/01/z2ui5_cl_util_stmpncfctn.clas.abap b/src/01/01/z2ui5_cl_util_stmpncfctn.clas.abap index 9b337ad1..73d8ee77 100644 --- a/src/01/01/z2ui5_cl_util_stmpncfctn.clas.abap +++ b/src/01/01/z2ui5_cl_util_stmpncfctn.clas.abap @@ -270,20 +270,19 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION. DATA obj TYPE REF TO object. FIELD-SYMBOLS TYPE any. DATA lt_implementation_names TYPE string_table. - - TYPES: - BEGIN OF ty_s_impl, - clsname TYPE c LENGTH 30, - refclsname TYPE c LENGTH 30, - END OF ty_s_impl. - DATA lt_impl TYPE STANDARD TABLE OF ty_s_impl WITH EMPTY KEY. - TYPES: BEGIN OF ty_s_key, - intkey TYPE c LENGTH 30, - END OF ty_s_key. + TYPES BEGIN OF ty_s_impl. + TYPES clsname TYPE c LENGTH 30. + TYPES refclsname TYPE c LENGTH 30. + TYPES END OF ty_s_impl. + DATA lt_impl TYPE STANDARD TABLE OF ty_s_impl WITH DEFAULT KEY. + TYPES BEGIN OF ty_s_key. + TYPES intkey TYPE c LENGTH 30. + TYPES END OF ty_s_key. DATA ls_key TYPE ty_s_key. TRY. + CALL METHOD ('XCO_CP_ABAP')=>interface EXPORTING iv_name = val @@ -303,8 +302,6 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION. ENDIF. obj = . - CALL METHOD obj->('IF_XCO_INTF_IMPLEMENTATIONS~GET'). - CALL METHOD obj->('IF_XCO_INTF_IMPLEMENTATIONS~GET_NAMES') RECEIVING rt_names = lt_implementation_names. @@ -331,6 +328,7 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION. ENDTRY. + ENDMETHOD. diff --git a/src/01/03/z2ui5_cl_core_app_startup.clas.abap b/src/01/03/z2ui5_cl_core_app_startup.clas.abap index ab977b2c..76c231f1 100644 --- a/src/01/03/z2ui5_cl_core_app_startup.clas.abap +++ b/src/01/03/z2ui5_cl_core_app_startup.clas.abap @@ -9,6 +9,7 @@ CLASS z2ui5_cl_core_app_startup DEFINITION DATA: BEGIN OF ms_home, + url TYPE string, btn_text TYPE string, btn_event_id TYPE string, btn_icon TYPE string, @@ -59,6 +60,10 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION. ms_home-class_value_state = `Success`. ms_home-class_editable = abap_false. + ms_home-url = z2ui5_cl_util=>app_get_url( + client = client + classname = ms_home-classname ). + CATCH cx_root INTO DATA(lx) ##CATCH_ALL. ms_home-class_value_state_text = lx->get_text( ). ms_home-class_value_state = `Warning`. @@ -71,10 +76,6 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION. METHOD view_display_start. - DATA(lv_url) = z2ui5_cl_util=>app_get_url( - client = client - classname = ms_home-classname ). - DATA(page2) = z2ui5_cl_xml_view=>factory( )->shell( )->page( shownavbutton = abap_false ). @@ -137,7 +138,7 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION. simple_form2->label( `Step 5` )->link( text = `Link to the Application` target = `_blank` - href = lv_url + href = client->_bind( ms_home-url ) enabled = `{= $` && client->_bind( val = ms_home-class_editable ) && ` === false }` ). @@ -241,6 +242,9 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION. ms_home-btn_event_id = `BUTTON_CHECK`. ms_home-btn_icon = `sap-icon://validate`. ms_home-class_editable = abap_true. + + + ELSE. on_event_check( ). ENDIF. diff --git a/src/02/02/z2ui5_cl_app_search_apps.clas.abap b/src/02/02/z2ui5_cl_app_search_apps.clas.abap index 6dbb29c7..3221428a 100644 --- a/src/02/02/z2ui5_cl_app_search_apps.clas.abap +++ b/src/02/02/z2ui5_cl_app_search_apps.clas.abap @@ -44,7 +44,7 @@ ENDCLASS. -CLASS Z2UI5_CL_APP_SEARCH_APPS IMPLEMENTATION. +CLASS z2ui5_cl_app_search_apps IMPLEMENTATION. METHOD search. @@ -306,12 +306,16 @@ CLASS Z2UI5_CL_APP_SEARCH_APPS IMPLEMENTATION. IF check_initialized = abap_false. check_initialized = abap_true. - z2ui5_cl_util=>db_load_by_handle( - EXPORTING - uname = sy-uname - handle = 'z2ui5_cl_app_search_apps' - IMPORTING - result = mt_favs ). + TRY. + z2ui5_cl_util=>db_load_by_handle( + EXPORTING + uname = sy-uname + handle = 'z2ui5_cl_app_search_apps' + IMPORTING + result = mt_favs ). + + CATCH cx_root. + ENDTRY. mt_apps = VALUE #( FOR row IN z2ui5_cl_util=>rtti_get_classes_impl_intf( `Z2UI5_IF_APP` ) ( name = row ) ).