SAP UPDATE SET INDICATOR ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• SET INDICATORS UPDATE dbtab
• SET STRUCTURE UPDATE dbtab
• NOT SET STRUCTURE UPDATE dbtab

UPDATE dbtab, set indicators
Short Reference

ABAP_SYNTAX
... INDICATORS ${$[NOT$] SET STRUCTURE set_ind$}
$| (indicator_syntax) ...

ABAP_ALTERNATIVES:
1 ... INDICATORS $[NOT$] SET STRUCTURE set_ind
2 ... INDICATORS (indicator_syntax)

What does it do?
The addition INDICATORS of the UPDATE FROM clause can be used to specify set indicators for a work area or an internal table. The purpose of set indicators is to indicate columns to be changed. UPDATE FROM without indicators overwrites all fields of a row but when set indicators are used, only the indicated fields are updated. The addition can be specified only after UPDATE FROM for structured work areas wa or internal tables itab with a structured row type. The source work area or source internal table must have a structure set_ind as the last field with the same number of components as the DDIC database table to be updated, where each component serves as a set indicator for one row. There is a static variant and a dynamic variant.



Latest notes:

NON_V5_HINTS
Set indicators enforce ABAP_STRICT_781 strict mode from ABAP_RELEASE ABAP_781 / .
ABAP_HINT_END

ABAP Alternative 1 ... INDICATORS $[NOT$] SET STRUCTURE set_ind

What does it do?
The set indicator set_ind indicates which fields of a database are to be updated by the UPDATE FROM clause. set_ind must be included in the source work area or source internal table as the last field and it must contain one component for each column of the DDIC database table to be changed. All individual components of set_ind must have either the data type c and length 1, or the data type x and length 1. The UPDATE FROM clause checks the content of set_ind and updates only fields that are marked with X (data type c) or hexadecimal 1 (data type x). Fields that contain any other character or hexadecimal value are not updated.
When using the addition INDICATORS NOT SET, the reverse logic is applied: all fields are updated, except the ones marked with X (data type c) or hexadecimal 1 (data type x).
Key fields must always be included in the indicator structure. However, the set indicators do not have any effect on key fields.



Latest notes:

Set indicators work for regular structures, as well as for LOB handle structures. If the source work area or source internal table contains LOB handle components that are not marked for update, the LOBs they refer to are not updated either. As without set indicators, LOB handles should always be closed, regardless of whether they were marked for update or not.
Work areas with set indicators can be defined with the addition INDICATORS of the TYPES statement.
ABAP Alternative 2@2@> BITFIELD that is possible for SELECT cannot be used for UPDATE.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
An internal table ind_tab is defined as the source structure. When using the addition INDICATORS of the TYPES statement, it consists of the structure of the DDIC database table DEMO_UPDATE as well as the indicator structures col_ind as the last component, which mirrors the structure of the DDIC database table. Three rows are chosen to be updated. From these rows, however, only the field COL4 is marked for update. When the UPDATE FROM statement is carried out, only the three indicated fields are updated. Without the set indicators, the three rows would have been overwritten entirely and all fields for which no value was specified would have been initialized (see image below).
ABAP_NOTE The following code is an extract from the executable example UPDATE, SET INDICATORS. The results shown in the image can be replicated with the executable example.
ABEXA 01455
result1 shows the result with set indicators, result2 without set indicators.

IMAGE ABDOC_SET_INDICATORS.png 227 313
ABAP_EXAMPLE_END


ABAP_EXAMPLE_ABEXA
UPDATE, SET INDICATORS
ABAP_EXAMPLE_END

ABAP Alternative 2 ... INDICATORS (indicator_syntax)

What does it do?
Instead of the static specification, a parenthesized data object indicator_syntax can be specified after INDICATORS. This data object must contain the syntax shown for the static specification when the statement is executed. The syntax in indicator_syntax is not case-sensitive. If the data object indicator_syntax has no content, then the addition has no effect.