简体   繁体   English

如何从 SAP 调用 ActiveX?

[英]How can I call ActiveX from SAP?

I have a custom ActiveX control that I would like to Call from SAP.我有一个想要从 SAP 调用的自定义 ActiveX 控件。

In this case I cannot use PI, what other options do I have?在这种情况下我不能使用 PI,我还有什么其他选择?

See program SAPRDEMO_ACTIVEX_INTEGRATION as an example.以程序SAPRDEMO_ACTIVEX_INTEGRATION为例。

 DATA: control       TYPE REF TO i_oi_container_control, 
      ocx_document  TYPE REF TO i_oi_document_proxy,
      has_activex   TYPE flag,
      retcode       TYPE soi_ret_string,
      doc_handle    TYPE cntl_handle,
      document_type TYPE soi_document_type VALUE 'SAPActiveXDoc.Example1'.

"Test whether activeX is supported"
CALL FUNCTION 'GUI_HAS_ACTIVEX'
    IMPORTING return  = has_activex.
CHECK NOT has_activex IS INITIAL.

CALL METHOD control->init_control
       EXPORTING r3_application_name      = 'R/3 Basis'
                 inplace_enabled          = 'X'
                 register_on_close_event  = 'X'
                 register_on_custom_event = 'X'
                 parent                   = cl_gui_container=>default_screen
       IMPORTING retcode                  = retcode.

CALL METHOD control->get_document_proxy
       EXPORTING document_type  = document_type
       IMPORTING document_proxy = oxc_document
                 retcode        = retcode.

CALL METHOD oxc_document->open_activex_document
       IMPORTING retcode = retcode.

CALL METHOD ocx_document->get_document_handle
       IMPORTING handle  = doc_handle
                 retcode = retcode.

CALL FUNCTION 'CONTROL_CALL_METHOD'
       EXPORTING h_control = doc_handle
                 method    = 'MyMethod'
                 p_count   = 0.

CALL METHOD ocx_document->clsoe_activex_document
       IMPORTING retcode = retcode.

I've stripped out the screen processing & error handling of the example program in order to give an overview of main calls that are needed.我已经去除了示例程序的屏幕处理和错误处理,以便概述所需的主要调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM