rspec/rules/S1671/abap/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

55 lines
1.4 KiB
Plaintext

== Why is this an issue?
When several lines must be inserted/updated into an internal table, instead of doing those changes line by line, mass operations should be used because they offer better performance by design.
This rule raises an issue when a single line operation like ``++APPEND++``, ``++CONCATENATE++``, and ``++INSERT++`` is performed on an internal table in a loop.
=== Noncompliant code example
[source,abap]
----
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
----
=== Compliant solution
[source,abap]
----
APPEND LINES OF ITAB1 TO ITAB2.
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove the nesting loop structure and use the "XXX LINES OF ... TO" mass operation clause
'''
== Comments And Links
(visible only on this page)
=== is duplicated by: S2244
=== on 30 Apr 2014, 15:38:55 Nicolas Peru wrote:
Not really sure of what to do with this rule in fact.
Here the example are not equivalent in functional terms : compliant copy STRUC into ITAB and non compliant iterate through a table to do a write statement.
\[~ann.campbell.2] Maybe, you can provide some reference where the rule originated ?
=== on 30 Apr 2014, 15:53:32 Nicolas Peru wrote:
Rule originated from \http://www.dsag.de/fileadmin/media/Leitfaeden/Leitfaden_Best_Practice_Guide_eng/files/assets/basic-html/page20.html
endif::env-github,rspecator-view[]