`
womendu
  • 浏览: 1480482 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

abap 中的内表操作

阅读更多
  • 声明内表

(1)
data: begin of itab occurs 0,
a type c,
end of itab.

data: begin of itab occurs 0.

include structure mara.

include type ty_self.
data a type c.
data:end of itab.

(2)
DATA itab TYPE TABLE OFt-tab WITH HEADER LINE.

(3)
DATA itablike table of stuc WITH HEADER LINE.
DATA itab TYPE table of rowtype WITH HEADER LINE.
(4)
DATA itab LIKE itab OCCURS 0 WITH HEADER LINE.

DATA itab type tabtype WITH HEADER LINE.

  • 类型定义

针对于内表与结构,类型也有表类型和行类型之分。

types: begin of ty_itab ,
a type c,
end of ty_itab.

types:ty_itab1 type table of ty_itab.

types:ty_itab2 typeline of ty_itab1.

types: begin of ty_itab .

include structure mara.

include type ty_itab.
types: data a type c,
end of itab.

types:aa type ty_itab.

types:bb type ty_itab occurs 0.

types: cc like itab occurs 0.

types: cc like itab .

  • 内表清空

refresh itab "清除内表数据
clear itab "清除没有headerline的内表数据,或者有headerline的内表工作区数据。
free itab " 清除内表内容,并收回内存

  • 内表数据删除

(1) delete itab where name = 'northsnow'.
(2) delete itab index i. (利用 sy-tabix)
(3)
loop at itab.
delete itab. 相当于delete itab index i. ,只不过是省略了 index i
endloop.
或者
loop at itab.
delete itab index sy-tabix.
endloop.
(4)
delete itab from n1 to n2 (利用 sy-tabix)

(5) delete itab from wa 根据关键字删除

(6)<!--StartFragment --> DELETEADJACENTDUPLICATESFROMitab
COMPARINGfieldlist. 删除重复的数据

where 条件和 from to 条件可以同时使用,处理两个条件的交集

  • 内表记录数

(1) data a type i.

a = lines( itab ).

(2) data a type i.

describe table itab lines a.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics