当前CLASS POOL中的PUBLIC类的名称必须为“ ...”。不是“ ...” [英] The name of the PUBLIC class in the current CLASS POOL must be "..." not "..."
问题描述
我正在尝试通过单击创建全局类( Z_MY_GLOBAL_CLASS
)内的本地类( Z_MY_LOCAL_CLASS
)事务 se24
中的本地定义/实现。
I'm trying to create a local class (Z_MY_LOCAL_CLASS
) inside a global class (Z_MY_GLOBAL_CLASS
) by clicking "Local Definitions/Implementations" in transaction se24
.
然后,将另一个类的源代码从其基于源代码的视图复制到单击本地定义后显示的文本区域中按钮。
Afterwards I copied the source code of another class from its source code-based view into the text area that showed up after I clicked the "local definitions" button.
*"* 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.
尝试激活编码时,我收到以下消息:
When trying to activate the coding I get the following message:
当前CLASS POOL中PUBLIC类的名称必须为 Z_MY_GLOBAL_CLASS,而不是 Z_MY_LOCAL_CLASS。
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-POOLmuß Z_MY_GLOBAL_CLASS
Der Name der PUBLIC-Klasse im aktuellen CLASS-POOL muß "Z_MY_GLOBAL_CLASS" statt "Z_MY_LOCAL_CLASS" lauten.
这是什么意思?
推荐答案
在SAP / ABAP中,错误消息通常不会描述实际错误。在本地类的定义中,更改以下行
As often within SAP/ABAP the error message does not describe the actual error. In the definition of your local class change these lines
class Z_MY_LOCAL_CLASS definition
public
final
create public .
为此
class Z_MY_LOCAL_CLASS definition final create public.
它应该编译。因此,问题在于仅允许全局类包含 public
。将源代码从现有的全局类复制/迁移到本地类时,必须删除这些行。
and it should compile. So the problem is that only global classes are allowed to contain public
. When copying/migrating source code from existing global classes to local classes you have to remove those lines.
这篇关于当前CLASS POOL中的PUBLIC类的名称必须为“ ...”。不是“ ...”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!