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 with method cl_os_system=>get_class_agent

Former Member
0 Likes
553

hey everybody,

maybe this is a silly question (I apologize in advance), but I'm just wondering about method get_class_agent.

Why doesn't it work like this?

DATA lo_gp_agent TYPE REF TO ZCL_SAMPLE1.

lo_agent ?= cl_os_system=>get_class_agent( 'ZCL_SAMPLE1' ).

If i declare a variable of type seoclskey and put the name of the variable into brackets it will work:

DATA: lo_gp_agent TYPE REF TO ZCL_SAMPLE1,
                      lv_clsname TYPE seoclskey. 

lo_agent ?= cl_os_system=>get_class_agent( lv_clsname ).

I don't think this is very comfortable.. whenever I want to reference to another class agent I have to set lv_clsname?!

Does anybody have an idea why the first coding doesn't work?!

Thx. Anne

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
513

It is because SEOCLSKEY is the structure, not a Data Element. If it could be data element you can directly use the Class name in the I_CLASS_NAME. I guess, we don't have any other option other than taking the helper variable (LV_CLS_NAME type SEOCLSKEY) for the Class Name.

Regards,

Naimesh Patel

hey everybody,

maybe this is a silly question (I apologize in advance), but I'm just wondering about method get_class_agent.

Why doesn't it work like this?

DATA lo_gp_agent TYPE REF TO ZCL_SAMPLE1.

lo_agent ?= cl_os_system=>get_class_agent( 'ZCL_SAMPLE1' ).

If i declare a variable of type seoclskey and put the name of the variable into brackets it will work:

DATA: lo_gp_agent TYPE REF TO ZCL_SAMPLE1,
                      lv_clsname TYPE seoclskey. 

lo_agent ?= cl_os_system=>get_class_agent( lv_clsname ).

I don't think this is very comfortable.. whenever I want to reference to another class agent I have to set lv_clsname?!

Does anybody have an idea why the first coding doesn't work?!

Thx. Anne

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
514

It is because SEOCLSKEY is the structure, not a Data Element. If it could be data element you can directly use the Class name in the I_CLASS_NAME. I guess, we don't have any other option other than taking the helper variable (LV_CLS_NAME type SEOCLSKEY) for the Class Name.

Regards,

Naimesh Patel

Read only

0 Likes
513

aahh.. stupid.. I just overlooked this information when looking up SEOCLSKEY in se11..

Thx. Problem solved!