Use Your Own ActiveX Control in ABAP

Here are the basic steps needed to use your own ActiveX control in SAP. It is assumed that the control is registered as kksap1.Control1 in Windows.

STEP 1: Create a custom container named as “PARENT”.

STEP 2: Put this code into your programs PBO:

data:
ctrl_name(80) type c.

if not cl_gui_object=>activex is initial.
ctrl_name = ‘kksap1.Control1’.
else.

endif.

call method super->constructor
exporting
clsid = ctrl_name
shellstyle = shellstyle
parent = parent
lifetime = lifetime
name = m_name
exceptions
cntl_system_error = 1
others = 2.

call method cl_gui_cfw=>subscribe
exporting
ref = me
shellid = me->h_control-shellid
exceptions
others = 1.

STEP 3: Here is an example method call:

CALL METHOD OF H_CONTROL-OBJ ‘setLabel1’ NO FLUSH
EXPORTING #1 = TEXT.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s