gpt4 book ai didi

abap - 当前 CLASS POOL 中 PUBLIC 类的名称必须是 "..."而不是 "..."

转载 作者:行者123 更新时间:2023-12-02 08:00:34 25 4
gpt4 key购买 nike

我试图在全局类 (Z_MY_GLOBAL_CLASS) 中创建本地类 (Z_MY_LOCAL_CLASS),方法是在事务 se24 中单击“本地定义/实现”

Button "Local Definitions/Implementations"

然后,我将另一个类的源代码从其基于源代码的 View 复制到单击“本地定义”按钮后显示的文本区域中。

enter image description here

*"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations

class Z_MY_LOCAL_CLASS definition
public
final
create public .

public section.

class-methods SOME_STATIC_METHOD
importing
!IS_IS type Z_SOME_TYPE
returning
value(RS_RETURN) type Z_SOME_TYPE .
protected section.
private section.
ENDCLASS.



CLASS Z_MY_LOCAL_CLASS IMPLEMENTATION.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method Z_MY_LOCAL_CLASS=>SOME_STATIC_METHOD
* +-------------------------------------------------------------------------------------------------+
* | [--->] IS_IN TYPE Z_SOME_TYPE
* | [<-()] RS_RETURN TYPE Z_SOME_TYPE
* +--------------------------------------------------------------------------------------</SIGNATURE>
method SOME_STATIC_METHOD.
"" some coding
endmethod.
ENDCLASS.

尝试激活编码时,我收到以下消息:

The name of the PUBLIC class in the current CLASS POOL must be "Z_MY_GLOBAL_CLASS", not "Z_MY_LOCAL_CLASS".

或德语:

Der Name der PUBLIC-Klasse im aktuellen CLASS-POOL muß "Z_MY_GLOBAL_CLASS" statt "Z_MY_LOCAL_CLASS" lauten.

这是什么意思?

最佳答案

在 SAP/ABAP 中,错误消息通常不会描述实际错误。在本地类的定义中更改这些行

class Z_MY_LOCAL_CLASS definition
public
final
create public .

对此

class Z_MY_LOCAL_CLASS definition final create public.

它应该可以编译。所以问题是只允许全局类包含public .将源代码从现有全局类复制/迁移到本地类时,您必须删除这些行。

关于abap - 当前 CLASS POOL 中 PUBLIC 类的名称必须是 "..."而不是 "...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58056207/

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