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

Creating global class in runtime

Former Member
0 Likes
610

Hi Gurus,

Is it posible to create a global class in runtime? I have read that it is posible to create a perform in runtime, but i d´ont know if it is posible the creation of a global class in runtime.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
557

Hi,

It is possible, but it is not best practice. You can check how the ABAP workbench does it: go to SE93, enter SE24, check which package it belongs to and then explore that package for suitable function modules.

Regards,

Adam

2 REPLIES 2
Read only

Former Member
0 Likes
558

Hi,

It is possible, but it is not best practice. You can check how the ABAP workbench does it: go to SE93, enter SE24, check which package it belongs to and then explore that package for suitable function modules.

Regards,

Adam

Read only

former_member192854
Active Participant
0 Likes
557

Hi Jaime,

it is possible to create a local class in runtime. The same way you can generate a routine, you can also generate a class.

In the itab1 you push your class definition (texts). In prog you will fetch the generated programname and in mess, the errors.

DATA itab1 TYPE TABLE OF string.

DATA prog TYPE string.


GENERATE SUBROUTINE POOL itab1 NAME prog MESSAGE mess.


And then you can call it by combining the programname and the class name which is defined in you itab1, you can call a method.


CONCATENATE `\PROGRAM=` prog `\CLASS=<yourclassname>` INTO class.


CALL METHOD (class)=>meth

PARAMETER-TABLE

ptab.

Best,

Sander