‎2007 Mar 01 12:36 PM
Hi,
I am getting the following dump: Access via 'NULL' object reference not possible..
I am not an expert in BADI implementation, and it is my first time using that.
Can you please see if i am doing something wrong in this code:
BADI: CRM_MKTPL
method IF_EX_CRM_MKTPL~SET_ATTRIBUTES.
data: cm_stsma type J_STSMA.
data : cm_guid type CGPL_GUID16.
DATA: object TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
break-point.
call method im_project->get_guid
importing
EX_GUID = cm_guid.
cm_stsma = 'ZCRMCAMP'.
call method object->STATUS_PROFILE_CHANGE
exporting
im_guid = cm_guid
im_stsma = cm_stsma.
endmethod.
‎2007 Mar 01 12:38 PM
The dump is not due to BADI it is for Object Oriented Programming.
you are calling a class with empty value.Check it.
Regards,
Amit
‎2007 Mar 01 12:39 PM
Hello,
Put a CREATE OBJECT Object before trying to call the first method of 'Object'.
Regards,
john.
‎2007 Mar 01 12:41 PM
Hi,
The arror in your prog.
call method im_project->get_guid
U have create a object im_project with refrence to existing one.
‎2007 Mar 01 12:42 PM
Hi,
The object name is wrong im_project) It is just Object.
BADI: CRM_MKTPL
method IF_EX_CRM_MKTPL~SET_ATTRIBUTES.
data: cm_stsma type J_STSMA.
data : cm_guid type CGPL_GUID16.
DATA: object TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
break-point.
call method <b>Object</b>->get_guid
importing
EX_GUID = cm_guid.
cm_stsma = 'ZCRMCAMP'.
call method object->STATUS_PROFILE_CHANGE
exporting
im_guid = cm_guid
im_stsma = cm_stsma.
endmethod.
Check now.
Regards,
Anji
‎2007 Mar 01 12:42 PM
hi,
you have declared the object in statement, but not created the instance of it.
DATA: ob TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
use the "create object ob" to create the object instance without which it is giving 'NULL' object reference not possible.
Hope this helps.
Regards,
Richa
‎2007 Mar 01 12:42 PM
Ok, thanks.
But i am putting:
DATA: ob TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
create object ob.
And i can't activate because:
"You cannot create an instance of the class CL_CGPL_STATUS_MANAGEMENT outside the class...
Please help...
Message was edited by:
yukimai maio
Message was edited by:
yukimai maio
‎2007 Mar 01 1:34 PM
‎2007 Mar 01 1:38 PM
Hi,
The error means the class is a singleton and can only be instantiated from within the class. Look for a method in the class to a reference (e.g. GET_REFERENCE).
Regards,
John.
‎2007 Mar 01 1:38 PM
Hi,
You have not created object in the program, so, it is giving short dump.
Create Object... is missing
if object is bound. " checking reference exists
call method object->STATUS_PROFILE_CHANGE
exporting
im_guid = cm_guid
im_stsma = cm_stsma.
endif.Regards
Bhupal Reddy
‎2007 Mar 01 1:55 PM
In class: CL_CGPL_STATUS_MANAGEMENT i don't have any GET_REFERENCE....
Is there any way to do that?
‎2007 Mar 01 1:58 PM
Hi Yukimai,
I Haven't any CRM system available to take a look. You should look for a method which returns a reference to the class itself.
Regards,
John.
‎2007 Mar 01 4:00 PM
hi,
call the method STATUS_OBJECT_CREATE. this method is to create the instance.
data: i_CGPL_GUID16 type CGPL_GUID16.
data : i_CRM_J_OBTYP type CRM_J_OBTYP.
DATA: ob TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
call method ob->STATUS_OBJECT_CREATE
exporting IM_GUID = i_CGPL_GUID16
IM_STATUS_OBJECT = i_CRM_J_OBTYP.
Hope this helps.
Regards,
Richa
‎2007 Mar 02 11:15 AM
Now i have this:
method IF_EX_CRM_MKTPL~SET_ATTRIBUTES.
data: cm_stsma type J_STSMA.
data : cm_guid type CGPL_GUID16.
DATA: ob TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
data: i_CGPL_GUID16 type CGPL_GUID16.
data : i_CRM_J_OBTYP type CRM_J_OBTYP.
call method ob->STATUS_OBJECT_CREATE
exporting IM_GUID = i_CGPL_GUID16
IM_STATUS_OBJECT = i_CRM_J_OBTYP.
call method im_project->get_guid
importing
EX_GUID = cm_guid.
cm_stsma = 'ZCRMCAMP'.
call method ob->STATUS_PROFILE_CHANGE
exporting
im_guid = cm_guid
im_stsma = cm_stsma.
When i try to put CREATE OBJECT ob, and when i try to activate always i get the same: "you cannot create an instance of the class CL_CGPL_STATUS_MANAGEMENT outside the class.
Thanks
endmethod.
‎2007 Mar 02 12:51 PM
hi Yukimai,
if you class builder(se24) and check the properties of class CL_CGPL_STATUS_MANAGEMENT, you will find the instantiation is given as private. All the classes that have instantiation as private cannot be created via create object statment, so you are getting the message ' "you cannot create an instance of the class CL_CGPL_STATUS_MANAGEMENT outside the class.
'.
These class have a method that is used to create a class. In this case it is STATUS_OBJECT_CREATE. You have to use this method only to create any instance of the class.
Hope this explaination helps.
Regards,
Richa.
‎2007 Mar 05 2:56 PM
Hi,
In my example how i can call the method call method STATUS_OBJECT_CREATE, because calling like this:
call method ob->STATUS_OBJECT_CREATE
exporting IM_GUID = i_CGPL_GUID16
IM_STATUS_OBJECT = i_CRM_J_OBTYP.
I get the same dump error.
Thanks in advance.
method IF_EX_CRM_MKTPL~SET_ATTRIBUTES.
data: cm_stsma type J_STSMA.
data : cm_guid type CGPL_GUID16.
data: i_CGPL_GUID16 type CGPL_GUID16.
data : i_CRM_J_OBTYP type CRM_J_OBTYP.
DATA: ob TYPE REF TO CL_CGPL_STATUS_MANAGEMENT .
call method ob->STATUS_OBJECT_CREATE
exporting IM_GUID = i_CGPL_GUID16
IM_STATUS_OBJECT = i_CRM_J_OBTYP.
call method im_project->get_guid
importing
EX_GUID = cm_guid.
cm_stsma = 'ZCRMCAMP'.
call method ob->STATUS_PROFILE_CHANGE
exporting
im_guid = cm_guid
im_stsma = cm_stsma.
endmethod.