我有一个疑问.我可以知道ABAP LIKE与LIKE LINE OFABAP 之间的区别是什么?我在某个地方看到了宣布工作区域的声明.
wa LIKE it_one
wa LIKE LINE OF it_one
Run Code Online (Sandbox Code Playgroud)
LIKE LINE OF 表示变量将是表格行类型.
LIKE 表示该变量与该关键字后面的变量完全相同.
例
TYPES: BEGIN OF t_my_example_structure,
my_example_field1 TYPE i,
my_example_field2 TYPE n,
END OF t_my_example_structure.
TYPES tt_my_example_structure TYPE STANDARD TABLE OF t_my_example_structure.
DATA: l_tab_my_example TYPE tt_my_example_structure.
* has structure of row of l_tab_my_example so in this case t_my_example_structure.
DATA: l_str_my_example LIKE LINE OF l_tab_my_example.
* is exactly the same table type as l_tab_my_example so in this case tt_my_example_structure.
DATA: l_tab_like_my_example LIKE l_tab_my_example.
* I use it often for LOOP AT <tab> ASSIGNING <fs>.
FIELD-SYMBOLS: <fs_str_my_example> LIKE LINE OF l_tab_my_example.
Run Code Online (Sandbox Code Playgroud)