Building unique sorted hashed tables.

INSERT in a sorted table with unique key


* Entries: 1000, Duplicates: 250
* Line width: 100, Key width: 20
* ITAB2 takes 750 entries with unique key K

REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
  INSERT WA INTO TABLE ITAB2.
  IF SY-SUBRC <> 0.
    " ...
  ENDIF.
ENDLOOP.

 

 


INSERT in a hashed table with unique key

* Entries: 1000, Duplicates: 250
* Line width: 100, Key width: 20
* ITAB2 takes 750 entries with unique key K

REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
  INSERT WA INTO TABLE ITAB2.
  IF SY-SUBRC <> 0.
    " ...
  ENDIF.
ENDLOOP.

 


Documentation
You can use the same syntax (generic INSERT ... INTO TABLE ...) for
different types of tables (SORTED, HASHED).
Filling a sorted table is equivalent to building it up by "READ BINARY
SEARCH" and "INSERT ... INDEX SY-TABIX" but it is slightly faster and
more elegant to use the generic "INSERT ... INTO TABLE ...". See the
example for building a unique standard table, if you need no access
to the table while it is build up.
Filling a hash table is faster than for a sorted table. You can access
single entries very fast, but partial sequential loops are more
expensive than for sorted tables (see the separate example).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值