异常 CX_SY_REF_IS_INITAL [英] Exception CX_SY_REF_IS_INITAL

查看:21
本文介绍了异常 CX_SY_REF_IS_INITAL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从一个类中设置一个方法调用

I'm setting up a Method call from a class

DATA: r_info TYPE REF TO zcl_sv_job_offline_ctrl.


 CALL METHOD r_info->create
    EXPORTING
         is_data   = lr_test_record.

并收到以下错误:

CX_SY_REF_IS_INITAL

You are trying to access a component with a 'ZERO' object reference (points to nothing). Variable: "R_INFO".

我错过了什么吗?

推荐答案

抱歉,我还没有代表发表评论...我注意到你的类是一个 Z 所以我想知道你是否正在尝试创建一个单例类.在这种情况下.您的创建"应该是静态的.您的构造函数是私有的,而您的实例是私有属性.
从其他评论来看,我同意,您的问题缺少一些关键细节,无法提供准确的答案.
如果 IO_DISPATCHER 是构造函数的一部分并且您无法传递值,则需要更深入地了解该类的用途.看看你能不能给它它想要的东西.尝试使用where used"并查看该类的其他用法.您可能会发现自己看错了课程,或者至少是从错误的方向接近.
如果 create 是类上的某个方法,并且它不是静态的,那么在创建类的实例之前,您将永远无法使用它.

想到的另一个想法是,您可能在正确的地方,只是做错了事.检查您的全局变量以查看是否已经存在该类的实例,并且您正试图通过声明为数据而不是使用全局实例来访问某些内容?所有的猜测都没有更多细节.

Sorry, I don't have the rep to comment just yet... I notice that your class is a Z so I'm wondering if you are trying to create a singleton class. In which case. Your 'Create' should be static. Your Constructor private and your Instance in a private attribute.
From the other comments, I agree, your question is missing some key details to provide an accurate answer.
If IO_DISPATCHER is part of the constructor and you are unable to pass a value, you need to dig a little deeper into the purpose of the class. See if you can give it what it wants. Try a 'where used' and check out the other usages of the class. You might find you are looking at the wrong class, or at least approaching from the wrong direction.
If create is some method on the class and it is not static then you will never get it to work until you create an instance of the class.

Another thought that comes to mind is that you might be in the right place and just doing the wrong thing. Check your globals to see if there is already an instance of the class and you are trying to access something via declaration as data rather than using the global instance?? All guess work without more details.

这篇关于异常 CX_SY_REF_IS_INITAL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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