Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Access via 'NULL' object reference not possible ERROR! Please Help!

Former Member
0 Likes
2,003

Hello All:

1) Here is the code I have to declare object variable and call a method:

DATA: process TYPE REF TO cl_hr_pm_pw_start_manager.

CALL METHOD process->start

EXPORTING

processid = my_pid

  • STEPID =

  • NO_DIALOG_BOXES =

variant = l_variant

  • WAITING =

EXCEPTIONS

error_occurred = 1

OTHERS = 2.

2) I cannot use "CREATE OBJECT" because class instantiation type is "private".

3) I am getting the dump with the error when I execute theabove code:

Access via 'NULL' object reference not possible

4) I did research in this forum and found the articles but none of the solutions are working. I am working with version ECC6.0.

I am new to SAP OO programming but coming from other programming world have concepts of OO programming. I am not sure how to fix this! Could anyone please help?

Mithun.

1 ACCEPTED SOLUTION
Read only

Former Member
803

Thanks Rich. Could you please tell me how to find that class?

Mithun

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
803

Well the problem is that you do not have an object reference for PROCESS. The class in question has been designed not to allow instantiation, so this object must be instanitated by another class and it may not offer access to it directly. This is the basic concepts and foundation of object oriented programming. You must find the class which instaniates this object and maybe, there will be a method to retrieve the object from it.

Regards,

RIch Heilman

Read only

Former Member
804

Thanks Rich. Could you please tell me how to find that class?

Mithun

Read only

0 Likes
803

I think you will like this, it is a private instanation, but simply accessing the static attribute MANAGER will give you the object . check this code. Now MANAGER has all your data.

data: manager type ref to cl_hr_pm_pw_start_manager.

manager = cl_hr_pm_pw_start_manager=>manager.

Regards,

Rich Heilman

Read only

0 Likes
803

So for example, you can do something like this.



data: manager type ref to cl_hr_pm_pw_start_manager.

manager = cl_hr_pm_pw_start_manager=>manager.


CALL METHOD manager->start
EXPORTING
processid = my_pid
* STEPID =
* NO_DIALOG_BOXES =
variant = l_variant
* WAITING =
EXCEPTIONS
error_occurred = 1
OTHERS = 2.

check sy-subrc = 0.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
803

Thanks Rich. I could get past that "NULL" obeject reference error now. I rewarded everyone with points.

Thanks.

Mithun