gpt4 book ai didi

methods - 方法参数中的 "Inline declaration is not possible in this position"

转载 作者:行者123 更新时间:2023-12-01 23:13:12 25 4
gpt4 key购买 nike

下面的代码给出了这个错误:

The inline declaration "DATA(LV_DESKTOP)" is not possible in this position.

  CALL METHOD cl_gui_frontend_services=>get_desktop_directory
CHANGING
desktop_directory = data(lv_desktop). "Declaring in method

最佳答案

您不能在方法调用中使用带有 CHANGINGEXPORTING 类型参数的内联声明。

ABAP documentation没有明确说明,但明确提到内联声明可用于类型为IMPORTINGRECEIVING的参数,但有一些限制,而没有提及其他两种类型.

进行了广泛的讨论 herehere .

可能的带有方法调用的内联声明示例:

cl_gui_frontend_services=>FILE_GET_ATTRIBUTES
EXPORTING
filename = `C:\test.txt`
IMPORTING
readonly = DATA(readonly) ).
cl_ixml=>create(
RECEIVING
rval = DATA(ixml) ).

关于EXPORTINGCHANGING,您必须处理旧声明。示例:

DATA lv_desktop TYPE string.
cl_gui_frontend_services=>get_desktop_directory(
CHANGING
desktop_directory = lv_desktop ).

关于methods - 方法参数中的 "Inline declaration is not possible in this position",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69423282/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com