ABAP中的WITH HEADER LINE有什么用? [英] What is WITH HEADER LINE used for in ABAP?

查看:1153
本文介绍了ABAP中的WITH HEADER LINE有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究这本,引用它:

I have been studying this book and quoting from it:

DATA: BEGIN OF CUSTOMER_TAB OCCURS 5,
         KUNNR TYPE KNA1-KUNNR,
         NAME1 TYPE KNA1-NAME1,
      END OF CUSTOMER_TAB.

This declaration creates an internal table and a structure using the same name: CUSTOMER_TAB.

然后在以下页面中:

Declaring Both an Internal Table and a Structure by Referring to a Structured 
Local/Global TYPE or Local/Global Structure

DATA <internal table name> {TYPE|LIKE} <structure name> OCCURS <number> WITH HEADER LINE.

WITH HEADER LINE is a reserved key phrase. The addition of this phrase creates a structure.

我现在很困惑。第一个示例是仅声明一个内部表还是一个内部表以及具有相同名称的结构?

I am confused at this moment. Is the first example declaring only an Internal Table or an Internal Table and a Structure with the same name?

推荐答案

问题应该是 ABAP中使用了WITH HEADER LINE。您应该只在旧版代码中看到它们。仅允许外部类并且已过时

The question should be "What was WITH HEADER LINE used for in ABAP". You should see them only in legacy code. They are allowed only outside classes and are obsolete anyway.

回答您的问题。两者都是。它声明一个内部表 customer_tab [] 和一个结构 customer_tab

Answering your question. It is both. It declares an internal table customer_tab[] and a structure customer_tab.

然后,您可以执行类似的惊人操作。

You could then do such "amazing" things like.

 LOOP AT customer_tab. "loops at tab CUSTOMER_TAB and stores current record in header line structure CUSTOMER_TAB. :]
   "do something with header line
 END LOOP.

 APPEND customer_tab.

如您所见,它更短并且更吸引人。

As you see it is shorter and quite appealing to be used for its brevity. Though it is hardly readable and confusing, therefore marked as obsolete.

糟糕,还有一点!您还应该了解

Oooops and one point more! You should also learn the difference between

CLEAR customer_tab.

REFRESH customer_tab.

这篇关于ABAP中的WITH HEADER LINE有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆