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

How to access a class instance variable from ABAP Callstack.

Former Member
0 Likes
5,129

Hi All,

I need to access a varable in one of the method in ABAP stack

Event Type_____Event____________________________Program

METHOD______IF_EX_ME_GUI_PO_CUST~EXECUTE__ZCL_IM_PTP_PO_CUSTM_FLDS======CP --> I am here

METHOD______IF_EX_ME_GUI_PO_CUST~EXECUTE__CL_EX_ME_GUI_PO_CUST==========CP

METHOD______EXECUTE________________________SAPLMEGUI

METHOD______EXECUTE________________________CL_COMPOSITE_SCREEN_VIEW_MM===CP --> need to access here

I tried to access using the below code

DATA: LV type string.
FIELD-SYMBOLS: <FS> TYPE ANY.

LV = '(CL_COMPOSITE_SCREEN_VIEW_MM===CP)WA-VIEW'.
ASSIGN (LV) TO <FS>.

But the field symbol is unassigned. Is there any other way to access the variable.

Regards,

Vipin

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,367

Hello,

I don't think you'll be able to access the class directly! This will impact the encapsulation design of OOPs, you'll be able to access the PRIVATE & PROTECTED attributes of that class!

You should try to access the Object Reference variable defined in the program. Suppose you've an obj. ref. variable defined like this:

DATA: OBJ_REF TYPE REF TO CL_SOMECLASS.

You can try to access the variable OBJ_REF from the call stack:

FIELD-SYMBOLS: <OBJ> TYPE OBJECT.
ASSIGN ('OBJ_REF') TO <OBJ>.

Hope i'm clear.

BR,

Suhas

1 REPLY 1
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,368

Hello,

I don't think you'll be able to access the class directly! This will impact the encapsulation design of OOPs, you'll be able to access the PRIVATE & PROTECTED attributes of that class!

You should try to access the Object Reference variable defined in the program. Suppose you've an obj. ref. variable defined like this:

DATA: OBJ_REF TYPE REF TO CL_SOMECLASS.

You can try to access the variable OBJ_REF from the call stack:

FIELD-SYMBOLS: <OBJ> TYPE OBJECT.
ASSIGN ('OBJ_REF') TO <OBJ>.

Hope i'm clear.

BR,

Suhas