02-16-2014 6:19 PM
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.
02-16-2014 9:48 PM
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
02-16-2014 9:48 PM
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
02-16-2014 9:53 PM
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