From 13f84140f46184c74364d2b5efdb0b81e8003626 Mon Sep 17 00:00:00 2001 From: CCapa Date: Sat, 8 Dec 2018 13:26:09 +0100 Subject: [PATCH] Sapscript : sequence of Windows in tdlines files (#2191) * Sapscript : sequence of Windows in tdlines files Hello Lars, You can find a code modification in the method _read_form of class zcl_abapgit_object_form related to the issue #2188 I have added a logic to sort by windows name the contains of the internal table ET_LINES . It allows to have always thre same sequence of windows code in the file (xxxxxxxxxxgit.form.tdlines). Then file comparison will work with all export. Regards Christophe * Sapscript : sequence of Windows in tdlines files Hello Lars, I have moved the code to a new private method _sort_tdlines_by_windows But I don't add 'ASSERT sy-subrc = 0.'. The reason is that during my tests I found some windows in the form without elements inside (windows is not used anymore but it sill exists. The devlopper ddin't remove it). In this case the result of the ASSERT is a dump. Using the loop from SY-TABIX there is no risk. If no entry exists in the internal table then the loop is not executed. if needed I can add the following condition before doing the loop : IF line_exists( lt_lines[ tdformat = lv_elt_windows tdline = ls_form_windows-tdwindow ] ). Christophe * Sapscript : sequence of Windows in tdlines files I have done the adjustments for the CLEAR and to be compatible with 702 Christophe * Sapscript : sequence of Windows in tdlines files Whitespace at end of line removed --- src/objects/zcl_abapgit_object_form.clas.abap | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/objects/zcl_abapgit_object_form.clas.abap b/src/objects/zcl_abapgit_object_form.clas.abap index b6d81842d..7ac8ecfcb 100644 --- a/src/objects/zcl_abapgit_object_form.clas.abap +++ b/src/objects/zcl_abapgit_object_form.clas.abap @@ -89,6 +89,11 @@ CLASS zcl_abapgit_object_form DEFINITION PUBLIC INHERITING FROM zcl_abapgit_obje es_form_data TYPE zcl_abapgit_object_form=>tys_form_data et_lines TYPE zcl_abapgit_object_form=>tyt_lines. + METHODS _sort_tdlines_by_windows + CHANGING + ct_form_windows TYPE zcl_abapgit_object_form=>tys_form_data-windows + ct_lines TYPE zcl_abapgit_object_form=>tyt_lines. + METHODS order_check_and_insert RAISING zcx_abapgit_exception. @@ -449,10 +454,38 @@ CLASS zcl_abapgit_object_form IMPLEMENTATION. tabs = es_form_data-tabs windows = es_form_data-windows. + _sort_tdlines_by_windows( CHANGING ct_form_windows = es_form_data-windows + ct_lines = et_lines ). ENDMETHOD. + METHOD _sort_tdlines_by_windows. + DATA lt_lines TYPE zcl_abapgit_object_form=>tyt_lines. + DATA ls_lines LIKE LINE OF lt_lines. + DATA ls_form_windows LIKE LINE OF ct_form_windows. + DATA lv_elt_windows TYPE tdformat VALUE '/W'. + DATA lv_firstloop TYPE boolean. - METHOD _save_form. + lt_lines = ct_lines. + CLEAR ct_lines. + + SORT ct_form_windows BY tdwindow. + + LOOP AT ct_form_windows INTO ls_form_windows. + lv_firstloop = abap_true. + READ TABLE lt_lines INTO ls_lines WITH KEY tdformat = lv_elt_windows + tdline = ls_form_windows-tdwindow. + LOOP AT lt_lines INTO ls_lines FROM sy-tabix. + IF lv_firstloop = abap_false AND + ls_lines-tdformat = lv_elt_windows. + EXIT. + ENDIF. + APPEND ls_lines TO ct_lines. + lv_firstloop = abap_false. + ENDLOOP. + ENDLOOP. + ENDMETHOD. + +METHOD _save_form. CALL FUNCTION 'SAVE_FORM' EXPORTING