ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2021-11-15 09:58:54  阅读:327  来源: 互联网

标签:itab Clear initial Free abap internal statement memory table


文章目录

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.

标签:itab,Clear,initial,Free,abap,internal,statement,memory,table
来源: https://blog.csdn.net/beyond911/article/details/121328267

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有