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

Class execution problem

Former Member
0 Likes
975

HI,

when i execute this method i am getting error.

this code is in BADI....

data ts_attributes type CGPL_TS_ENTITY.

data my_class type ref to cl_cgpl_entity.

CALL METHOD MY_CLASS->GET_ATTRIBUTES

RECEIVING

RS_ATTRIBUTES = TS_ATTRIBUTES

.

i am getting <b>Access via 'NULL' object reference not possible</b> error.

Regards

Giri

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
935

Hi,

Try this


data ts_attributes type CGPL_TS_ENTITY.

data my_class type ref to cl_cgpl_entity.

my_class = cl_cgpl_entity=>my_class.     " <<

CALL METHOD MY_CLASS->GET_ATTRIBUTES
RECEIVING
RS_ATTRIBUTES = TS_ATTRIBUTES

aRs

Points are always welcome

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
935

Hi, you need an instance of the class first.

data ts_attributes type CGPL_TS_ENTITY.

data my_class type ref to cl_cgpl_entity.

create object my_class.    "<--- INSERT THIS HERE

CALL METHOD MY_CLASS->GET_ATTRIBUTES
RECEIVING
RS_ATTRIBUTES = TS_ATTRIBUTES

Regards,

RIch Heilman

Read only

0 Likes
935

HI Rich,

Error is : <b>Obligatory Parameter IS_ATTRIBUTES had no vlaue assigned to it.</b>

then i provided...

data ts_attributes type CGPL_TS_ENTITY.

data tr_native_object type ref to CL_CGPL_HIERARCHY_NODE.

data my_class type ref to cl_cgpl_entity.

CREATE OBJECT MY_CLASS.

EXPORTING

IS_ATTRIBUTES = ts_attributes

  • IV_ORIGIN_GUID =

  • IV_CREATE_NEW = SPACE

  • IV_UNIQUE_CHECK = CGPLC_CON_UNKNOWN

IR_NATIVE_OBJECT = tr_native_object

.

I got the error: <b>Exception condition "INVALID_APPLICATION" raised.</b>

Regards

Giri

Read only

0 Likes
935
CREATE OBJECT MY_CLASS.    "<---- Get Rid of the period here
EXPORTING

Regards,

RIch Heilman

Read only

0 Likes
935

Error is same rich...

  • The following error text was processed in the system : Exception condition "INVALID_APPLICATION" raised.

  • The error occurred on the application server and in the work process 0 .

  • The termination type was: RABAX_STATE

  • The ABAP call stack was:

Method: CONSTRUCTOR of program CL_CGPL_OBJECT_MANAGER========CP

Method: CONSTRUCTOR of program CL_CGPL_ENTITIES==============CP

Method: GET_INSTANCE of program CL_CGPL_ENTITIES==============CP

Method: CONSTRUCTOR of program CL_CGPL_ENTITY================CP

Method: IF_EX_DPR_EVENTS~ON_EVENT of program ZCL_IM_DPR_EVENTS=============CP

Method: IF_EX_DPR_EVENTS~ON_EVENT of program CL_EX_DPR_EVENTS==============CP

Method: EVENTS_ON_EVENT of program CL_DPR_BADI_SERVICES==========CP

Method: ON_DPO_RELEASED of program CL_DPR_EVENT_OBSERVER=========CP

Method: RESET_CANCELLED of program CL_DPR_PROJECT_O==============CP

Method: IF_DPR_STATUS_ELEMENT~EXECUTE_ACTIVITY of program CL_DPR_PROJECT_O==============CP

Regards

Giri

Read only

0 Likes
935

I do not have this class in my system, so it would be hurt for me to tell what the problem is, to stop the dump, you would need to handle that exception in the call.

Create object my_class
   exporting
        ......
        ....
   exceptions
          INVALID_APPLICATION = 1.

Still you would need to find the reason for this exception being raised.

Regards,

Rich Heilman

Read only

0 Likes
935

HI Rich,

I provide you some more information, this might give you some idea.

BADI...

it has Interface I_SENDER as importing method.

In this Interface, there are some classes and methods in classes from which i want to get some data in my tables.

I have no idea how to call interface in program. and access methods in classes. Is it possible?

Can you provide me some idea?

Regards

Giri

Read only

former_member194669
Active Contributor
0 Likes
936

Hi,

Try this


data ts_attributes type CGPL_TS_ENTITY.

data my_class type ref to cl_cgpl_entity.

my_class = cl_cgpl_entity=>my_class.     " <<

CALL METHOD MY_CLASS->GET_ATTRIBUTES
RECEIVING
RS_ATTRIBUTES = TS_ATTRIBUTES

aRs

Points are always welcome

Read only

0 Likes
935

HI aRs,

It is saying Field MY_Class is unknown.

Regards

GIRI