Fix variant maintainance for abapGit report (#5627)

This commit is contained in:
Christian Günter 2022-06-20 17:30:54 +02:00 committed by GitHub
parent ddf1c048a0
commit 80b60e9cde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 10 deletions

View File

@ -50,7 +50,7 @@ INCLUDE zabapgit_forms.
**********************************************************************
INITIALIZATION.
PERFORM remove_toolbar USING '1001'. " Remove toolbar on html screen
PERFORM adjust_toolbar USING '1001'.
lcl_password_dialog=>on_screen_init( ).
START-OF-SELECTION.

View File

@ -78,11 +78,15 @@ FORM output.
TABLES
p_exclude = lt_ucomm.
TRY.
zcl_abapgit_ui_factory=>get_gui( )->set_focus( ).
CATCH zcx_abapgit_exception INTO lx_error.
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
" For variant maintenance we have to omit this because
" it instantiates controls and hides maintenance screens.
IF zcl_abapgit_factory=>get_environment( )->is_variant_maintenance( ) = abap_false.
TRY.
zcl_abapgit_ui_factory=>get_gui( )->set_focus( ).
CATCH zcx_abapgit_exception INTO lx_error.
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
ENDIF.
ENDFORM.
@ -128,12 +132,13 @@ FORM password_popup
ENDFORM.
FORM remove_toolbar USING pv_dynnr TYPE sy-dynnr.
FORM adjust_toolbar USING pv_dynnr TYPE sy-dynnr.
DATA: ls_header TYPE rpy_dyhead,
lt_containers TYPE dycatt_tab,
lt_fields_to_containers TYPE dyfatc_tab,
lt_flow_logic TYPE swydyflow.
lt_flow_logic TYPE swydyflow,
lv_no_toolbar LIKE ls_header-no_toolbar.
CALL FUNCTION 'RPY_DYNPRO_READ'
EXPORTING
@ -154,11 +159,16 @@ FORM remove_toolbar USING pv_dynnr TYPE sy-dynnr.
RETURN. " Ignore errors, just exit
ENDIF.
IF ls_header-no_toolbar = abap_true.
" Remove toolbar on html screen but re-insert toolbar for variant maintenance.
" Because otherwise important buttons are missing and variant maintenance is not possible.
lv_no_toolbar = boolc( zcl_abapgit_factory=>get_environment(
)->is_variant_maintenance( ) = abap_false ).
IF ls_header-no_toolbar = lv_no_toolbar.
RETURN. " No change required
ENDIF.
ls_header-no_toolbar = abap_true.
ls_header-no_toolbar = lv_no_toolbar.
CALL FUNCTION 'RPY_DYNPRO_INSERT'
EXPORTING

View File

@ -200,4 +200,17 @@ CLASS zcl_abapgit_environment IMPLEMENTATION.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_environment~is_variant_maintenance.
DATA:
lt_variscreens TYPE STANDARD TABLE OF rsdynnr
WITH NON-UNIQUE DEFAULT KEY.
" Memory is set in LSVARF08 / EXPORT_SCREEN_TABLES.
IMPORT variscreens = lt_variscreens FROM MEMORY ID '%_SCRNR_%'.
rv_is_variant_maintenance = boolc( lines( lt_variscreens ) > 0 ).
ENDMETHOD.
ENDCLASS.

View File

@ -31,4 +31,7 @@ INTERFACE zif_abapgit_environment
METHODS get_system_language_filter
RETURNING
VALUE(rt_system_language_filter) TYPE ty_system_language_filter.
METHODS is_variant_maintenance
RETURNING
VALUE(rv_is_variant_maintenance) TYPE abap_bool.
ENDINTERFACE.