Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Stefan-Schnell
Active Contributor
4,796


A long time ago Thomas Jung published his very good blog about "Using Classic ActiveX Controls in the ABAP Control Framework" here.

I asked myself, is there an easier way to realize a connectivity between an ActiveX control and an ABAP program, e.g. for prototyping.

Here now my result: I use a selection screen with a docking container, and the docking container is linked to the ActiveX control. That's all :smile:

 

At first the program:


"-Begin-----------------------------------------------------------------
Program Z_TEST.

"-Variables---------------------------------------------------------
Data Ref_Dock Type Ref To CL_GUI_DOCKING_CONTAINER.
Data Ref_Media Type Ref To Z_CL_MEDIA.

"-GUI---------------------------------------------------------------
Selection-Screen Begin Of Block Media.
Parameters pa_Dummy(1).
Selection-Screen End Of Block Media.

"-Main--------------------------------------------------------------
At Selection-Screen.

Create Object Ref_Dock
Exporting
REPID = sy-repid
DYNNR = sy-dynnr
SIDE = CL_GUI_DOCKING_CONTAINER=>dock_at_right
RATIO = 50
Exceptions
Others = 1.

Create Object Ref_Media
Exporting
PARENT = Ref_Dock
Exceptions
Others = 1.

Call Method Ref_Media->setdatasource
Exporting
FileName = 'MyMovie.mp4'.

Call Screen 1000.

"-End-------------------------------------------------------------------

 

As you can see, only a selection screen with a dummy parameter, the docking container, the media class and a method call to set the file name property.

 

Now the class for the ActiveX control, in my case the Windows Media Player:


"-Begin-----------------------------------------------------------------

Class Z_CL_MEDIA Definition Public Inheriting From CL_GUI_CONTROL
Final Create Public .

Public Section.
Type-Pools CNTL .

Methods Constructor Importing Parent Type Ref To CL_GUI_CONTAINER.
Methods Dispatch Redefinition.
Methods SetDataSource Importing FileName Type String.

EndClass.

Class Z_CL_MEDIA Implementation.

Method Constructor.

Call Method Super->constructor
Exporting
CLSID = 'MediaPlayer.MediaPlayer'
PARENT = Parent
LIFETIME = 2
Exceptions
Others = 1.
EndMethod.

Method Dispatch.
Call Method CL_GUI_CFW=>Flush.
EndMethod.

Method SetDataSource.
Call Method Set_Property
Exporting
PROPERTY = 'FileName'
VALUE = FileName.
Call Method CL_GUI_CFW=>FLUSH.
EndMethod.

EndClass.

"-End-------------------------------------------------------------------

 

As you can see, also nothing special. In the constructor method is the name of the ActiveX control (ClassID) defined and the method SetDataSource sets the property FileName of the control.

 

Here now an example result:



With only 53 lines code you can implement the Windows MediaPlayer ActiveX control inside a selection screen.

Cheers
Stefan

8 Comments
Labels in this area