Announcement:
wanna exchange links? contact me at sapchatroom@gmail.com.
Posted by
Admin at
Hi! Why I can't create an object of class cl_airplane in the following code?
TYPE-POOLS abap. DATA: class TYPE string VALUE 'cl_airplane', r_class TYPE REF TO object, r_1 TYPE REF TO cl_airplane exc_ref TYPE REF TO cx_root, exc_text TYPE string, ptab TYPE abap_parmbind_tab, ptab_line TYPE abap_parmbind. ptab_line-name = 'IM_NAME'. ptab_line-kind = cl_abap_objectdescr=>exporting. GET REFERENCE OF 'hhh' INTO ptab_line-value. INSERT ptab_line INTO TABLE ptab. ptab_line-name = 'IM_PLANETYPE'. ptab_line-kind = cl_abap_objectdescr=>exporting. GET REFERENCE OF 'ggg' INTO ptab_line-value. INSERT ptab_line INTO TABLE ptab. TRY. CREATE OBJECT r_class TYPE (class) PARAMETER-TABLE ptab. CATCH cx_sy_create_object_error INTO exc_ref. exc_text = exc_ref->get_text( ). MESSAGE exc_text TYPE 'I'. ENDTRY. CREATE OBJECT r_1 EXPORTING im_name = 'hhh' im_planetype = 'ggg'. An error is returned: "The object could not be created: The class cl_airplane does not exist." However, at the next line an object r_1 of the same type, but explicitly defined, is successfully created. | __.____._ Copyright © 2011 Toolbox.com and message author. Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251 | | Popular White Papers In the Spotlight SAP BusinessObjects: Dashboards and Analytics. Learn more about this Toobox.com Marketplace online course. _.____.__ |