From ae831d52a981a046f439d71907d317dc4d0125c5 Mon Sep 17 00:00:00 2001 From: oblomov-dev <102328295+oblomov-dev@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:07:20 +0200 Subject: [PATCH] fix-db-cleanup-w-launchpad (#1473) --- src/01/00/03/z2ui5_cl_util.clas.abap | 36 +++++++++++++++++++-- src/01/02/z2ui5_cl_core_http_post.clas.abap | 3 +- src/02/z2ui5_cl_http_handler.clas.abap | 2 -- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/01/00/03/z2ui5_cl_util.clas.abap b/src/01/00/03/z2ui5_cl_util.clas.abap index 813dea55..8620a463 100644 --- a/src/01/00/03/z2ui5_cl_util.clas.abap +++ b/src/01/00/03/z2ui5_cl_util.clas.abap @@ -1451,12 +1451,44 @@ CLASS z2ui5_cl_util IMPLEMENTATION. EXPORTING val = 'TABLE_NAME_INITIAL_ERROR'. ENDIF. + TRY. - DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_name( table_name ) ). + cl_abap_structdescr=>describe_by_name( + EXPORTING + p_name = table_name + RECEIVING + p_descr_ref = DATA(lo_obj) + EXCEPTIONS + type_not_found = 1 + OTHERS = 2 + ). + + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE z2ui5_cx_util_error + EXPORTING + val = 'TABLE_NOT_FOUD_NAME___' && table_name. + ENDIF. + DATA(lo_struct) = CAST cl_abap_structdescr( lo_obj ). + CATCH cx_root. TRY. - DATA(lo_tab) = CAST cl_abap_tabledescr( cl_abap_structdescr=>describe_by_name( table_name ) ). + cl_abap_structdescr=>describe_by_name( + EXPORTING + p_name = table_name + RECEIVING + p_descr_ref = lo_obj + EXCEPTIONS + type_not_found = 1 + OTHERS = 2 + ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE z2ui5_cx_util_error + EXPORTING + val = 'TABLE_NOT_FOUD_NAME___' && table_name. + ENDIF. + + DATA(lo_tab) = CAST cl_abap_tabledescr( lo_obj ). lo_struct = CAST cl_abap_structdescr( lo_tab->get_table_line_type( ) ). CATCH cx_root. RETURN. diff --git a/src/01/02/z2ui5_cl_core_http_post.clas.abap b/src/01/02/z2ui5_cl_core_http_post.clas.abap index 2ee5196c..4d73415f 100644 --- a/src/01/02/z2ui5_cl_core_http_post.clas.abap +++ b/src/01/02/z2ui5_cl_core_http_post.clas.abap @@ -72,6 +72,7 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION. mo_action = mo_action->factory_by_frontend( ). ELSEIF ms_request-s_control-app_start IS NOT INITIAL. + NEW z2ui5_cl_core_draft_srv( )->cleanup( ). mo_action = mo_action->factory_first_start( ). ELSE. @@ -80,7 +81,6 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION. CATCH cx_root INTO DATA(x). ASSERT x->get_text( ) = 1. -* mo_action = mo_action->factory_system_error( x ). ENDTRY. ENDMETHOD. @@ -159,7 +159,6 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION. CATCH cx_root INTO DATA(x). ASSERT x->get_text( ) = 1. -* mo_action = mo_action->factory_system_error( x ). ENDTRY. ENDMETHOD. ENDCLASS. diff --git a/src/02/z2ui5_cl_http_handler.clas.abap b/src/02/z2ui5_cl_http_handler.clas.abap index 599145e8..8961c251 100644 --- a/src/02/z2ui5_cl_http_handler.clas.abap +++ b/src/02/z2ui5_cl_http_handler.clas.abap @@ -145,8 +145,6 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION. set_config( is_custom_config ). ms_res-body = get_index_html( ). - NEW z2ui5_cl_core_draft_srv( )->cleanup( ). - ENDMETHOD.