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

Problem while using a methid or class in ABAP code.

Former Member
0 Likes
1,382

Hi,

I want to fetch the personalization data for a user from SU01. I guess there is method called get_data of class CL_PERS_ADMIN which I can use to fetch the data. How can I use this in my custom program.

I directly used like this:

LOOP at I_KEYROLEUSERS.

call method CL_PERS_ADMIN->GET_OBJECT

exporting

p_pers_key = 'LAW_PERS'

p_uname = I_KEYROLEUSERS-UNAME

  • p_rfc = p_rfc

receiving

p_object = p_object

exceptions

default_not_set = 1

internal_error = 2

user_does_not_exist = 3

pers_key_not_found = 4

rfc_connection_failed = 5

others = 6.

ENDLOOP.

But I get an error saying "Field CL_PERS_ADMIN->GET_OBJECT" is unknown. It is niether one of specified table nor defined by 'DATA' statement.

Regards,

Rajesh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
728

Hello Rajesh Thomas,

You need to create a reference variable for the class that you are trying make use a method. and call the method using the variabe like this :

eg:

DATA: lr_typedesc TYPE REF TO CL_PERS_ADMIN.

lr_typedesc->GET_OBJECT

Hope this helps.

Thanks,

Greetson

4 REPLIES 4
Read only

Former Member
0 Likes
729

Hello Rajesh Thomas,

You need to create a reference variable for the class that you are trying make use a method. and call the method using the variabe like this :

eg:

DATA: lr_typedesc TYPE REF TO CL_PERS_ADMIN.

lr_typedesc->GET_OBJECT

Hope this helps.

Thanks,

Greetson

Read only

Former Member
0 Likes
728

Did you create object reference as follows:

DATA: object_ref type ref CL_PERS_ADMIN.

START-OF-SELECTION.

CREATE OBJECT object_ref.

Thanks,

SKJ

Read only

Former Member
0 Likes
728

Data: lcl_pers_adm TYPE REF TO CL_PERS_ADMIN.

CREAT OBJECT lcl_pers_adm.

LOOP at I_KEYROLEUSERS.

call method lcl_pers_adm->GET_OBJECT

exporting

p_pers_key = 'LAW_PERS'

p_uname = I_KEYROLEUSERS-UNAME

p_rfc = p_rfc

receiving

p_object = p_object

exceptions

default_not_set = 1

internal_error = 2

user_does_not_exist = 3

pers_key_not_found = 4

rfc_connection_failed = 5

others = 6.

ENDLOOP.

Try with the above code.

<removed_by_moderator>

Regards,

Kiran Bobbala

Edited by: Julius Bussche on Jun 23, 2008 10:55 PM

Read only

Former Member
0 Likes
728

Hi,

Try to use like this :

LOOP at I_KEYROLEUSERS.

call method CL_PERS_ADMIN=>GET_OBJECT

exporting

p_pers_key = 'LAW_PERS'

p_uname = I_KEYROLEUSERS-UNAME

p_rfc = p_rfc

receiving

p_object = p_object

exceptions

default_not_set = 1

internal_error = 2

user_does_not_exist = 3

pers_key_not_found = 4

rfc_connection_failed = 5

others = 6.

ENDLOOP.

Thanks,

Greetson