10-10-2011 5:24 PM
Hello community,
to create a new COM object I use the command CREATE OBJECT in ABAP. Is it possible to use an existing COM object on the presentation server? Other programming languages offers the command GET OBJECT to return a reference to an existing object. Is there an equivalent in ABAP?
Thanks for hints and tips.
Cheers
Stefan
10-11-2011 7:59 AM
If you mean using OLE, yes there is such a way in ABAP. Search for term +CREATE OBJECT ole + .
Also nice references how to import various controls from outside SAP [Using .Net Windows Controls in the ABAP Control Framework|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/754] [original link is broken] [original link is broken] [original link is broken] [original link is broken]; and [Using Classic ActiveX Controls in the ABAP Control Framework|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/995] [original link is broken] [original link is broken] [original link is broken] [original link is broken];
Regards
Marcin
10-10-2011 5:48 PM
No there is not. If you are going to write a Z class you can achieve the same functionality by using the Singleton pattern ([http://en.wikipedia.org/wiki/Singleton_pattern]). In ABAP you can achieve more or less like this:
CLASS lcl_test DEFINITION CREATE PROTECTED .
PUBLIC SECTION.
CLASS-METHODS get_instance
RETURNING
value(re_instance) TYPE REF TO lcl_test.
PROTECTED SECTION.
CLASS-DATA: my_instance TYPE REF TO lcl_test.
ENDCLASS. "lcl_test DEFINITION
CLASS lcl_test IMPLEMENTATION.
METHOD get_instance.
IF my_instance IS NOT BOUND.
CREATE OBJECT my_instance.
ENDIF.
re_instance = my_instance.
ENDMETHOD. "get_instance
ENDCLASS. "lcl_test IMPLEMENTATION
10-11-2011 10:05 AM
Hello Arseni,
thanks for your answer and your snippet to simulate GetObject in ABAP.
Cheers
Stefan
10-11-2011 7:59 AM
If you mean using OLE, yes there is such a way in ABAP. Search for term +CREATE OBJECT ole + .
Also nice references how to import various controls from outside SAP [Using .Net Windows Controls in the ABAP Control Framework|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/754] [original link is broken] [original link is broken] [original link is broken] [original link is broken]; and [Using Classic ActiveX Controls in the ABAP Control Framework|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/995] [original link is broken] [original link is broken] [original link is broken] [original link is broken];
Regards
Marcin
09-21-2012 6:07 AM