READ - Read a database table
Basic form
READ TABLE dbtab.
Additions
1. ... SEARCH FKEQ
2. ... SEARCH FKGE
3. ... SEARCH GKEQ
4. ... SEARCH GKGE
5. ... WITH KEY key
6. ... VERSION vers
Note
This variant is no longer maintained and should
therefore not be used (see also obsolete lanuguage elements
). Please use a
SELECT (SINGLE) statement
instead.
Effect
Accesses the database table dbtab
The table dbtab must be declared under
TABLES in the program. dbtab is
a table name which begins with "T" and comprises no more than five
characters altogether.
You must fill the argument fields of the table first; then you can use
READ TABLE to make direct access to the table entry.
Example
Declare table:
-
TABLES T006.
Fill argument fields:
-
MOVE: '001' TO T006-MANDT,
'STD' TO T006-MSEHI.
Access:
-
READ TABLE T006.
Process fields:
-
WRITE T006-DIMID.
Addition 1
... SEARCH FKEQ Full Key Equal (Default)
Addition 2
... SEARCH FKGE Full Key Greater or Equal
Addition 3
... SEARCH GKEQ Generic Key Equal
Addition 4
... SEARCH GKGE Generic Key Greater or
Equal
Effect
Access table using one of the above search methods.
Note
You can only specify one of the additions 1 - 4
Addition 5
... WITH KEY key
Effect
Access table with the key key .
Addition 6
... VERSION vers
Note
You should use this addition only if absolutely necessary.
In some cases, it is possible (and it makes sense) to avoid this
READ addition by using a generation program.
Effect
Specifies a dynamically definable table name. The field
vers must be a 4-character C field which contains the table
name. It is generally declared under PARAMETERS and evaluated at
runtime.
The entry read is always made available in the permanently assigned
table T...
The return code value of SY-SUBRC specifies whether a suitable
entry was found:
SY-SUBRC = 0
Entry found
SY-SUBRC <> 0
Entry not found
If the entry is not found, the system automatically sets the function
part of the table entry to SPACE .
Index
© SAP AG 1996