sflight_tab and assigns a reference to the found row to the data
reference variable sflight_ref (declared inline). After the
reference has been successfully assigned, the content of a component of
the row is changed in the internal table.
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid,
p_fldate TYPE sflight-fldate.
DATA sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid = p_connid.
IF sy-subrc = 0.
READ TABLE sflight_tab
WITH TABLE KEY carrid = p_carrid
connid = p_connid
fldate = p_fldate
REFERENCE INTO DATA(sflight_ref).
IF sy-subrc = 0.
sflight_ref->price = sflight_ref->price * '0.9'.
ENDIF.
ENDIF.
ABAP_ALTERNATIVE_4 ... TRANSPORTING NO FIELDS
What does it do? If the addition TRANSPORTING NO FIELDS is used,
the statement READ TABLE only checks whether the row that is
being searched for exists, and fills the system fields sy-subrc
and sy-tabix . The system cannot access the content of the found
row.
Latest notes: The predicate function
line_exists can also be used
to check the existence of a table row.
The table function line_index
can also be used to identify the row number in the table index.
Example ABAP Coding Checks whether a particular row exists in the internal
table sflight_carr and assigns the row number in the primary
table index of the found row in sy-tabix to idx .
PARAMETERS p_carrid TYPE scarr-carrid.
DATA: scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrid,
idx TYPE i.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
READ TABLE scarr_tab
WITH TABLE KEY carrid = p_carrid
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
idx = sy-tabix.
ENDIF.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved