2006 Oct 19 2:04 PM
Hi all,
Does anyone know a function module or a class with which I can generate a global class implementing a predefined global interface and fill the methods of the generated class dynamically with coding?
Thanks in advance.
Sükrü
2006 Oct 19 2:12 PM
HI,
Global internal table can be declared which can accessed by other classes based on the access specifier (public,private,protected)
Step-1 Create table type(ZTABLETYPE) in SE11 which refres to the table (ZTABLE)
Step-2 in SE24, in attribute column keep itab and in assiciated type keep ZTABLETYPE
That's a way of global declaration for internal table in Global Class(SE24).
REGARDS
WARUN
2006 Oct 19 2:17 PM
There is not a function module or class for this. I'm not sure how this will help you in your requirement anyway, because if it is to run in a productive system, which should not be open for changes, your program would not be allowed to create the global class anyway. Unfortunatly, I think your best way to proceed would be to use a generated subroutine, yes not as elegant, but I think this is the way to go.
Regards,
Rich Heilman
2006 Oct 19 2:22 PM
Hi Rich,
I want to generate classes in a development system. And I do not want to generate classes on the fly during program run. I want to write a report which reads some certain meta data from the database, and based on this generates a class with a specific method(which is a method of a global interface) and then I want to put coding into this method dynamically. And as SE24 definitely uses some APIs to generate classes, it must be possible, I guess.
Regards,
Sükrü
2006 Oct 19 2:25 PM
I found the class for generating a class :
SEO_CLASS_CREATE_COMPLETE
2007 May 08 9:15 AM
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
corrnr = korrnum
devclass = devclass
version = seoc_version_active
overwrite = overwrite
IMPORTING
korrnr = korrnum
CHANGING
class = gs_class
inheritance = gs_inheritance
redefinitions = gt_redefinitions
implementings = gt_implementings
impl_details = gt_impl_details
attributes = gt_attributes
methods = gt_methods
events = gt_events
types = gt_types
type_source = gt_type_source
PARAMETERS = gt_parameters
exceps = gt_exceps
aliases = gt_aliases
typepusages = gt_typepusages
clsdeferrds = gt_clsdeferrds
intdeferrds = gt_intdeferrds
friendships = gt_friendships
EXCEPTIONS
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE 'Error generating class' TYPE 'E'.
ENDIF.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Generating local class definitions'.
CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS'
EXPORTING
clskey = clskey
force = seox_true
corrnr = korrnum
implementation = gt_locals_src
locals_def = gt_locals_def
locals_imp = gt_locals_imp
locals_mac = gt_locals_mac
EXCEPTIONS
OTHERS = 5.