‎2008 Aug 10 4:42 PM
Hello Everyone,
I hope someone could answer the following questions:
Please look at the below ABAP code
data: zVar(30) type c value 'ZTEST_CLASS',
methodName(30) type c value 'Test_Method'.
Question # 1: Can I define the objVar as below or is there anyother way to accomplish this?
data: objVar TYPE REF TO zVar. (Please note that zVar is the variable that contains the name of the
class)
Question # 2: Can I create the object objVar from the above question as below?
CREATE OBJECT objVar.
Question # 3: Can I call the method of objVar as below
CALL METHOD objVar->Test_Method (please note that test method is a variable that contains the name
of the actual method)
Thanks in advance.
Regards
‎2008 Aug 10 4:57 PM
All these Can be done using Dynamic programming.
check this
REPORT ZTEST_CLASS.
data: zVar(30) type c value 'ZCL_TEST1', "<--class name
methodName(30) type c value 'TEST'. "<----Method name
data: obj type ref to object.
create object obj TYPE (zvar) .
call method obj->(methodname).
break-point.
‎2008 Aug 10 4:57 PM
All these Can be done using Dynamic programming.
check this
REPORT ZTEST_CLASS.
data: zVar(30) type c value 'ZCL_TEST1', "<--class name
methodName(30) type c value 'TEST'. "<----Method name
data: obj type ref to object.
create object obj TYPE (zvar) .
call method obj->(methodname).
break-point.
‎2008 Aug 10 5:13 PM