动态方法调用区分大小写 [英] Dynamic method call is case-sensitive

查看:58
本文介绍了动态方法调用区分大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最小工作示例:

CLASS lcl_some_class DEFINITION. ""// <-- this is obviously lower case
  PUBLIC SECTION.
    CLASS-METHODS some_static_method. ""// <-- this is obviously lower case
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.
CLASS lcl_some_class IMPLEMENTATION.
  METHOD some_static_method.
    " nothing
  ENDMETHOD.
ENDCLASS.
END-OF-SELECTION.

DATA: lc_class_name_upper  TYPE string VALUE 'LCL_SOME_CLASS',
      lc_class_name_lower  TYPE string VALUE 'lcl_some_class',
      lc_method_name_upper TYPE string VALUE 'SOME_STATIC_METHOD',
      lc_method_name_lower TYPE string VALUE 'some_static_method'.

CALL METHOD LCL_SOME_CLASS=>SOME_STATIC_METHOD. ""ok
CALL METHOD (lc_class_name_upper)=>(lc_method_name_upper). ""ok

CALL METHOD lcl_some_class=>SOME_STATIC_METHOD. ""ok
CALL METHOD (lc_class_name_lower)=>(lc_method_name_upper). ""failure

CALL METHOD LCL_SOME_CLASS=>some_static_method. ""ok
CALL METHOD (lc_class_name_upper)=>(lc_method_name_lower). ""failure

CALL METHOD lCl_SoMe_ClAsS=>sOmE_sTaTiC_mEtHoD. ""ok

我希望带有注释"failure"的行出现在行为与上面的相应行完全相同:区分大小写.但是相反,它们失败并显示以下消息之一:

I expected the lines with comment "failure" to behave exactly like the corresponding lines above: To be case-insentive. But instead they fail with one of the following messages:

CX_SY_DYN_CALL_ILLEGAL_CLASS/DYN_CALL_METH_CLASS_NOT_FOUND

CX_SY_DYN_CALL_ILLEGAL_CLASS / DYN_CALL_METH_CLASS_NOT_FOUND

en:在动态方法调用期间找不到该类.

en: The class could not be found during the dynamic method call.

de:Die Klasse beim dynamischen Methodenaufruf konnte nicht gefunden werden.

de: Die Klasse beim dynamischen Methodenaufruf konnte nicht gefunden werden.

CX_SY_DYN_CALL_ILLEGAL_METHOD/DYN_CALL_METH_NOT_FOUND

CX_SY_DYN_CALL_ILLEGAL_METHOD / DYN_CALL_METH_NOT_FOUND

en:在动态调用期间找不到该方法.

en: The method could not be found during the dynamic call.

de:Die Methode konnte beim dynamischen Aufruf nicht gefunden werden.

de: Die Methode konnte beim dynamischen Aufruf nicht gefunden werden.

是否有办法使动态呼叫大小写敏感( )(明显的将字符串转换为大写字母除外)?

Is there a way to make the dynamic call case-insensitive (except for the obvious converting the strings to upper case)?

推荐答案

class_name期望一个类似字符的字段,该字段必须在执行语句时以大写字母包含类的名称

class_name expects a character-like field that must contain the name of a class in uppercase letters when the statement is executed

我看不到任何解决方案可以使内核将名称本身转换为大写.

I don't see any solution to make the kernel convert the name to upper case itself.

NB:我不明白为什么在进行动态调用之前将自己的名字转换为大写是一个问题.

NB: I don't see why it is a problem to convert yourself the name to upper case before doing the dynamic call.

这篇关于动态方法调用区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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