在abap中(Clear,Free, Refesh)的用法

1. Introduction

The statements CLEAR, REFRESH, and FREE initialize data objects, that is, they set the content of a data object to an initial value.

2.Usage

2.1 Clear

Syntax

CLEAR dobj

Effect

The data object dobj is assigned the type-specific initial value. The following applies:

• The initial values are assigned to elementary data types according to the table of built-in ABAP types.

• Reference variables are assigned null references.

• Structures are set to their initial values component by component.

• All rows in an internal table are deleted. All the memory required for the table, except for the initial memory requirement, is released (see Declaring Internal Tables). The FREE statement is used to release the memory space occupied by the rows of internal tables.

The optional additions allow you to fill the spaces of a data object with other values than the initial value.

2.2 Refresh

Syntax

REFRESH itab.

Effect

This statement sets an internal table itab to its initial value, meaning that it deletes all rows of the internal table. The memory space required for the table is freed up to the initial memory size INITIAL SIZE. For itab, you must specify an internal table.

To delete all rows and free the entire memory space occupied by rows, you can use the statement FREE.

Note

The statement REFRESH itab acts for all internal tables like CLEAR itab[]. If an internal table itab has a header line, then the table body and not the header line is initialized. If the internal table itab has no header line, REFRESH itab acts like CLEAR itab. Therefore, you should always use CLEAR instead of REFRESH.

2.3 Free

Syntax

FREE dobj.

Effect

The FREE statement has the same effect as the CLEAR
statement for any data objects except internal tables.

For internal tables, FREE has the same effect as the REFRESH statement, though the entire memory area occupied by the table rows is released, and the initial memory area remains unoccupied. If dobj is a structure with table-like components, the memory of each table-like component is released.

3 Summarry

Clear and free are the same and we can initial any data object( types, instructure,variable,internal table) ,expect with herder line.( Clear itab[] = free itab).
Refersh is only for internal table and the usage is same with clear.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值