ABAP - Keyword Documentation →  ABAP - Programming Language →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Types →  TYPES → 

TYPES, INDICATORS

Short Reference

Syntax

TYPES dtype TYPE struct WITH INDICATORS ind
                       [TYPE type].


Addition:

... TYPE type

Effect

Derivation of a structured data type with an indicator structure with the name ind. For struct, an existing local or global structured type must be specified. For ind, a name must be specified that follows the naming conventions.

This variant of the statement TYPES defines a structured data type that has the same components as the structured type struct specified behind TYPE, as well as an additional last component named ind as an indicator structure. The last component ind is a substructure that contains the same number of first-level components as struct, in the same sequence as in struct and with the same names as in struct. The standard data type of each component is x of length 1 and can be defined explicitly with the optional addition TYPE.

Hints

Example

An internal table that has a line structure with an indicator structure is partly filled with today's flight data for a given flight connection from the DDIC database table SFLIGHT. In the internal table, the price is reduced by 80 %. The modified table is used to update the respective date in the database table. While the lines that are to be updated are selected by the contents of key fields in the internal table, the column to be updated is indicated by marking the column PRICE of the indicator structure. Without using the INDICATORS addition of the UPDATE statement, all other non-key columns of the database table would be initialized since their values are initial in the internal table.

TYPES wa TYPE sflight WITH INDICATORS ind.

DATA itab TYPE TABLE OF wa WITH EMPTY KEY.

SELECT carrid, connid, fldate, price
       FROM sflight
       WHERE carrid = char`LH` AND
             connid = numc`0400` AND
             fldate = @sy-datum
       INTO CORRESPONDING FIELDS OF TABLE @itab.

IF sy-subrc  = 0.

  LOOP AT itab ASSIGNING FIELD-SYMBOL(<wa>).
    <wa>-price *= '0.8'.
    <wa>-ind-price = '01'.
  ENDLOOP.

  UPDATE sflight FROM TABLE @itab INDICATORS SET STRUCTURE ind.

ENDIF.

Addition

... TYPE type

Effect

Definition of the data type of each component of the indicator structure ind. To type the same applies as to TYPES ... TYPE abap_type and TYPES ... TYPE. Each non-generic local or global data type that is visible at the current position can be specified. The generic built-in ABAP types c, n, p, and x can also be specified and their standard length is defined implicitly.

Hint

For ABAP SQL indicators, only the types c and x of length 1 are relevant.

Example

See examples for UPDATE ... FROM ... INDICATORS.