我一直在研究这个book并引用其中:
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.
我此刻很困惑。第一个示例是仅声明一个内部表还是一个内部表和一个同名的结构?
问题应该是“ABAP 中WITH HEADER LINE 的用途是什么”。您应该只在遗留代码中看到它们。他们只被允许课外并且是obsolete anyway.
回答你的问题。两者都是。它声明了一个内部表customer_tab[]
和一个结构customer_tab
.
然后你就可以做这样“令人惊奇”的事情了。
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.
or
APPEND customer_tab.
正如您所看到的,它更短,并且因其简洁而非常有吸引力。尽管它难以阅读且令人困惑,因此被标记为已过时。
哎呀,还有一分!您还应该了解之间的区别
CLEAR customer_tab.
and
REFRESH customer_tab.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)