‎2018 Dec 17 4:55 AM
PROGRAM ZNB_CLASS_MOD_POO_IMP.
DATA LV_MESSAGE TYPE BAPIRET2.
DATA OBJ TYPE REF TO ZCL_NB_CLASS.
DATA TRANS_BALANCE TYPE DMBTR.
DATA BAL TYPE DMBTR.
DATA BALANCE_LEFT TYPE DMBTR.
DATA ok_code TYPE sy-ucomm.
DATA LT_MESSAGE TYPE TABLE OF BAPIRET2.
START-OF-SELECTION.
CREATE OBJECT OBJ ."TYPE ZCL_NB_CLASS.
INCLUDE ZNB_CLASS_MOD_POO_IMP_STATUO01.
INCLUDE ZNB_CLASS_MOD_PAI.
Hi Everyone,
I am getting the null object reference error while I have to declare the object globally. Please help,
I my class code would be required, I will post that.
‎2018 Dec 17 11:42 AM
In the PAI you've got a bit of code like OBJ->DO_PAI( ). But at this point, OBJ is not instantiated. The solution depends on what you are trying to achieve, and the structure of your program.
OBJ is a terrible name for an object reference.
ZCL_NB_CLASS is a terrible name for a class.
‎2018 Dec 17 5:50 AM
Hi Nitish,
I think, You are calling corresponding methods of your class ZCL_NB_CLASS without any instance. Kindly check in debugging wheather object has been instantiated ( OBJ ) when calling methods.
‎2018 Dec 17 8:18 AM
Thank-you for properly formatting your program code. Much easier to read.
At what line are you getting the dump? Is it in the code you've posted, or is it in one of the includes?
‎2018 Dec 17 8:51 AM
‎2018 Dec 17 10:22 AM
Hi Mathew,
I am getting the error in the includes, ie., the place at which I am calling the method
in PAI.
‎2018 Dec 17 11:42 AM
In the PAI you've got a bit of code like OBJ->DO_PAI( ). But at this point, OBJ is not instantiated. The solution depends on what you are trying to achieve, and the structure of your program.
OBJ is a terrible name for an object reference.
ZCL_NB_CLASS is a terrible name for a class.
‎2018 Dec 17 3:00 PM
Yeah, you are right. I was just practicing, that's why I did that.
‎2018 Dec 17 3:02 PM
I just want to know, where should I declare the object globally for multiple screens?
‎2018 Dec 17 6:19 PM
I can't tell you as... "The solution depends on what you are trying to achieve, and the structure of your program."
‎2018 Dec 17 4:10 PM