Есть элемент activex.
Глядя на "Using Classic ActiveX Controls in the ABAP Control Framework
Thomas Jung", написан класс.
Code:
METHOD constructor.
DATA prog_id(80).
IF parent IS INITIAL.
RAISE error_cntl_create.
ENDIF.
CLASS cl_gui_cfw DEFINITION LOAD.
* assign prog_id to get the frontend specific control
IF NOT activex IS INITIAL.
prog_id = 'VIIDK.CameraCtrl.1'.
ELSEIF NOT javabean IS INITIAL.
RAISE gui_type_not_supported.
ENDIF.
IF prog_id IS INITIAL.
RAISE gui_type_not_supported.
ENDIF.
* Set the window styles of the control when style parameter was not
* set with constructor call.
* For more information on the styles see WIN32 SDK
IF style IS INITIAL.
* otherwise the control would be invisible and the mistake would be
* hard to find
style = cl_gui_control=>ws_visible
+ cl_gui_control=>ws_child
+ cl_gui_control=>ws_clipsiblings.
ENDIF.
* Create the control
CALL METHOD super->constructor
EXPORTING
clsid = prog_id
shellstyle = style
parent = parent
lifetime = lifetime
name = name
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
RAISE error_cntl_create.
ENDIF.
* register instance at framework
CALL METHOD cl_gui_cfw=>subscribe
EXPORTING
shellid = h_control-shellid
ref = me
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
RAISE error_cntl_create.
ENDIF.
* create and initialize dataprovider => m_dp_handle
CALL FUNCTION 'DP_CREATE'
CHANGING
h_dp = m_dp_handle
EXCEPTIONS
dp_create_error = 1
dp_install_error = 2
dp_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RAISE error_dp_create.
ENDIF.
ENDMETHOD.
method SET_IP .
call method set_property
exporting
property = 'ip' "#EC NOTEXT
value = val "#EC NOTEXT
exceptions
cntl_system_error = 1
cntl_error = 2
others = 3.
if sy-subrc <> 0.
raise error_cntl_call_method.
endif.
* echo current property of control in attribute (public, read-only) of
* class. Thus calls to get method and eventually necessary flushes can
* be avoided and performance is improved.
m_ip = val.
endmethod.
method PLAY.
m_par_val = 'play'.
call method call_method
exporting
method = 'Play'
exceptions
others = 1.
if sy-subrc ne 0.
raise ERROR_CNTL_CALL_METHOD.
endif.
endmethod.
Есть программка, которая не работает:
Code:
...
data: container_1 type ref to cl_gui_custom_container,
cam type ref to ZCL_GUI_CAM.
end-of-selection.
create object container_1
exporting
container_name = 'CONTAINER_1'
.
create object cam
exporting
parent = container_1
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
others = 6
.
call screen 5000.
module STATUS_5000 output.
set pf-status 'S1'.
endmodule.
module USER_COMMAND_5000 input.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
when 'EXIT'.
leave program.
when 'INIT'.
perform init.
endcase.
endmodule.
FORM init.
call method cam->set_ip
exporting
val = '127.0.0.1'
.
call method cam->set_port
exporting
val = '900'
.
call method cam->set_camid
exporting
val = 1
.
call method cam->Play .
call method cl_gui_cfw=>flush.
endform.
После запуска init при вызове cl_gui_cfw=>flush все текущие режимы и саплогон закрываются и остается процесс saplogon.exe, занимающий 50% цп. Подобное происходит при попытке вызвать любой метод (кроме set_property)) элемента.
Если установить свойства в неверные значения - ошибки нет - ведет себя так, как при неудадачной попытке соединения.
Как быть?