diff --git a/src/objects/zcl_abapgit_object_char.clas.abap b/src/objects/zcl_abapgit_object_char.clas.abap index dcebb6286..08a6f88da 100644 --- a/src/objects/zcl_abapgit_object_char.clas.abap +++ b/src/objects/zcl_abapgit_object_char.clas.abap @@ -58,7 +58,10 @@ CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION. IF lv_new = abap_false. TRY. ro_char->if_pak_wb_object~lock_and_refresh( ). - CATCH cx_pak_wb_object_locked. + CATCH cx_pak_invalid_data + cx_pak_not_authorized + cx_pak_invalid_state + cx_pak_wb_object_locked. zcx_abapgit_exception=>raise( |Could not aquire lock, CHAR { lv_name }| ). ENDTRY. ENDIF. @@ -93,7 +96,9 @@ CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION. METHOD zif_abapgit_object~delete. DATA: lo_char TYPE REF TO cl_cls_attribute, - lv_type_group TYPE cls_attribute-type_group. + lv_type_group TYPE cls_attribute-type_group, + lx_pak_error TYPE REF TO cx_root, + lv_text TYPE string. SELECT SINGLE type_group FROM cls_attribute INTO lv_type_group @@ -102,11 +107,17 @@ CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION. lo_char = instantiate_char( lv_type_group ). - lo_char->if_pak_wb_object~delete( ). + TRY. + lo_char->if_pak_wb_object~delete( ). - lo_char->if_pak_wb_object~save( ). + lo_char->if_pak_wb_object~save( ). - lo_char->if_pak_wb_object_internal~unlock( ). + lo_char->if_pak_wb_object_internal~unlock( ). + + CATCH cx_pak_invalid_state cx_pak_invalid_data cx_pak_not_authorized INTO lx_pak_error. + lv_text = lx_pak_error->get_text( ). + zcx_abapgit_exception=>raise( lv_text ). + ENDTRY. ENDMETHOD. @@ -116,7 +127,9 @@ CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION. DATA: ls_char TYPE ty_char, lv_request TYPE trkorr, ls_description LIKE LINE OF ls_char-cls_attributet, - lo_char TYPE REF TO cl_cls_attribute. + lo_char TYPE REF TO cl_cls_attribute, + lx_pak_error TYPE REF TO cx_root, + lv_text TYPE string. FIELD-SYMBOLS: LIKE LINE OF ls_char-cls_attr_value, LIKE LINE OF ls_char-cls_attr_value. @@ -129,57 +142,63 @@ CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION. lo_char = instantiate_char( ls_char-cls_attribute-type_group ). - lo_char->if_cls_attribute~set_kind( ls_char-cls_attribute-kind ). - lo_char->if_cls_attribute~set_single_valued( ls_char-cls_attribute-is_single_valued ). - lo_char->if_cls_attribute~set_aspect( - im_aspect_for = ls_char-cls_attribute-is_aspect_for - im_aspect_value = ls_char-cls_attribute-aspect_value ). - lo_char->if_cls_attribute~set_default_flag( ls_char-cls_attribute-default_flag ). - lo_char->if_cls_attribute~set_default_value( ls_char-cls_attribute-default_value ). - lo_char->if_cls_attribute~set_sub_object_treatment( ls_char-cls_attribute-sub_obj_treatm ). - lo_char->if_cls_attribute~set_automatic_changes_allowed( ls_char-cls_attribute-automatic_change ). - lo_char->if_cls_attribute~set_manual_changes_allowed( ls_char-cls_attribute-manu_chag_allow ). - lo_char->if_cls_attribute~set_implicit_changes_allowed( ls_char-cls_attribute-implicit_change ). - lo_char->if_cls_attribute~set_expl_values_dominate_links( ls_char-cls_attribute-weak_links ). - lo_char->if_cls_attribute~set_assignment_package_rule( ls_char-cls_attribute-assignment_devc ). - lo_char->if_cls_attribute~set_hide_remark( ls_char-cls_attribute-hide_remark ). - lo_char->if_cls_attribute~set_visible_in_customer_system( ls_char-cls_attribute-visible_for_cust ). - lo_char->if_cls_attribute~set_value_table( ls_char-cls_attribute-value_table ). - lo_char->if_cls_attribute~set_vtable_field( ls_char-cls_attribute-vtable_field ). - lo_char->if_cls_attribute~set_vtable_icon_f( ls_char-cls_attribute-vtable_icon_f ). - lo_char->if_cls_attribute~set_vtext_langu_f( ls_char-cls_attribute-vtext_langu_f ). - lo_char->if_cls_attribute~set_vtext_table( ls_char-cls_attribute-vtext_table ). - lo_char->if_cls_attribute~set_vtext_text_f( ls_char-cls_attribute-vtext_text_f ). - lo_char->if_cls_attribute~set_vtext_value_f( ls_char-cls_attribute-vtext_value_f ). - lo_char->if_cls_attribute~set_existing_objects_only( ls_char-cls_attribute-existing_objects ). - lo_char->if_cls_attribute~set_objs_of_typegr( ls_char-cls_attribute-objs_of_typegr ). - lo_char->if_cls_attribute~set_obj_values_have_subtypes( ls_char-cls_attribute-objs_w_subtype ). - lo_char->if_cls_attribute~set_arbtry_val_type( ls_char-cls_attribute-arbtry_val_type ). + TRY. + lo_char->if_cls_attribute~set_kind( ls_char-cls_attribute-kind ). + lo_char->if_cls_attribute~set_single_valued( ls_char-cls_attribute-is_single_valued ). + lo_char->if_cls_attribute~set_aspect( + im_aspect_for = ls_char-cls_attribute-is_aspect_for + im_aspect_value = ls_char-cls_attribute-aspect_value ). + lo_char->if_cls_attribute~set_default_flag( ls_char-cls_attribute-default_flag ). + lo_char->if_cls_attribute~set_default_value( ls_char-cls_attribute-default_value ). + lo_char->if_cls_attribute~set_sub_object_treatment( ls_char-cls_attribute-sub_obj_treatm ). + lo_char->if_cls_attribute~set_automatic_changes_allowed( ls_char-cls_attribute-automatic_change ). + lo_char->if_cls_attribute~set_manual_changes_allowed( ls_char-cls_attribute-manu_chag_allow ). + lo_char->if_cls_attribute~set_implicit_changes_allowed( ls_char-cls_attribute-implicit_change ). + lo_char->if_cls_attribute~set_expl_values_dominate_links( ls_char-cls_attribute-weak_links ). + lo_char->if_cls_attribute~set_assignment_package_rule( ls_char-cls_attribute-assignment_devc ). + lo_char->if_cls_attribute~set_hide_remark( ls_char-cls_attribute-hide_remark ). + lo_char->if_cls_attribute~set_visible_in_customer_system( ls_char-cls_attribute-visible_for_cust ). + lo_char->if_cls_attribute~set_value_table( ls_char-cls_attribute-value_table ). + lo_char->if_cls_attribute~set_vtable_field( ls_char-cls_attribute-vtable_field ). + lo_char->if_cls_attribute~set_vtable_icon_f( ls_char-cls_attribute-vtable_icon_f ). + lo_char->if_cls_attribute~set_vtext_langu_f( ls_char-cls_attribute-vtext_langu_f ). + lo_char->if_cls_attribute~set_vtext_table( ls_char-cls_attribute-vtext_table ). + lo_char->if_cls_attribute~set_vtext_text_f( ls_char-cls_attribute-vtext_text_f ). + lo_char->if_cls_attribute~set_vtext_value_f( ls_char-cls_attribute-vtext_value_f ). + lo_char->if_cls_attribute~set_existing_objects_only( ls_char-cls_attribute-existing_objects ). + lo_char->if_cls_attribute~set_objs_of_typegr( ls_char-cls_attribute-objs_of_typegr ). + lo_char->if_cls_attribute~set_obj_values_have_subtypes( ls_char-cls_attribute-objs_w_subtype ). + lo_char->if_cls_attribute~set_arbtry_val_type( ls_char-cls_attribute-arbtry_val_type ). - READ TABLE ls_char-cls_attributet INTO ls_description WITH KEY langu = sy-langu. - IF sy-subrc <> 0. - READ TABLE ls_char-cls_attributet INTO ls_description INDEX 1. - ENDIF. - lo_char->if_cls_attribute~set_description( ls_description-text ). + READ TABLE ls_char-cls_attributet INTO ls_description WITH KEY langu = sy-langu. + IF sy-subrc <> 0. + READ TABLE ls_char-cls_attributet INTO ls_description INDEX 1. + ENDIF. + lo_char->if_cls_attribute~set_description( ls_description-text ). - LOOP AT ls_char-cls_attr_value ASSIGNING . - -activation_state = 'I'. - ENDLOOP. - LOOP AT ls_char-cls_attr_value ASSIGNING . - -activation_state = 'I'. - ENDLOOP. + LOOP AT ls_char-cls_attr_value ASSIGNING . + -activation_state = 'I'. + ENDLOOP. + LOOP AT ls_char-cls_attr_value ASSIGNING . + -activation_state = 'I'. + ENDLOOP. - lo_char->if_cls_attribute~set_values( - im_values = ls_char-cls_attr_value - im_values_t = ls_char-cls_attr_valuet ). + lo_char->if_cls_attribute~set_values( + im_values = ls_char-cls_attr_value + im_values_t = ls_char-cls_attr_valuet ). - set_default_package( iv_package ). + set_default_package( iv_package ). - lo_char->if_pak_wb_object~save( ). + lo_char->if_pak_wb_object~save( ). - lo_char->if_pak_wb_object~activate( ). + lo_char->if_pak_wb_object~activate( ). - lo_char->if_pak_wb_object_internal~unlock( ). + lo_char->if_pak_wb_object_internal~unlock( ). + + CATCH cx_pak_invalid_state cx_pak_invalid_data cx_pak_not_authorized INTO lx_pak_error. + lv_text = lx_pak_error->get_text( ). + zcx_abapgit_exception=>raise( lv_text ). + ENDTRY. ENDMETHOD. @@ -202,7 +221,10 @@ CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION. METHOD zif_abapgit_object~is_locked. - rv_is_locked = abap_false. + + rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ECLS_ATTRIBUTE' + iv_argument = |{ ms_item-obj_name }*| ). + ENDMETHOD.