Application Development 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: 

Class structure

Former Member
0 Kudos
206

HI,

I am implementing a BADI, in that method i can see a Attribute in debugging <b>Object: Reference:-MR_ENTITY</b>

In this i have another attribute MS_ATTRIBUTES as structure assigned to it.

the structure i can see in debugging is <b>-MS_ATTRIBUTES</b>

How can i programatically get this structure in my itab?

Regards

GIRI

4 REPLIES 4

uwe_schieferstein
Active Contributor
0 Kudos
112

Hello Giri

If you are asking about a BAdI it would be quite useful to know the BAdI name.

However, you have a reference to class CL_DPR_PROJECT_O. Its attribute MR_ENTITY (of type CL_CGPL_ENTITY) is <i>protected </i>and, thus, not directly accessible.

Thus, you have to search for a method that allows you to retrieve this protected attribute. A good candidate appears to be the following method (of class CL_DPR_PROJECT_O):

" Assumption: o_project should be your reference to CL_DPR_PROJECT_O.
"                    Here it would be quite useful to have the BAdI's name.

DATA:
  lo_object     TYPE REF TO object,
  lo_common TYPE REF TO if_dpr_common,
  lo_project    TYPE REF TO cl_cgpl_entity.

  lo_object = o_project->IF_DPR_COMMON~GET_NATIVE_OBJECT( ).
  lo_project ?= lo_object.  " casting

" Alternatively, you could use this coding:
  lo_project ?=  o_project->IF_DPR_COMMON~GET_NATIVE_OBJECT( ).  " Or:

  lo_common ?= o_project.  " casting to interface type
  lo_project    ?= lo_common->GET_NATIVE_OBJECT( ).

Assuming that you have know the protected instance attribute MR_ENTITY (CL_CGPL_ENTITY) available you can directly access attribute MS_ATTRIBUTES because it is <i>public </i>(& read-only).

DATA:
  ls_attributes    TYPE cgpl_ts_entity.

  ls_attributes = lo_project->ms_attributes.

Regards

Uwe

0 Kudos
112

HI Uwe,

Thanks for reply,

BADI name is DPR_EVENTS

and the filter i am using is ON_DPO_RELEASED.

lo_object = o_project->IF_DPR_COMMON~GET_NATIVE_OBJECT( ).

what should be on o_project? pls help me out on this

I did not work before on classes... so any help would be useful and i award points once the problem is solved.

UWE: can you help me out regarding this?

Regards

Giri

Message was edited by:

Giri K

0 Kudos
112

Hi Giri,

Generally, you may take a look the example implemenation of the BADI DPR_EVENTS, it is the CL_EXM_IM_DPR_EVENTS. If you can not access it, I can copy the codes and post here.

For your case, if you would like to get the parameters of the project definition,

you can use the method GET_DATA_EXT of the class CL_DPR_PROJECT_O.

You should have most possible attributes of the project defintion using the method.

Kind regards,

Zhenbo

0 Kudos
112

HI Wang,

Can you provide a sample code how to get data from method GET_DATA_EXT. I have no experience in ABAP OOPS.

Thanx again

Regards

Giri