rspec/rules/S5769/abap/rule.adoc

45 lines
956 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Using ``++LOOP...INTO++`` with ``++MODIFY++`` statements will put the required record in a work area, process it and put it back in the internal table. It is more efficient to modify the internal table directly by using ``++LOOP...ASSIGNING++`` and field-symbols.
This rule raises an issue when a ``++LOOP...INTO++`` contains one or more ``++MODIFY++`` statements.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,abap]
2021-04-28 16:49:39 +02:00
----
LOOP AT i_bseg INTO wa_bseg.
...
wa_bseg-sgtxt = 'VALUE'.
MODIFY i_bseg FROM wa_bseg.
ENDLOOP.
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,abap]
2021-04-28 16:49:39 +02:00
----
LOOP AT i_bseg ASSIGNING <fs_bseg>.
...
<fs_bseg>-sgtxt = 'VALUE'.
ENDLOOP.
----
2021-04-28 16:49:39 +02:00
== See
2021-06-18 12:41:18 +02:00
* https://zevolving.com/use-of-field-symbols-vs-work-area/[Use of Field-symbols vs Work area]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
endif::env-github,rspecator-view[]