I'm trying to call a method of a class that implements a custom interface. I receive the class name as a parameter in my method so i have to create the object at runtime.
This is currently my code:
" Call the Interface Method to Get Additional
create object generic_class type (gs_class_name).
if_xxx_gs_mapping ?= generic_class.
call method if_xxx_gs_mapping->map_gs_fields
it_form_values = it_form_values
it_keys = it_keys
it_fields = it_fields
error_mapping_fields = 1
others = 2.
if sy-subrc <> 0.
" Catch - Possible Errors
catch cx_sy_create_object_error .
catch cx_sy_dyn_call_param_missing .
" Class doesnt implement the method
The problem is this code always enter's in the cx_sy_dyn_call_illegal_method.
I have checked the gs_class_name implements the interface and both the class and the method are active.
i have also tried to do this:
create object if_xxx_gs_mappingtype (gs_class_name).
In the method call the exception is the same
What could be the problem?