我想知道 ABAP 方法调用的按值调用 EXPORTING 参数的定义。
SAP Help Portal 指出 EXPORTING 参数可以按值调用(以及按引用调用)进行定义。它没有给出如何处理此参数类型的精确定义。相反,它指出
For precise details of the relevant ABAP statements, refer to the corresponding keyword documentation in the ABAP Editor.
现在,SAP 编辑器的 ABAP 关键字文档没有提及 EXPORTING 的按值传递。 (它确实提到了导入和更改的值传递)。
我可以猜出传值导出的含义。但我想读一下定义。从 FORM/PERFORM 中,我知道细节可能很微妙。您能给我提供有关此案例的官方描述吗?
最佳答案
我不确定即使使用 FORM
时细节也会以何种方式变得微妙 - 但无论如何,它在 the documentation: 中
There are two ways in which parameters can be passed: pass by reference and pass by value. Pass by value is selected in the Function Builder by selecting pass by value, and in the above syntax, differs from pass by reference by the specification of
VALUE( )
.
- In pass by reference, the formal parameter points directly to the actual parameter, so that changes to the formal parameters have an
immediate effect on the actual parameter.- In pass by value, when the function module is called, the formal parameter is created as a copy of the actual parameter (in
IMPORTING
andCHANGING
parameters), or initial (inEXPORTING
parameters) in the stack. InCHANGING
andEXPORTING
parameters, the formal parameter is copied to the actual parameter when returning from the function module.
关于abap - EXPORTING方法参数如何按值传递?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29912443/