The field-symbol is much like a pointer, but one that you can only access in a dereferenced form. In other words, it will hold, internally, the memory address of the variable that was assigned to it, but it will not allow you to see the memory address, only the data that is stored in the variable that it points to. This can be proved, because if you change the contents of a field-symbol that points to an internal table line, you'll see that the changes will be made directly in the line.
A data reference acts like a simple pointer, except that you can't increment or decrement the memory address like in C (ptr++, ptr-- and such). It differs from a field-symbol because you can compare two data references to check if they point to the exact same spot in the memory. Comparing two field-symbols will be a simple value comparison. Another difference is that you can allocate memory dynamically by creating data references, with the CREATE DATA command. A field-symbol can only be assigned to an already allocated variable.
本文介绍了ABAP中两种特殊的数据类型:场符号和数据引用。场符号类似于指针,但只能以解除引用的形式访问,内部保存指向变量的内存地址。数据引用则更接近传统的指针概念,允许直接比较是否指向同一内存位置,并支持动态分配内存。
831

被折叠的 条评论
为什么被折叠?



