mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
IOBJ/ODSO: Fix errors if objects exist already (#5551)
Implementation worked only for new objects (argh) Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
b0a31b0e3b
commit
ff0fc72891
|
@ -55,14 +55,20 @@ CLASS zcl_abapgit_object_iobj IMPLEMENTATION.
|
||||||
|
|
||||||
CALL FUNCTION 'RSD_IOBJ_GET'
|
CALL FUNCTION 'RSD_IOBJ_GET'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
i_iobjnm = lv_objna
|
i_iobjnm = lv_objna
|
||||||
i_objvers = 'A'
|
i_objvers = 'A'
|
||||||
IMPORTING
|
IMPORTING
|
||||||
e_s_viobj = <lg_viobj>.
|
e_s_viobj = <lg_viobj>
|
||||||
|
EXCEPTIONS
|
||||||
ASSIGN COMPONENT 'TSTPNM' OF STRUCTURE <lg_viobj> TO <lg_tstpnm>.
|
iobj_not_found = 1
|
||||||
|
illegal_input = 2
|
||||||
rv_user = <lg_tstpnm>.
|
bct_comp_invalid = 3
|
||||||
|
not_authorized = 4
|
||||||
|
OTHERS = 5.
|
||||||
|
IF sy-subrc = 0.
|
||||||
|
ASSIGN COMPONENT 'TSTPNM' OF STRUCTURE <lg_viobj> TO <lg_tstpnm>.
|
||||||
|
rv_user = <lg_tstpnm>.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -208,31 +214,49 @@ CLASS zcl_abapgit_object_iobj IMPLEMENTATION.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
|
|
||||||
CALL FUNCTION 'BAPI_IOBJ_CREATE'
|
|
||||||
EXPORTING
|
|
||||||
details = <lg_details>
|
|
||||||
IMPORTING
|
|
||||||
return = ls_return
|
|
||||||
TABLES
|
|
||||||
compounds = <lt_compounds>
|
|
||||||
attributes = <lt_attributes>
|
|
||||||
navigationattributes = <lt_navigationattributes>
|
|
||||||
atrnavinfoprovider = <lt_atrnavinfoprovider>
|
|
||||||
hierarchycharacteristics = <lt_hierarchycharacteristics>
|
|
||||||
elimination = <lt_elimination>
|
|
||||||
hanafieldsmapping = <lt_hanafieldsmapping>
|
|
||||||
xxlattributes = <lt_xxlattributes>.
|
|
||||||
|
|
||||||
IF ls_return-type = 'E'.
|
|
||||||
zcx_abapgit_exception=>raise( |Error when creating iobj: { ls_return-message }| ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ASSIGN
|
ASSIGN
|
||||||
COMPONENT 'INFOOBJECT'
|
COMPONENT 'INFOOBJECT'
|
||||||
OF STRUCTURE <lg_details>
|
OF STRUCTURE <lg_details>
|
||||||
TO <lg_infoobject>.
|
TO <lg_infoobject>.
|
||||||
ASSERT sy-subrc = 0.
|
ASSERT sy-subrc = 0.
|
||||||
|
|
||||||
|
IF zif_abapgit_object~exists( ) = abap_false.
|
||||||
|
CALL FUNCTION 'BAPI_IOBJ_CREATE'
|
||||||
|
EXPORTING
|
||||||
|
details = <lg_details>
|
||||||
|
IMPORTING
|
||||||
|
return = ls_return
|
||||||
|
TABLES
|
||||||
|
compounds = <lt_compounds>
|
||||||
|
attributes = <lt_attributes>
|
||||||
|
navigationattributes = <lt_navigationattributes>
|
||||||
|
atrnavinfoprovider = <lt_atrnavinfoprovider>
|
||||||
|
hierarchycharacteristics = <lt_hierarchycharacteristics>
|
||||||
|
elimination = <lt_elimination>
|
||||||
|
hanafieldsmapping = <lt_hanafieldsmapping>
|
||||||
|
xxlattributes = <lt_xxlattributes>.
|
||||||
|
ELSE.
|
||||||
|
CALL FUNCTION 'BAPI_IOBJ_CHANGE'
|
||||||
|
EXPORTING
|
||||||
|
infoobject = <lg_infoobject>
|
||||||
|
details = <lg_details>
|
||||||
|
IMPORTING
|
||||||
|
return = ls_return
|
||||||
|
TABLES
|
||||||
|
compounds = <lt_compounds>
|
||||||
|
attributes = <lt_attributes>
|
||||||
|
navigationattributes = <lt_navigationattributes>
|
||||||
|
atrnavinfoprovider = <lt_atrnavinfoprovider>
|
||||||
|
hierarchycharacteristics = <lt_hierarchycharacteristics>
|
||||||
|
elimination = <lt_elimination>
|
||||||
|
hanafieldsmapping = <lt_hanafieldsmapping>
|
||||||
|
xxlattributes = <lt_xxlattributes>.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF ls_return-type = 'E'.
|
||||||
|
zcx_abapgit_exception=>raise( |Error when creating iobj: { ls_return-message }| ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
APPEND <lg_infoobject> TO <lt_infoobjects>.
|
APPEND <lg_infoobject> TO <lt_infoobjects>.
|
||||||
|
|
||||||
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
|
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
|
||||||
|
|
|
@ -133,6 +133,7 @@ CLASS zcl_abapgit_object_odso IMPLEMENTATION.
|
||||||
|
|
||||||
FIELD-SYMBOLS:
|
FIELD-SYMBOLS:
|
||||||
<lg_details> TYPE any,
|
<lg_details> TYPE any,
|
||||||
|
<lg_odsobject> TYPE any,
|
||||||
<lt_infoobjects> TYPE STANDARD TABLE,
|
<lt_infoobjects> TYPE STANDARD TABLE,
|
||||||
<lt_navigation> TYPE STANDARD TABLE,
|
<lt_navigation> TYPE STANDARD TABLE,
|
||||||
<lt_indexes> TYPE STANDARD TABLE,
|
<lt_indexes> TYPE STANDARD TABLE,
|
||||||
|
@ -169,17 +170,34 @@ CLASS zcl_abapgit_object_odso IMPLEMENTATION.
|
||||||
io_xml->read( EXPORTING iv_name = 'INDEX_IOBJ'
|
io_xml->read( EXPORTING iv_name = 'INDEX_IOBJ'
|
||||||
CHANGING cg_data = <lt_index_iobj> ).
|
CHANGING cg_data = <lt_index_iobj> ).
|
||||||
TRY.
|
TRY.
|
||||||
CALL FUNCTION 'BAPI_ODSO_CREATE'
|
|
||||||
EXPORTING
|
ASSIGN COMPONENT 'ODSOBJECT' OF STRUCTURE <lg_details> TO <lg_odsobject>.
|
||||||
details = <lg_details>
|
ASSERT sy-subrc = 0.
|
||||||
IMPORTING
|
|
||||||
odsobject = lv_dsonam
|
IF zif_abapgit_object~exists( ) = abap_false.
|
||||||
TABLES
|
CALL FUNCTION 'BAPI_ODSO_CREATE'
|
||||||
infoobjects = <lt_infoobjects>
|
EXPORTING
|
||||||
navigationattributes = <lt_navigation>
|
details = <lg_details>
|
||||||
indexes = <lt_indexes>
|
IMPORTING
|
||||||
indexesinfoobjects = <lt_index_iobj>
|
odsobject = lv_dsonam
|
||||||
return = lt_return.
|
TABLES
|
||||||
|
infoobjects = <lt_infoobjects>
|
||||||
|
navigationattributes = <lt_navigation>
|
||||||
|
indexes = <lt_indexes>
|
||||||
|
indexesinfoobjects = <lt_index_iobj>
|
||||||
|
return = lt_return.
|
||||||
|
ELSE.
|
||||||
|
CALL FUNCTION 'BAPI_ODSO_CHANGE'
|
||||||
|
EXPORTING
|
||||||
|
odsobject = <lg_odsobject>
|
||||||
|
details = <lg_details>
|
||||||
|
TABLES
|
||||||
|
infoobjects = <lt_infoobjects>
|
||||||
|
navigationattributes = <lt_navigation>
|
||||||
|
indexes = <lt_indexes>
|
||||||
|
indexesinfoobjects = <lt_index_iobj>
|
||||||
|
return = lt_return.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
CATCH cx_sy_dyn_call_illegal_func.
|
CATCH cx_sy_dyn_call_illegal_func.
|
||||||
zcx_abapgit_exception=>raise( |Necessary BW function modules not found or object not supported| ).
|
zcx_abapgit_exception=>raise( |Necessary BW function modules not found or object not supported| ).
|
||||||
|
@ -192,7 +210,7 @@ CLASS zcl_abapgit_object_odso IMPLEMENTATION.
|
||||||
|
|
||||||
CALL FUNCTION 'BAPI_ODSO_ACTIVATE'
|
CALL FUNCTION 'BAPI_ODSO_ACTIVATE'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
odsobject = lv_dsonam
|
odsobject = <lg_odsobject>
|
||||||
TABLES
|
TABLES
|
||||||
return = lt_return.
|
return = lt_return.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user