From f83cd1f77cd6b72e2cc2053e12a5e50ffacd3bf1 Mon Sep 17 00:00:00 2001 From: Kai Busse Date: Mon, 11 Nov 2024 08:24:25 +0000 Subject: [PATCH 1/9] added check for Prefer INSERT INTO TABLE to APPEND https://github.com/SAP/code-pal-for-abap/issues/415 --- src/y_check_prefer_insert_into.clas.abap | 45 ++++++ ...k_prefer_insert_into.clas.testclasses.abap | 153 ++++++++++++++++++ src/y_check_prefer_insert_into.clas.xml | 17 ++ 3 files changed, 215 insertions(+) create mode 100644 src/y_check_prefer_insert_into.clas.abap create mode 100644 src/y_check_prefer_insert_into.clas.testclasses.abap create mode 100644 src/y_check_prefer_insert_into.clas.xml diff --git a/src/y_check_prefer_insert_into.clas.abap b/src/y_check_prefer_insert_into.clas.abap new file mode 100644 index 00000000..3441b988 --- /dev/null +++ b/src/y_check_prefer_insert_into.clas.abap @@ -0,0 +1,45 @@ +CLASS y_check_prefer_insert_into DEFINITION + PUBLIC + INHERITING FROM y_check_base + FINAL + CREATE PUBLIC . + + PUBLIC SECTION. + METHODS constructor. + PROTECTED SECTION. + METHODS: inspect_tokens REDEFINITION. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS y_check_prefer_insert_into IMPLEMENTATION. + + METHOD constructor. + super->constructor( ). + + settings-pseudo_comment = '"#EC PREF_INSERT_INT' ##NO_TEXT. + settings-disable_threshold_selection = abap_true. + settings-threshold = 0. + settings-documentation = |{ c_docs_path-checks }prefer-insert-into.md|. + + set_check_message( 'Prefer INSERT INTO TABLE to APPEND TO.' ). + + ENDMETHOD. + + METHOD inspect_tokens. + + IF get_token_abs( statement-from ) <> 'APPEND'. + RETURN. + ENDIF. + + DATA(check_configuration) = detect_check_configuration( statement ). + + raise_error( statement_level = statement-level + statement_index = index + statement_from = statement-from + check_configuration = check_configuration ). + + ENDMETHOD. + +ENDCLASS. diff --git a/src/y_check_prefer_insert_into.clas.testclasses.abap b/src/y_check_prefer_insert_into.clas.testclasses.abap new file mode 100644 index 00000000..b09d8427 --- /dev/null +++ b/src/y_check_prefer_insert_into.clas.testclasses.abap @@ -0,0 +1,153 @@ +CLASS ltc_append_to DEFINITION INHERITING FROM y_unit_test_base FOR TESTING + DURATION SHORT + RISK LEVEL HARMLESS. + PROTECTED SECTION. + METHODS: get_cut REDEFINITION, + get_code_with_issue REDEFINITION, + get_code_without_issue REDEFINITION, + get_code_with_exemption REDEFINITION. + +ENDCLASS. + + +CLASS ltc_append_to IMPLEMENTATION. + + METHOD get_code_without_issue. + + result = VALUE #( + ( ' REPORT y_example. ' ) + + ( ' CLASS y_example DEFINITION. ' ) + ( ' PUBLIC SECTION. ' ) + ( ' METHODS example. ' ) + ( ' ENDCLASS. ' ) + + ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' METHOD example.' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' INSERT `example` INTO TABLE prefer_insert_into_table. ' ) + ( ' ENDMETHOD.' ) + ( ' ENDCLASS. ' ) + ). + + ENDMETHOD. + + METHOD get_code_with_exemption. + + result = VALUE #( + ( ' REPORT y_example. ' ) + + ( ' CLASS y_example DEFINITION. ' ) + ( ' PUBLIC SECTION. ' ) + ( ' METHODS example. ' ) + ( ' ENDCLASS. ' ) + + ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' METHOD example.' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' APPEND `example` TO prefer_insert_into_table. "#EC PREF_INSERT_INT' ) + ( ' ENDMETHOD.' ) + ( ' ENDCLASS. ' ) + ). + + ENDMETHOD. + + METHOD get_code_with_issue. + + result = VALUE #( + ( ' REPORT y_example. ' ) + + ( ' CLASS y_example DEFINITION. ' ) + ( ' PUBLIC SECTION. ' ) + ( ' METHODS example. ' ) + ( ' ENDCLASS. ' ) + + ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' METHOD example.' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' APPEND `example` TO prefer_insert_into_table.' ) + ( ' ENDMETHOD.' ) + ( ' ENDCLASS. ' ) + ). + + ENDMETHOD. + + METHOD get_cut. + result ?= NEW y_check_prefer_insert_into( ). + ENDMETHOD. + +ENDCLASS. + +CLASS ltc_append_initial_line DEFINITION INHERITING FROM ltc_append_to FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. + PROTECTED SECTION. + METHODS get_code_with_issue REDEFINITION. +ENDCLASS. + +CLASS ltc_append_initial_line IMPLEMENTATION. + + METHOD get_code_with_issue. + result = VALUE #( + ( ' REPORT y_example. ' ) + + ( ' CLASS y_example DEFINITION. ' ) + ( ' PUBLIC SECTION. ' ) + ( ' METHODS example. ' ) + ( ' ENDCLASS. ' ) + + ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' METHOD example.' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' FIELD-SYMBOLS TYPE string. ' ) + ( ' APPEND INITIAL LINE TO prefer_insert_into_table ASSIGNING .' ) + ( ' ENDMETHOD.' ) + ( ' ENDCLASS. ' ) + ). + ENDMETHOD. + +ENDCLASS. + +CLASS ltc_append_lines_of DEFINITION INHERITING FROM ltc_append_to FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. + PROTECTED SECTION. + METHODS get_code_with_issue REDEFINITION. +ENDCLASS. + +CLASS ltc_append_lines_of IMPLEMENTATION. + + METHOD get_code_with_issue. + result = VALUE #( + ( ' REPORT y_example. ' ) + + ( ' CLASS y_example DEFINITION. ' ) + ( ' PUBLIC SECTION. ' ) + ( ' METHODS example. ' ) + ( ' ENDCLASS. ' ) + + ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' METHOD example.' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' DATA example_table TYPE TABLE OF string. ' ) + ( ' APPEND LINES OF example_table TO prefer_insert_into_table.' ) + ( ' ENDMETHOD.' ) + ( ' ENDCLASS. ' ) + ). + ENDMETHOD. + +ENDCLASS. + +CLASS ltc_select DEFINITION INHERITING FROM ltc_append_to FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. + PROTECTED SECTION. + METHODS get_code_without_issue REDEFINITION. +ENDCLASS. + +CLASS ltc_select IMPLEMENTATION. + + METHOD get_code_without_issue. + result = VALUE #( + ( ' REPORT ut_test.' ) + ( ' START-OF-SELECTION.' ) + ( ' DATA example_table TYPE TABLE OF sflight.' ) + ( ' SELECT * FROM sflight APPENDING TABLE example_table.' ) + ). + ENDMETHOD. + +ENDCLASS. diff --git a/src/y_check_prefer_insert_into.clas.xml b/src/y_check_prefer_insert_into.clas.xml new file mode 100644 index 00000000..9be2c895 --- /dev/null +++ b/src/y_check_prefer_insert_into.clas.xml @@ -0,0 +1,17 @@ + + + + + + Y_CHECK_PREFER_INSERT_INTO + E + Prefer INSERT INTO TABLE to APPEND TO + 1 + X + X + X + X + + + + From 7b6e57e0ff3f20880c37f29629b75057c0fee168 Mon Sep 17 00:00:00 2001 From: Kai Busse Date: Mon, 11 Nov 2024 08:28:45 +0000 Subject: [PATCH 2/9] change documentation path --- src/y_check_prefer_insert_into.clas.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_check_prefer_insert_into.clas.abap b/src/y_check_prefer_insert_into.clas.abap index 3441b988..1ee8d3fa 100644 --- a/src/y_check_prefer_insert_into.clas.abap +++ b/src/y_check_prefer_insert_into.clas.abap @@ -21,7 +21,7 @@ CLASS y_check_prefer_insert_into IMPLEMENTATION. settings-pseudo_comment = '"#EC PREF_INSERT_INT' ##NO_TEXT. settings-disable_threshold_selection = abap_true. settings-threshold = 0. - settings-documentation = |{ c_docs_path-checks }prefer-insert-into.md|. + settings-documentation = |{ c_docs_path-checks }prefer-insert-into-to-append.md|. set_check_message( 'Prefer INSERT INTO TABLE to APPEND TO.' ). From 11635543c735403a9973d2f25c0a24d749c0a354 Mon Sep 17 00:00:00 2001 From: Kai Busse <53078228+00500500@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:36:37 +0100 Subject: [PATCH 3/9] added docs --- prefer-insert-into-to-append.md | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 prefer-insert-into-to-append.md diff --git a/prefer-insert-into-to-append.md b/prefer-insert-into-to-append.md new file mode 100644 index 00000000..b47328da --- /dev/null +++ b/prefer-insert-into-to-append.md @@ -0,0 +1,40 @@ +[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Prefer INSERT INTO TABLE to APPEND TO](prefer-insert-into-to-append.md) + +## Prefer INSERT INTO TABLE to APPEND TO + +### What is the intent of the check? + +This check searches for `APPEND` statements and reports a finding. `INSERT INTO TABLE` works with all table and key types, thus making it easier for you to refactor the table's type and key definitions if your performance requirements change. + +### How to solve the issue? + +Use `INSERT INTO` instead of `APPEND TO`. + +### What to do in case of exception? + +In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC PREF_INSERT_INT`: + +```abap + DATA prefer_insert_into_table TYPE TABLE OF string. + APPEND `example` TO prefer_insert_into_table. "#EC PREF_INSERT_INT +``` + +### Example + +Before the check: + +```abap + DATA prefer_insert_into_table TYPE TABLE OF string. + APPEND `example` TO prefer_insert_into_table. +``` + +After the check: + +```abap + DATA prefer_insert_into_table TYPE TABLE OF string. + INSERT `example` INTO TABLE prefer_insert_into_table. +``` + +### Further Readings & Knowledge + +* [Clean ABAP - Prefer INSERT INTO TABLE to APPEND TO](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-insert-into-table-to-append-to) From dc577db35def9a2dc442898737a71fe7f27f1145 Mon Sep 17 00:00:00 2001 From: Kai Busse <53078228+00500500@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:37:02 +0100 Subject: [PATCH 4/9] Delete prefer-insert-into-to-append.md --- prefer-insert-into-to-append.md | 40 --------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 prefer-insert-into-to-append.md diff --git a/prefer-insert-into-to-append.md b/prefer-insert-into-to-append.md deleted file mode 100644 index b47328da..00000000 --- a/prefer-insert-into-to-append.md +++ /dev/null @@ -1,40 +0,0 @@ -[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Prefer INSERT INTO TABLE to APPEND TO](prefer-insert-into-to-append.md) - -## Prefer INSERT INTO TABLE to APPEND TO - -### What is the intent of the check? - -This check searches for `APPEND` statements and reports a finding. `INSERT INTO TABLE` works with all table and key types, thus making it easier for you to refactor the table's type and key definitions if your performance requirements change. - -### How to solve the issue? - -Use `INSERT INTO` instead of `APPEND TO`. - -### What to do in case of exception? - -In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC PREF_INSERT_INT`: - -```abap - DATA prefer_insert_into_table TYPE TABLE OF string. - APPEND `example` TO prefer_insert_into_table. "#EC PREF_INSERT_INT -``` - -### Example - -Before the check: - -```abap - DATA prefer_insert_into_table TYPE TABLE OF string. - APPEND `example` TO prefer_insert_into_table. -``` - -After the check: - -```abap - DATA prefer_insert_into_table TYPE TABLE OF string. - INSERT `example` INTO TABLE prefer_insert_into_table. -``` - -### Further Readings & Knowledge - -* [Clean ABAP - Prefer INSERT INTO TABLE to APPEND TO](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-insert-into-table-to-append-to) From 73d306a7c01809f7ae99d940d83271da83a88633 Mon Sep 17 00:00:00 2001 From: Kai Busse <53078228+00500500@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:37:20 +0100 Subject: [PATCH 5/9] add docs --- docs/checks/prefer-insert-into-to-append.md | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/checks/prefer-insert-into-to-append.md diff --git a/docs/checks/prefer-insert-into-to-append.md b/docs/checks/prefer-insert-into-to-append.md new file mode 100644 index 00000000..b47328da --- /dev/null +++ b/docs/checks/prefer-insert-into-to-append.md @@ -0,0 +1,40 @@ +[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Prefer INSERT INTO TABLE to APPEND TO](prefer-insert-into-to-append.md) + +## Prefer INSERT INTO TABLE to APPEND TO + +### What is the intent of the check? + +This check searches for `APPEND` statements and reports a finding. `INSERT INTO TABLE` works with all table and key types, thus making it easier for you to refactor the table's type and key definitions if your performance requirements change. + +### How to solve the issue? + +Use `INSERT INTO` instead of `APPEND TO`. + +### What to do in case of exception? + +In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC PREF_INSERT_INT`: + +```abap + DATA prefer_insert_into_table TYPE TABLE OF string. + APPEND `example` TO prefer_insert_into_table. "#EC PREF_INSERT_INT +``` + +### Example + +Before the check: + +```abap + DATA prefer_insert_into_table TYPE TABLE OF string. + APPEND `example` TO prefer_insert_into_table. +``` + +After the check: + +```abap + DATA prefer_insert_into_table TYPE TABLE OF string. + INSERT `example` INTO TABLE prefer_insert_into_table. +``` + +### Further Readings & Knowledge + +* [Clean ABAP - Prefer INSERT INTO TABLE to APPEND TO](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-insert-into-table-to-append-to) From b21bb84e7f654963afc81de4ea7482878ebe6ca4 Mon Sep 17 00:00:00 2001 From: Kai Busse <53078228+00500500@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:58:31 +0100 Subject: [PATCH 6/9] Update check_documentation.md --- docs/check_documentation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/check_documentation.md b/docs/check_documentation.md index 827790f7..b43627a6 100644 --- a/docs/check_documentation.md +++ b/docs/check_documentation.md @@ -45,6 +45,7 @@ - [Prefer CASE to ELSEIF](checks/prefer-case-to-elseif.md) - [Prefer RETURNING to EXPORTING](checks/prefer-returning-to-exporting.md) - [Prefer IS NOT to NOT IS](checks/prefer-is-not-to-not-is.md) +- [Prefer INSERT INTO TABLE to APPEND TO](checks/prefer-insert-into-to-append.md) - [Prefer LINE_EXISTS or LINE_INDEX to READ TABLE or LOOP AT](checks/prefer-line-exists.md) - [Prefer NEW to CREATE OBJECT](checks/prefer-new-to-create-object.md) - [Prefer Pragmas to Pseudo Comments](checks/prefer-pragmas-to-pseudo-comments.md) From 855567df257e5341cf035edf4383c6553412a43d Mon Sep 17 00:00:00 2001 From: Kai Busse Date: Thu, 28 Nov 2024 14:02:13 +0000 Subject: [PATCH 7/9] not emit findings for append ... to ... sorted by --- src/y_check_prefer_insert_into.clas.abap | 4 + ...k_prefer_insert_into.clas.testclasses.abap | 115 +++++++++++------- 2 files changed, 76 insertions(+), 43 deletions(-) diff --git a/src/y_check_prefer_insert_into.clas.abap b/src/y_check_prefer_insert_into.clas.abap index 1ee8d3fa..8197dbbc 100644 --- a/src/y_check_prefer_insert_into.clas.abap +++ b/src/y_check_prefer_insert_into.clas.abap @@ -33,6 +33,10 @@ CLASS y_check_prefer_insert_into IMPLEMENTATION. RETURN. ENDIF. + IF next2( p_word1 = 'SORTED' p_word2 = 'BY' ) IS NOT INITIAL. + RETURN. + ENDIF. + DATA(check_configuration) = detect_check_configuration( statement ). raise_error( statement_level = statement-level diff --git a/src/y_check_prefer_insert_into.clas.testclasses.abap b/src/y_check_prefer_insert_into.clas.testclasses.abap index b09d8427..eef9cbeb 100644 --- a/src/y_check_prefer_insert_into.clas.testclasses.abap +++ b/src/y_check_prefer_insert_into.clas.testclasses.abap @@ -15,19 +15,19 @@ CLASS ltc_append_to IMPLEMENTATION. METHOD get_code_without_issue. result = VALUE #( - ( ' REPORT y_example. ' ) + ( ' REPORT y_example.' ) - ( ' CLASS y_example DEFINITION. ' ) - ( ' PUBLIC SECTION. ' ) - ( ' METHODS example. ' ) - ( ' ENDCLASS. ' ) + ( ' CLASS y_example DEFINITION.' ) + ( ' PUBLIC SECTION.' ) + ( ' METHODS example.' ) + ( ' ENDCLASS.' ) - ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' CLASS y_example IMPLEMENTATION.' ) ( ' METHOD example.' ) - ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) - ( ' INSERT `example` INTO TABLE prefer_insert_into_table. ' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string.' ) + ( ' INSERT `example` INTO TABLE prefer_insert_into_table.' ) ( ' ENDMETHOD.' ) - ( ' ENDCLASS. ' ) + ( ' ENDCLASS.' ) ). ENDMETHOD. @@ -35,19 +35,19 @@ CLASS ltc_append_to IMPLEMENTATION. METHOD get_code_with_exemption. result = VALUE #( - ( ' REPORT y_example. ' ) + ( ' REPORT y_example.' ) - ( ' CLASS y_example DEFINITION. ' ) - ( ' PUBLIC SECTION. ' ) - ( ' METHODS example. ' ) - ( ' ENDCLASS. ' ) + ( ' CLASS y_example DEFINITION.' ) + ( ' PUBLIC SECTION.' ) + ( ' METHODS example.' ) + ( ' ENDCLASS.' ) - ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' CLASS y_example IMPLEMENTATION.' ) ( ' METHOD example.' ) - ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string.' ) ( ' APPEND `example` TO prefer_insert_into_table. "#EC PREF_INSERT_INT' ) ( ' ENDMETHOD.' ) - ( ' ENDCLASS. ' ) + ( ' ENDCLASS.' ) ). ENDMETHOD. @@ -55,19 +55,19 @@ CLASS ltc_append_to IMPLEMENTATION. METHOD get_code_with_issue. result = VALUE #( - ( ' REPORT y_example. ' ) + ( ' REPORT y_example.' ) - ( ' CLASS y_example DEFINITION. ' ) - ( ' PUBLIC SECTION. ' ) - ( ' METHODS example. ' ) - ( ' ENDCLASS. ' ) + ( ' CLASS y_example DEFINITION.' ) + ( ' PUBLIC SECTION.' ) + ( ' METHODS example.' ) + ( ' ENDCLASS.' ) - ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' CLASS y_example IMPLEMENTATION.' ) ( ' METHOD example.' ) - ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string.' ) ( ' APPEND `example` TO prefer_insert_into_table.' ) ( ' ENDMETHOD.' ) - ( ' ENDCLASS. ' ) + ( ' ENDCLASS.' ) ). ENDMETHOD. @@ -87,20 +87,20 @@ CLASS ltc_append_initial_line IMPLEMENTATION. METHOD get_code_with_issue. result = VALUE #( - ( ' REPORT y_example. ' ) + ( ' REPORT y_example.' ) - ( ' CLASS y_example DEFINITION. ' ) - ( ' PUBLIC SECTION. ' ) - ( ' METHODS example. ' ) - ( ' ENDCLASS. ' ) + ( ' CLASS y_example DEFINITION.' ) + ( ' PUBLIC SECTION.' ) + ( ' METHODS example.' ) + ( ' ENDCLASS.' ) - ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' CLASS y_example IMPLEMENTATION.' ) ( ' METHOD example.' ) - ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) - ( ' FIELD-SYMBOLS TYPE string. ' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string.' ) + ( ' FIELD-SYMBOLS TYPE string.' ) ( ' APPEND INITIAL LINE TO prefer_insert_into_table ASSIGNING .' ) ( ' ENDMETHOD.' ) - ( ' ENDCLASS. ' ) + ( ' ENDCLASS.' ) ). ENDMETHOD. @@ -115,25 +115,54 @@ CLASS ltc_append_lines_of IMPLEMENTATION. METHOD get_code_with_issue. result = VALUE #( - ( ' REPORT y_example. ' ) + ( ' REPORT y_example.' ) - ( ' CLASS y_example DEFINITION. ' ) - ( ' PUBLIC SECTION. ' ) - ( ' METHODS example. ' ) - ( ' ENDCLASS. ' ) + ( ' CLASS y_example DEFINITION.' ) + ( ' PUBLIC SECTION.' ) + ( ' METHODS example.' ) + ( ' ENDCLASS.' ) - ( ' CLASS y_example IMPLEMENTATION. ' ) + ( ' CLASS y_example IMPLEMENTATION.' ) ( ' METHOD example.' ) - ( ' DATA prefer_insert_into_table TYPE TABLE OF string. ' ) - ( ' DATA example_table TYPE TABLE OF string. ' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF string.' ) + ( ' DATA example_table TYPE TABLE OF string.' ) ( ' APPEND LINES OF example_table TO prefer_insert_into_table.' ) ( ' ENDMETHOD.' ) - ( ' ENDCLASS. ' ) + ( ' ENDCLASS.' ) ). ENDMETHOD. ENDCLASS. +CLASS ltc_append_sorted_by DEFINITION INHERITING FROM ltc_append_to FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. + PROTECTED SECTION. + METHODS get_code_without_issue REDEFINITION. +ENDCLASS. + +CLASS ltc_append_sorted_by IMPLEMENTATION. + + METHOD get_code_without_issue. + result = VALUE #( + ( ' REPORT y_example.' ) + + ( ' CLASS y_example DEFINITION.' ) + ( ' PUBLIC SECTION.' ) + ( ' METHODS example.' ) + ( ' ENDCLASS.' ) + + ( ' CLASS y_example IMPLEMENTATION.' ) + ( ' METHOD example.' ) + ( ' DATA prefer_insert_into_table TYPE TABLE OF sflight.' ) + ( ' DATA example_line TYPE sflight.' ) + ( ' APPEND example_line TO prefer_insert_into_table SORTED BY fldate.' ) + ( ' ENDMETHOD.' ) + ( ' ENDCLASS.' ) + ). + ENDMETHOD. + +ENDCLASS. + + CLASS ltc_select DEFINITION INHERITING FROM ltc_append_to FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_code_without_issue REDEFINITION. From 4098ac55c567457a735f32a6bea69941edb769c4 Mon Sep 17 00:00:00 2001 From: Kai Busse <53078228+00500500@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:05:24 +0100 Subject: [PATCH 8/9] Update src/y_check_prefer_insert_into.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> --- src/y_check_prefer_insert_into.clas.abap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/y_check_prefer_insert_into.clas.abap b/src/y_check_prefer_insert_into.clas.abap index 8197dbbc..6cc2ca3e 100644 --- a/src/y_check_prefer_insert_into.clas.abap +++ b/src/y_check_prefer_insert_into.clas.abap @@ -33,7 +33,8 @@ CLASS y_check_prefer_insert_into IMPLEMENTATION. RETURN. ENDIF. - IF next2( p_word1 = 'SORTED' p_word2 = 'BY' ) IS NOT INITIAL. + IF next2( p_word1 = 'SORTED' + p_word2 = 'BY' ) IS NOT INITIAL. RETURN. ENDIF. From 11094a81076b65fe4118fcd93b197ad54d1a4f5e Mon Sep 17 00:00:00 2001 From: Kai Busse <53078228+00500500@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:05:46 +0100 Subject: [PATCH 9/9] Update src/y_check_prefer_insert_into.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> --- src/y_check_prefer_insert_into.clas.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_check_prefer_insert_into.clas.abap b/src/y_check_prefer_insert_into.clas.abap index 6cc2ca3e..ad02db0d 100644 --- a/src/y_check_prefer_insert_into.clas.abap +++ b/src/y_check_prefer_insert_into.clas.abap @@ -33,7 +33,7 @@ CLASS y_check_prefer_insert_into IMPLEMENTATION. RETURN. ENDIF. - IF next2( p_word1 = 'SORTED' + IF next2( p_word1 = 'SORTED' p_word2 = 'BY' ) IS NOT INITIAL. RETURN. ENDIF.