zoukankan      html  css  js  c++  java
  • ABAP区别CLEAR、REFRESH、FREE

    CLEAR、REFRESH、FREE

    内表:如果使用有表头行的内表,CLEAR 仅清除表格工作区域。例如 clear gs-school 清除工作区。

    要重置整个内表而不清除表格工作区域,使用REFRESH语句或 CLEAR 语句CLEAR <itab>[].;REFRESH加不加中括号都是只清内表,另外REFRESH是专为清内表的,不能清基本类型变量,但CLEAR可以清基本类型变量。例如 clear gs-school[] 等价于 refresh gs-school 等价于 refresh gs-school[]。

    CLEAR、REFRESH语句都不会释放掉内表所占用的空间。

    如果想初始化内表的同时还要释放所占用的空间,请使用:FREE <itab>. 比如 free gs-school 可以释放内表空间。

    TYPES: BEGIN OF ty_school,
       schoolno(8) TYPE c,
       schoolname(20) TYPE c,
      END OF ty_school.
    DATA gt_school TYPE TABLE OF ty_school WITH HEADER LINE.
    
    gt_school-schoolno = '20190001'.
    gt_school-schoolname = '学生1'.
    APPEND gt_school.
    CLEAR gt_school.
    
    gt_school-schoolno = '20190002'.
    gt_school-schoolname = '学生2'.
    APPEND gt_school.
    CLEAR gt_school.
    
    gt_school-schoolno = '20190003'.
    gt_school-schoolname = '学生3'.
    INSERT gt_school INDEX 3.
    CLEAR gt_school.
    
    WRITE '输出全表为:'.
    LOOP AT gt_school.
      WRITE / gt_school.
    ENDLOOP.
    
    gt_school-schoolno = '20190003'.
    gt_school-schoolname = '修改学生3'.
    MODIFY gt_school INDEX 3.
    CLEAR gt_school.
    WRITE / '输出全表为:'.
    LOOP AT gt_school.
      WRITE / gt_school.
    ENDLOOP.
    CLEAR gt_school.
    
    READ TABLE gt_school WITH KEY schoolno = '20190003'.
    WRITE: /  '读取到的行为:',gt_school.
    CLEAR gt_school.
    
    DELETE TABLE gt_school WITH TABLE KEY schoolno = '20190003' schoolname = '修改学生3'.
    WRITE / '删除后的结果为:'.
    LOOP AT gt_school.
      WRITE / gt_school.
    ENDLOOP.
    gt_school-schoolno = '20190003'.
    gt_school-schoolname = '修改学生3'.
    
    REFRESH gt_school.
    APPEND gt_school.
    CLEAR gt_school[].
    Free gt_school.
    APPEND gt_school.
    CLEAR gt_school.
    CLEAR gt_school.
  • 相关阅读:
    PHP二维数组排序(感谢滔哥lvtao.net)
    MySQL 日志的类型
    PHP安装Xdebug扩展并配置PHPstorm调试(Centos、Windows)
    $.post 和 $.get 设置同步和异步请求
    Jquery获取敲击回车时光标所在的位置
    Jquery 数组与字符串之间的转换
    使整个页面变灰的css代码
    PHP的性能优化方法总结
    Android中完全退出当前应用系统
    Android 遮罩层效果
  • 原文地址:https://www.cnblogs.com/miaosj/p/10282570.html
Copyright © 2011-2022 走看看