Read table-table_key的用法

本文介绍了SAP中的三种表格类型:标准表、排序表和哈希表,重点讲解了排序表的使用,包括其语法和示例。字段符号作为数据对象的别名,用于内存区域的引用,必须在声明时使用尖括号包围。文章还强调了在使用字段符号前必须先分配内存区域,否则会触发异常。
摘要由CSDN通过智能技术生成

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值