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

查看:38
本文介绍了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天全站免登陆