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

Meta class equivalent?

Former Member
0 Likes
409

Hi there,

Is there a meta-class equivalent in ABAP Objects?

I know I can execute methods (static or otherwise) dynamically if I know the names involved (names of class/object, method, parameters, etc).

But if I don't know all names, how can I find them dynamically? For instance, if I know static method "CREATE_CAKE" from class "CL_CAKE_FACTORY", can I know at run time which parameters I can use (if any)?

Best Regards,

Paulo

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
374

Hello Paulo

The way how to dynamically execute CALL METHOD is described in the ABAP keywords help.


CALL METHOD (meth_name) 

Syntax 
CALL METHOD dynamic_meth { parameter_list 
                         | parameter_tables }. 

Effect 
This statement calls the method dynamically specified in dynamic_meth.
Actual parameters are assigned to formal parameters without parentheses,
either statically using parameter_list or dynamically using parameter_tables.
The syntax of parameter_list is the same as that for the static method call. 
...

In order to get the signature of methods you can use class CL_OO_CLASS.

Regards

Uwe

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
375

Hello Paulo

The way how to dynamically execute CALL METHOD is described in the ABAP keywords help.


CALL METHOD (meth_name) 

Syntax 
CALL METHOD dynamic_meth { parameter_list 
                         | parameter_tables }. 

Effect 
This statement calls the method dynamically specified in dynamic_meth.
Actual parameters are assigned to formal parameters without parentheses,
either statically using parameter_list or dynamically using parameter_tables.
The syntax of parameter_list is the same as that for the static method call. 
...

In order to get the signature of methods you can use class CL_OO_CLASS.

Regards

Uwe

Read only

Former Member
0 Likes
374

Hi there,

CL_OO_CLASS was just what I was looking for.

Thanks,

Paulo