09-22-2008 7:23 AM
Hi all,
I want to create a instance for a class inside the program, but i know class name dynamically that reside inside a table.
select Classname from <table name> into <classname>.
create object <classname>->variable that got form select query.
we have any alternative solution for this.
Reg,
Hariharan
09-22-2008 7:37 AM
Hi,
Check this link:
https://forums.sdn.sap.com/click.jspa?searchID=16551174&messageID=4418016
Regards,
Shiva Kumar
09-22-2008 8:25 AM
Hi,
You can create object of a class at run time by
CREATE OBJECT lref_obj TYPE (lv_class_name).
This tutorial might help : [Dynamic Programming|http://www.abaplearning.com/abap-tutorials/dynamic-programming]
Regards,
Varun.
09-22-2008 8:38 AM
Hi Hariharan,
Please check this Blog By Horst Keller
[Dynamic ABAP Objects|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1944] [original link is broken] [original link is broken] [original link is broken];
Hope this would solve your issue.
Good luck
Narin
09-24-2008 9:33 AM
hi guys,
what ever you guys told is correct but in the create object the instance name of which type.
CREATE OBJECT L_INST_ASY_CALL
TYPE
(LV_CONTROL).
data: L_INST_ASY_CALL type <?>.
reg,
hari
09-24-2008 10:17 AM
Hi Hariharan,
DATA:
L_INST_ASY_CALL TYPE REF TO OBJECT.
As the type of L_INST_ASY_CALL is known in runtime so declare it as of type OBJECT.
Hope this would help you.
Good luck
Narin