当前 CLASS POOL 中 PUBLIC 类的名称必须是“...";不是“……" [英] The name of the PUBLIC class in the current CLASS POOL must be "..." not "..."

查看:36
本文介绍了当前 CLASS POOL 中 PUBLIC 类的名称必须是“...";不是“……"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过单击事务 se24 中的本地定义/实现"在全局类 (Z_MY_GLOBAL_CLASS) 中创建本地类 (Z_MY_LOCAL_CLASS).

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-POOL muß "Z_MY_GLOBAL_CLASS" statt "Z_MY_LOCAL_CLASS" lauten.

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆