代码语言:javascript复制
*使用新语法,如果没找到则会抛出异常CX_SY_ITAB_LINE_NOT_FOUND
"Read Table index
"before
READ TABLE itab INDEX idx INTO wa.
"740
wa = itab[ idx ].
"Read Table using key
"before
READ TABLE itab INDEX idx USING KEY key INTO wa.
"740
wa = itab[ KEY key INDEX idx ].
"Read Table with key
"before
READ TABLE itab WITH KEY col1 = … col2 = … INTO wa.
"740
wa = itab[ col1 = … col2 = … ].
"Read Table with key components
"before
READ TABLE itab WITH TABLE KEY key COMPONENTS col1 = … col2 = … INTO wa.
"740
wa = itab[ KEY key col1 = … col2 = … ].
"Does record exist?
"before
READ TABLE itab … TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
…
ENDIF.
"740
IF line_exists( itab[ … ] ).
…
ENDIF.
"Get table index
"before
DATA idx type sy-tabix.
READ TABLE … TRANSPORTING NO FIELDS.
idx = sy-tabix.
"740
DATA(idx) = line_index( itab[ … ] ).