ABAP clear,refresh,free清空内表的区别

 

clear itab,仅清空HEADER LINE,对内表数据存储空间不影响,保留内存区。 refresh itab,不清空HEADER LINE,清除内表数据存储空间,但保存内存区。 free itab,不清空HEADER LINE,清空内表数据存储空间。

clear itab[],清空内表数据存储空间里的内容。

 

例子:

REPORT ZZZZZZZZZ.

types:begin of head, mantr(10) type c, id(10) type c, end of head. data gt_head type table of head with header line.

gt_head-mantr = 'wo'. gt_head-id = '00001'. append gt_head.

gt_head-mantr = 'you'. gt_head-id = '00002'. append gt_head.

free gt_head. write:gt_head.

loop at gt_head. write: / gt_head. endloop.

gt_head-mantr = 'he'. gt_head-id = '00003'. append gt_head. write:gt_head.

posted @ 2013-01-31 18:27  hanmos  阅读(10427)  评论(0编辑  收藏  举报