Lokale Definition und Lokale Implementierung wird aber ohne Fehler erzeugt, es geht also wirklich nur um die Testklassen.Das Include mit dem für Testquelltext reservierten Namen "ZCL_ENUM_TEST_004=============CCAU" existiert, wird aber nicht verwendet. Löschen Sie es oder benennen Sie es um.
Code: Alles auswählen.
src_code_generator = NEW #( |ZCL_ENUM_TEST_{ pa_num }| ).
DATA t_attributes TYPE seoo_attributes_r.
DATA t_methods TYPE seoo_methods_r.
DATA t_method_sources TYPE seo_method_source_table.
DATA t_interfaces TYPE seor_implementings_r.
DATA s_class TYPE vseoclass.
s_class = VALUE #(
clsname = |ZCL_ENUM_TEST_{ pa_num }|
descript = |Test class number { pa_num }|
langu = sy-langu
exposure = 2
fixpt = abap_true
state = 1 ). "implemented
t_attributes = VALUE #(
( clsname = s_class-clsname
cmpname = 'DEMO'
descript = 'Demo attribute'
exposure = 2 "public
attdecltyp = 0 "instance
state = 1
) ).
t_methods = VALUE #(
( clsname = s_class-clsname
cmpname = 'DEMO'
descript = 'demo method'
langu = sy-langu
exposure = 2 "public
mtddecltyp = 0 "instance
state = 1
) ).
DATA: src_code_def TYPE rswsourcet,
src_code_imp LIKE src_code_def.
* CLASS DEFINITION :
DATA: wa_vseoclass TYPE vseoclass.
wa_vseoclass-clsname = |ZCL_ENUM_TEST_{ pa_num }|.
wa_vseoclass-state = seoc_state_implemented.
wa_vseoclass-exposure = seoc_exposure_public.
wa_vseoclass-langu = 'EN'.
wa_vseoclass-descript = 'Generated Testclass'. "#EC NOTEXT
wa_vseoclass-clsccincl = abap_true.
wa_vseoclass-unicode = 'X'.
wa_vseoclass-author = sy-uname.
"Create class
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = '$TMP'
version = seoc_version_active
authority_check = seox_true
overwrite = seox_true
suppress_method_generation = seox_false
genflag = seox_true
method_sources = t_method_sources
locals_def = src_code_generator->get_src_code_lcl_types( )
locals_imp = src_code_imp
locals_au = src_code_generator->get_src_code_test_class( )
CHANGING
class = wa_vseoclass
implementings = t_interfaces
attributes = t_attributes
methods = t_methods
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
WRITE: / sy-subrc.
SAP-Doku hat geschrieben: FU SEO_CLASS_CREATE_COMPLETE LOCALS_AU
____________________________________________________
Short Text
Sourcecode for local testclasses
Description
The parameter provides the sourcecode for local testclasses. The
parameter is similar to LOCALS_DEF, LOCALS_IMP, LOCALS_MAC.
Be aware that a class with local testclasses requires in parameter CLAS
that the field WITH_UNIT_TESTS is set to 'X'.