【问题标题】:How can I call ActiveX from SAP?如何从 SAP 调用 ActiveX?
【发布时间】:2010-03-08 00:02:52
【问题描述】:

我有一个要从 SAP 调用的自定义 ActiveX 控件。

在这种情况下,我无法使用 PI,我还有哪些其他选择?

【问题讨论】:

    标签: activex abap ole


    【解决方案1】:

    以程序 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.
    

    我已经删除了示例程序的屏幕处理和错误处理,以便概述所需的主要调用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多