1. 内嵌声明
1)声明符号: DATA(...)
再也不需要建立一堆的临时变量了
2)指针声明符:FILED-SYMBOL(…)
*&---------------------------------------------------------------------*
7.40之前-变量
代码语言:javascript复制DATA text TYPE string.
text = `...`.
7.40之后-变量
代码语言:javascript复制DATA(text) = `...`.
*&---------------------------------------------------------------------*
7.40之前-工作区
代码语言:javascript复制DATA wa like LINE OF itab.
LOOP AT itab INTO wa.
...
ENDLOOP.
7.40之后-工作区
代码语言:javascript复制LOOP AT itab INTO DATA(wa).
...
ENDLOOP.
*&---------------------------------------------------------------------*
7.40之前-返回参数
代码语言:javascript复制DATA xml TYPE xstring.
CALL TRANSFORMATION ... RESULT XML xml.
7.40之后-返回参数
代码语言:javascript复制CALL TRANSFORMATION ... RESULT XML DATA(xml).
*&---------------------------------------------------------------------*
7.40之前-传输参数
代码语言:javascript复制DATA a1 TYPE ...
DATA a2 TYPE ...
oref->meth( IMPORTING p1 = a1 IMPORTING p2 = a2 ... )
7.40之后-传输参数
代码语言:javascript复制oref->meth( IMPORTING p1 = DATA(a1) IMPORTING p2 = DATA(a2) ... )
*&---------------------------------------------------------------------*
7.40之前-引用声明
代码语言:javascript复制DATA ixml TYPE REF TO if_ixml.
DATA stream_factory TYPE REF TO if_ixml_stream_factory.
DATA document TYPE REF TO if_ixml_document.
ixml = cl_ixml=>create( ).
stream_factory = ixml->create_stream_factory( ).
document = ixml->create_document( ).
7.40之后-引用声明
代码语言:javascript复制DATA(ixml) = cl_ixml=>create( ).
DATA(stream_factory) = ixml->create_stream_factory( ).
DATA(document) = ixml->create_document( ).
*&---------------------------------------------------------------------*
740之前-指针声明
代码语言:javascript复制FIELD-SYMBOL:<LFS_TAB> LIKE LINE OF ITAB.
LOOP AT itab ASSIGNING <LFS_TAB>.
...
ENDLOOP.
740之后-指针声明
代码语言:javascript复制LOOP AT ITAB ASSIGNING FIELD-SYMBOL(<LFS_TAB>).
…
ENDLOOP.
READ TABLE itab assigning field-symbol(<line2>) ....