generic object handler: fix special cases (#6444)

This commit is contained in:
Marc Bernard 2023-08-29 16:29:53 -04:00 committed by GitHub
parent 0f97e83652
commit 8022eafdab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,7 +125,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECTS_GENERIC IMPLEMENTATION. CLASS zcl_abapgit_objects_generic IMPLEMENTATION.
METHOD after_import. METHOD after_import.
@ -228,7 +228,7 @@ CLASS ZCL_ABAPGIT_OBJECTS_GENERIC IMPLEMENTATION.
zcx_abapgit_exception=>raise( 'Not found in OBJH, or not supported' ). zcx_abapgit_exception=>raise( 'Not found in OBJH, or not supported' ).
ENDIF. ENDIF.
* object tables " object tables
SELECT * FROM objsl INTO CORRESPONDING FIELDS OF TABLE mt_object_table SELECT * FROM objsl INTO CORRESPONDING FIELDS OF TABLE mt_object_table
WHERE objectname = is_item-obj_type WHERE objectname = is_item-obj_type
AND objecttype = lc_logical_transport_object AND objecttype = lc_logical_transport_object
@ -237,14 +237,13 @@ CLASS ZCL_ABAPGIT_OBJECTS_GENERIC IMPLEMENTATION.
IF mt_object_table IS INITIAL. IF mt_object_table IS INITIAL.
zcx_abapgit_exception=>raise( |Obviously corrupted object-type { is_item-obj_type }: No tables defined| ). zcx_abapgit_exception=>raise( |Obviously corrupted object-type { is_item-obj_type }: No tables defined| ).
ENDIF. ENDIF.
* only unique tables
SORT mt_object_table BY tobj_name ASCENDING.
DELETE ADJACENT DUPLICATES FROM mt_object_table COMPARING tobj_name.
* back to primary key table sorting, " remove duplicate table/table-key entries
SORT mt_object_table BY objectname objecttype trwcount. " same table with different keys is ok
SORT mt_object_table BY tobj_name tobjkey.
DELETE ADJACENT DUPLICATES FROM mt_object_table COMPARING tobj_name tobjkey.
* object methods " object methods
SELECT * FROM objm INTO TABLE mt_object_method SELECT * FROM objm INTO TABLE mt_object_method
WHERE objectname = is_item-obj_type WHERE objectname = is_item-obj_type
AND objecttype = lc_logical_transport_object AND objecttype = lc_logical_transport_object
@ -455,13 +454,18 @@ CLASS ZCL_ABAPGIT_OBJECTS_GENERIC IMPLEMENTATION.
METHOD get_primary_table. METHOD get_primary_table.
DATA: ls_object_table LIKE LINE OF mt_object_table. DATA: ls_object_table LIKE LINE OF mt_object_table.
DATA: lt_object_table LIKE mt_object_table.
" There might be several tables marked as "primary"
" Sort by DB key so we get first one in the list
lt_object_table = mt_object_table.
SORT lt_object_table.
READ TABLE mt_object_table INTO ls_object_table WITH KEY prim_table = abap_true. READ TABLE lt_object_table INTO ls_object_table WITH KEY prim_table = abap_true.
IF sy-subrc <> 0. IF sy-subrc <> 0.
* Fallback. For some objects, no primary table is explicitly flagged " Fallback. For some objects, no primary table is explicitly flagged
* The, the one with only one key field shall be chosen " Then, the one with only one key field shall be chosen
READ TABLE mt_object_table INTO ls_object_table WITH KEY tobjkey = '/&'. "#EC CI_SUBRC READ TABLE lt_object_table INTO ls_object_table WITH KEY tobjkey = '/&'. "#EC CI_SUBRC
ENDIF. ENDIF.
IF ls_object_table IS INITIAL. IF ls_object_table IS INITIAL.
zcx_abapgit_exception=>raise( |Object { ms_item-obj_type } has got no defined primary table| ). zcx_abapgit_exception=>raise( |Object { ms_item-obj_type } has got no defined primary table| ).
@ -533,7 +537,6 @@ CLASS ZCL_ABAPGIT_OBJECTS_GENERIC IMPLEMENTATION.
lv_objkey_pos = lv_objkey_pos + 1. lv_objkey_pos = lv_objkey_pos + 1.
* object name * object name
ELSEIF <ls_object_table>-tobjkey+lv_next_objkey_pos(1) = '&'. ELSEIF <ls_object_table>-tobjkey+lv_next_objkey_pos(1) = '&'.
"TODO
ls_objkey-value = ms_item-obj_name. ls_objkey-value = ms_item-obj_name.
* The object name might comprise multiple key components (e. g. WDCC) * The object name might comprise multiple key components (e. g. WDCC)
* This string needs to be split * This string needs to be split