1. Introduction
Read table-table_key is only used by sorted table. Be not used standard table.
3. Syntax
... { FROM wa }
| { WITH TABLE KEY {comp_name1|(name1)} = dobj1
{comp_name2|(name2)} = dobj2
... } ... .
4. demo
DATA: spfli_tab TYPE SORTED TABLE OF spfli
WITH UNIQUE KEY carrid connid,
spfli_key LIKE LINE OF spfli_tab.
FIELD-SYMBOLS <spfli> TYPE spfli.
...
SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE carrid = 'LH'.
...
spfli_key-carrid = 'LH'.
spfli_key-connid = '0400'.
READ TABLE spfli_tab FROM spfli_key ASSIGNING <spfli>.
IF sy-subrc = 0.
...
ENDIF.
...
READ TABLE spfli_tab
WITH TABLE KEY carrid = 'LH' connid = '2402'
ASSIGNING <spfli>.
IF sy-subrc = 0.
...
ENDIF.
3 Summary
In the sap ,there are three type table. And they are standard table and hashed table
and sorted table and standard table.
Standard tables are managed system-internally by a table index.
Sorted tables are managed by a table index(like standard tables.
Hashed tables are managed by a hash algorithm.There is no table index.
Field-symbols:The field-symbols statement declares a field symbol. The naming
convertions apply to the name fs.The angle brackets of the field
symbols indicate the difference to data objects and are obligatory.
you can declare field symbols in any procedure and in the global declaration secton of an abap program, but not in the declaration section fo a class or
an interface. you can use a field symbol in any aperand position in which
it is visuble and which match the typing defined using typing.
After its declaration, a field symbol is initial- that is , it does not refernce
a memory area. you have to assgin a memory area to it before you
can use it as an aperand. otherwrise an excepiton will be triggered.