<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Triggerring Standard Interface Event in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895008#M1596191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagannath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please post the complete code, as i do not see the ref for variable CONT etc in the code you have pasted above,&lt;/P&gt;&lt;P&gt;also below is a demo program which shows how to enable the on_save event, see if the below code gives you any direction...else please paste the complete code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

TYPE-POOLS: sbdst.

INCLUDE officeintegrationinclude.

TYPES: BEGIN OF doc_attr,
          doc_name(40), document_id(64),
       END OF doc_attr.

TYPES: doc_tab TYPE TABLE OF doc_attr.

DATA: fcode LIKE sy-ucomm.

START-OF-SELECTION.
  SET SCREEN 9000.

  DATA: lcl_control     TYPE REF TO i_oi_ole_container_control.
  DATA: lcl_container   TYPE REF TO cl_gui_custom_container.

  DATA: l_rc          TYPE t_oi_ret_string,
        l_doc_type    TYPE soi_document_type
                      VALUE soi_doctype_word_document,
        l_doc_frmt    TYPE soi_document_type.


*---------------------------------------------------------------------*
*       CLASS c_msword_doc DEFINITION
*---------------------------------------------------------------------*
CLASS c_msword_doc DEFINITION.

  PUBLIC SECTION.
    DATA: lcl_proxy        TYPE REF TO i_oi_document_proxy.
    DATA: l_att_doc_type   TYPE soi_document_type.
    DATA: l_att_data_table TYPE sbdst_content,
          l_att_data_size  TYPE i.

    METHODS: constructor
              IMPORTING control TYPE REF TO i_oi_ole_container_control
                        document_type TYPE soi_document_type.

    METHODS: create_document
                  IMPORTING open_inplace  TYPE c DEFAULT ' '
                  EXPORTING retcode TYPE t_oi_ret_string.

    METHODS: close_document
                  IMPORTING do_save     TYPE c DEFAULT ' '
                  RETURNING value(retcode) TYPE t_oi_ret_string.
* For on close Event
    METHODS: on_close_document
              FOR EVENT on_close_document OF i_oi_document_proxy
              IMPORTING document_proxy has_changed.

  PRIVATE SECTION.
    DATA: l_att_control  TYPE REF TO i_oi_ole_container_control.
ENDCLASS.                    "c_msword_doc DEFINITION

DATA: l_fcode          TYPE fcode.
DATA: l_doc            TYPE REF TO c_msword_doc.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_9000  PBO
*&amp;amp;---------------------------------------------------------------------*
MODULE status_9000 OUTPUT.

  SET PF-STATUS 'PFSTAT'. " Set the PFSTAT for the create button

  l_rc = c_oi_errors=&amp;gt;ret_ok.

  IF lcl_control IS INITIAL.

* Get an instance of the controller
    CALL METHOD c_oi_ole_control_creator=&amp;gt;get_ole_container_control
      IMPORTING
        control = lcl_control
        retcode = l_rc.
    CALL METHOD c_oi_errors=&amp;gt;show_message
      EXPORTING
        type = 'E'.

* Get an instance of the container
    CREATE OBJECT lcl_container
      EXPORTING
        container_name = 'CONTAINER'.

* Initialize the container using the controller
    CALL METHOD lcl_control-&amp;gt;init_control
      EXPORTING
        r3_application_name      = 'Demo'                   "#EC NOTEXT
        inplace_enabled          = 'X'
        inplace_scroll_documents = 'X'
        parent                   = lcl_container
        register_on_close_event  = 'X'
      IMPORTING
        retcode                  = l_rc.
    CALL METHOD c_oi_errors=&amp;gt;show_message
      EXPORTING
        type = 'E'.

* Create the document
    CREATE OBJECT l_doc
      EXPORTING
        control       = lcl_control
        document_type = l_doc_type.

  ENDIF.

ENDMODULE.                             " STATUS_9000  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_9000 PAI
*&amp;amp;---------------------------------------------------------------------*
MODULE user_command_9000 INPUT.

  l_fcode = fcode.
  CLEAR fcode.

  CALL METHOD cl_gui_cfw=&amp;gt;dispatch.

  IF l_fcode EQ 'CREATE'.
    IF NOT lcl_control IS INITIAL.
      l_doc-&amp;gt;l_att_data_size = 0.
      CLEAR l_doc-&amp;gt;l_att_data_table.
      CALL METHOD l_doc-&amp;gt;create_document.
      CALL METHOD c_oi_errors=&amp;gt;show_message
        EXPORTING
          type = 'E'.
    ENDIF.
  ENDIF.

  IF l_fcode EQ 'EXIT'.                       "Zurück
    IF NOT l_doc IS INITIAL.
      CALL METHOD l_doc-&amp;gt;close_document.
      FREE l_doc.
    ENDIF.

    IF NOT lcl_control IS INITIAL.
      CALL METHOD lcl_control-&amp;gt;destroy_control
        IMPORTING
          retcode = l_rc.
      FREE lcl_control.
    ENDIF.

    LEAVE TO SCREEN 0.
  ENDIF.
ENDMODULE.                             " USER_COMMAND_9000  INPUT

************************************************************************
*  CLASS c_msword_doc IMPLEMENTATION.
************************************************************************
CLASS c_msword_doc IMPLEMENTATION.
  METHOD: constructor.
    me-&amp;gt;l_att_control = control.
    me-&amp;gt;l_att_doc_type = document_type.
  ENDMETHOD.                    "constructor

  METHOD create_document.
    IF NOT lcl_proxy IS INITIAL.
      CALL METHOD me-&amp;gt;close_document.
    ENDIF.
    CALL METHOD lcl_control-&amp;gt;get_document_proxy
      EXPORTING
        document_type  = l_att_doc_type
      IMPORTING
        document_proxy = lcl_proxy
        retcode        = retcode.
    IF retcode NE c_oi_errors=&amp;gt;ret_ok.
      EXIT.
    ENDIF.

    CALL METHOD lcl_proxy-&amp;gt;create_document
      EXPORTING
        create_view_data = 'X'
        open_inplace     = open_inplace
      IMPORTING
        retcode          = retcode.
    IF retcode NE c_oi_errors=&amp;gt;ret_ok.
      EXIT.
    ENDIF.

    SET HANDLER me-&amp;gt;on_close_document FOR lcl_proxy.
  ENDMETHOD.                    "create_document

  METHOD close_document.

    DATA: is_closed TYPE i, has_changed TYPE i.
    DATA: doc_url(256).

    IF NOT lcl_proxy IS INITIAL.
      CALL METHOD lcl_proxy-&amp;gt;is_destroyed
        IMPORTING
          ret_value = is_closed.

      IF is_closed IS INITIAL.
        CALL METHOD lcl_proxy-&amp;gt;close_document
          EXPORTING
            do_save     = do_save
          IMPORTING
            has_changed = has_changed
            retcode     = retcode.
        IF retcode NE c_oi_errors=&amp;gt;ret_ok.
          EXIT.
        ENDIF.
      ENDIF.

      IF NOT has_changed IS INITIAL.
        CALL METHOD lcl_proxy-&amp;gt;save_document_to_table
          IMPORTING
            retcode        = retcode
          CHANGING
            document_table = l_att_data_table
            document_size  = l_att_data_size.
        IF retcode NE c_oi_errors=&amp;gt;ret_ok.
          EXIT.
        ENDIF.
      ENDIF.

      CALL METHOD lcl_proxy-&amp;gt;release_document
        IMPORTING
          retcode = retcode.

      SET HANDLER me-&amp;gt;on_close_document FOR lcl_proxy ACTIVATION ' '.
    ELSE.
      retcode = c_oi_errors=&amp;gt;ret_document_not_open.
    ENDIF.
  ENDMETHOD.                    "close_document

  METHOD on_close_document.

    DATA: l_resp, l_save.

    IF has_changed EQ 1.
      CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
          titlebar              = 'MSWORD On Save Event Demo'
          text_question         = 'Do you wanna Save?'
          display_cancel_button = ' '
        IMPORTING
          answer                = l_resp.
      IF l_resp EQ '1'.
        l_save = 'X'.
      ELSE.
        l_save = ' '.
      ENDIF.
      CALL METHOD me-&amp;gt;close_document
        EXPORTING
          do_save = l_save.
      CALL METHOD c_oi_errors=&amp;gt;show_message
        EXPORTING
          type = 'E'.
    ENDIF.
  ENDMETHOD.                    "on_close_document
ENDCLASS.                    "c_msword_doc IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:33 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:34 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:36 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:36 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 May 2011 10:03:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-05-13T10:03:44Z</dc:date>
    <item>
      <title>Triggerring Standard Interface Event</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895005#M1596188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using the interface I_OI_DOCUMENT_PROXY.Our exact requirement is to capture a MS Word Document data into a internal table whenever the MS Word document is changed and closed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We felt that the event ON_CLOSE_DOCUMENT in the interface  I_OI_DOCUMENT_PROXY could be used (please correct us if this is wrong)..We have registered the event for that method (which needs to get triggered on MS-Word Document close) via             &lt;/P&gt;&lt;P&gt;SET HANDLER (Actually this a module pool program wherein this SET HANDLER is used in PBO)..and via method we tried to RAISE that EVENT ON_CLOSE_DOCUMENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, everything is working fine except the event ON_CLOSE_DOCUMENT is not getting triggered and hence we are not getting the desired result...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Waiting for your replies...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 05:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895005#M1596188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-12T05:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Triggerring Standard Interface Event</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895006#M1596189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagannathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you created a control for OLE using the interface &lt;STRONG&gt;I_OI_OLE_CONTAINER_CONTROL&lt;/STRONG&gt; if yes, please confirm on initializing this control using method &lt;STRONG&gt;INIT_CONTROL&lt;/STRONG&gt; if you have set the parameter &lt;STRONG&gt;REGISTER_ON_CLOSE_EVENT&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 06:35:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895006#M1596189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-12T06:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Triggerring Standard Interface Event</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895007#M1596190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have tried using INIT_CONTROL.....But still we could not get the desired result .........&lt;/P&gt;&lt;P&gt;Please guide us in which part we are going wrong....&lt;/P&gt;&lt;P&gt;Our screen contains a custom Container called 'CONTAINER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C_EVENT_HANDLER DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    INTERFACES I_OI_DOCUMENT_PROXY.&lt;/P&gt;&lt;P&gt;    CLASS-METHODS: CLOSE_EVENT_HANDLER&lt;/P&gt;&lt;P&gt;              FOR EVENT ON_CLOSE_DOCUMENT OF I_OI_DOCUMENT_PROXY&lt;/P&gt;&lt;P&gt;              IMPORTING DOCUMENT_PROXY HAS_CHANGED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   METHODS: HANDLE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "c_event_handler DEFINITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C_EVENT_HANDLER IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD CLOSE_EVENT_HANDLER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: ANSWER.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   MESSAGE 'Success' TYPE 'S'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF HAS_CHANGED EQ 1.&lt;/P&gt;&lt;P&gt;      PERFORM SAVE_DOCUMENT TABLES DATA_TABLE&lt;/P&gt;&lt;P&gt;                  USING 'X' 'X'&lt;/P&gt;&lt;P&gt;                  CHANGING DATA_SIZE DOCUMENT_PROXY RETCODE.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "close_event_handler&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; METHOD HANDLE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   RAISE EVENT I_OI_DOCUMENT_PROXY~ON_CLOSE_DOCUMENT&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;               EXPORTING DOCUMENT_PROXY = DOCUMENT&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                         HAS_CHANGED = HAS_CHANGED.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDMETHOD.                    "CLOSE_EVENT_HANDLER&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDCLASS.                    "c_event_handler IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And in PBO, We have used&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'CONTROL_INIT'&lt;/P&gt;&lt;P&gt;        EXCEPTIONS&lt;/P&gt;&lt;P&gt;          CONTROL_INIT_ERROR = 1&lt;/P&gt;&lt;P&gt;          OTHERS             = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD C_OI_OLE_CONTROL_CREATOR=&amp;gt;GET_OLE_CONTAINER_CONTROL&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        CONTROL = CONTROL&lt;/P&gt;&lt;P&gt;        RETCODE = RETCODE.&lt;/P&gt;&lt;P&gt;    CALL METHOD C_OI_ERRORS=&amp;gt;SHOW_MESSAGE&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        TYPE = 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD CONTROL-&amp;gt;INIT_CONTROL&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        R3_APPLICATION_NAME      = 'R/3 Basis'&lt;/P&gt;&lt;P&gt;        REGISTER_ON_CLOSE_EVENT  = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   REGISTER_ON_CUSTOM_EVENT = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        PARENT                   = CONT&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        RETCODE                  = RETCODE&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        JAVABEANNOTSUPPORTED     = 1&lt;/P&gt;&lt;P&gt;        OTHERS                   = 2.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And in PAI, we tried creating a MS Document on which we are going to type the data and capture that.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SET HANDLER C_EVENT_HANDLER=&amp;gt;CLOSE_EVENT_HANDLER FOR DOCUMENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CALL METHOD DOCUMENT-&amp;gt;CREATE_DOCUMENT&lt;/P&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;P&gt;          RETCODE = RETCODE.&lt;/P&gt;&lt;P&gt;      CALL METHOD C_OI_ERRORS=&amp;gt;SHOW_MESSAGE&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          TYPE = 'E'.&lt;/P&gt;&lt;P&gt;Waiting for your replies...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 08:12:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895007#M1596190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-12T08:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Triggerring Standard Interface Event</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895008#M1596191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagannath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please post the complete code, as i do not see the ref for variable CONT etc in the code you have pasted above,&lt;/P&gt;&lt;P&gt;also below is a demo program which shows how to enable the on_save event, see if the below code gives you any direction...else please paste the complete code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

TYPE-POOLS: sbdst.

INCLUDE officeintegrationinclude.

TYPES: BEGIN OF doc_attr,
          doc_name(40), document_id(64),
       END OF doc_attr.

TYPES: doc_tab TYPE TABLE OF doc_attr.

DATA: fcode LIKE sy-ucomm.

START-OF-SELECTION.
  SET SCREEN 9000.

  DATA: lcl_control     TYPE REF TO i_oi_ole_container_control.
  DATA: lcl_container   TYPE REF TO cl_gui_custom_container.

  DATA: l_rc          TYPE t_oi_ret_string,
        l_doc_type    TYPE soi_document_type
                      VALUE soi_doctype_word_document,
        l_doc_frmt    TYPE soi_document_type.


*---------------------------------------------------------------------*
*       CLASS c_msword_doc DEFINITION
*---------------------------------------------------------------------*
CLASS c_msword_doc DEFINITION.

  PUBLIC SECTION.
    DATA: lcl_proxy        TYPE REF TO i_oi_document_proxy.
    DATA: l_att_doc_type   TYPE soi_document_type.
    DATA: l_att_data_table TYPE sbdst_content,
          l_att_data_size  TYPE i.

    METHODS: constructor
              IMPORTING control TYPE REF TO i_oi_ole_container_control
                        document_type TYPE soi_document_type.

    METHODS: create_document
                  IMPORTING open_inplace  TYPE c DEFAULT ' '
                  EXPORTING retcode TYPE t_oi_ret_string.

    METHODS: close_document
                  IMPORTING do_save     TYPE c DEFAULT ' '
                  RETURNING value(retcode) TYPE t_oi_ret_string.
* For on close Event
    METHODS: on_close_document
              FOR EVENT on_close_document OF i_oi_document_proxy
              IMPORTING document_proxy has_changed.

  PRIVATE SECTION.
    DATA: l_att_control  TYPE REF TO i_oi_ole_container_control.
ENDCLASS.                    "c_msword_doc DEFINITION

DATA: l_fcode          TYPE fcode.
DATA: l_doc            TYPE REF TO c_msword_doc.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_9000  PBO
*&amp;amp;---------------------------------------------------------------------*
MODULE status_9000 OUTPUT.

  SET PF-STATUS 'PFSTAT'. " Set the PFSTAT for the create button

  l_rc = c_oi_errors=&amp;gt;ret_ok.

  IF lcl_control IS INITIAL.

* Get an instance of the controller
    CALL METHOD c_oi_ole_control_creator=&amp;gt;get_ole_container_control
      IMPORTING
        control = lcl_control
        retcode = l_rc.
    CALL METHOD c_oi_errors=&amp;gt;show_message
      EXPORTING
        type = 'E'.

* Get an instance of the container
    CREATE OBJECT lcl_container
      EXPORTING
        container_name = 'CONTAINER'.

* Initialize the container using the controller
    CALL METHOD lcl_control-&amp;gt;init_control
      EXPORTING
        r3_application_name      = 'Demo'                   "#EC NOTEXT
        inplace_enabled          = 'X'
        inplace_scroll_documents = 'X'
        parent                   = lcl_container
        register_on_close_event  = 'X'
      IMPORTING
        retcode                  = l_rc.
    CALL METHOD c_oi_errors=&amp;gt;show_message
      EXPORTING
        type = 'E'.

* Create the document
    CREATE OBJECT l_doc
      EXPORTING
        control       = lcl_control
        document_type = l_doc_type.

  ENDIF.

ENDMODULE.                             " STATUS_9000  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_9000 PAI
*&amp;amp;---------------------------------------------------------------------*
MODULE user_command_9000 INPUT.

  l_fcode = fcode.
  CLEAR fcode.

  CALL METHOD cl_gui_cfw=&amp;gt;dispatch.

  IF l_fcode EQ 'CREATE'.
    IF NOT lcl_control IS INITIAL.
      l_doc-&amp;gt;l_att_data_size = 0.
      CLEAR l_doc-&amp;gt;l_att_data_table.
      CALL METHOD l_doc-&amp;gt;create_document.
      CALL METHOD c_oi_errors=&amp;gt;show_message
        EXPORTING
          type = 'E'.
    ENDIF.
  ENDIF.

  IF l_fcode EQ 'EXIT'.                       "Zurück
    IF NOT l_doc IS INITIAL.
      CALL METHOD l_doc-&amp;gt;close_document.
      FREE l_doc.
    ENDIF.

    IF NOT lcl_control IS INITIAL.
      CALL METHOD lcl_control-&amp;gt;destroy_control
        IMPORTING
          retcode = l_rc.
      FREE lcl_control.
    ENDIF.

    LEAVE TO SCREEN 0.
  ENDIF.
ENDMODULE.                             " USER_COMMAND_9000  INPUT

************************************************************************
*  CLASS c_msword_doc IMPLEMENTATION.
************************************************************************
CLASS c_msword_doc IMPLEMENTATION.
  METHOD: constructor.
    me-&amp;gt;l_att_control = control.
    me-&amp;gt;l_att_doc_type = document_type.
  ENDMETHOD.                    "constructor

  METHOD create_document.
    IF NOT lcl_proxy IS INITIAL.
      CALL METHOD me-&amp;gt;close_document.
    ENDIF.
    CALL METHOD lcl_control-&amp;gt;get_document_proxy
      EXPORTING
        document_type  = l_att_doc_type
      IMPORTING
        document_proxy = lcl_proxy
        retcode        = retcode.
    IF retcode NE c_oi_errors=&amp;gt;ret_ok.
      EXIT.
    ENDIF.

    CALL METHOD lcl_proxy-&amp;gt;create_document
      EXPORTING
        create_view_data = 'X'
        open_inplace     = open_inplace
      IMPORTING
        retcode          = retcode.
    IF retcode NE c_oi_errors=&amp;gt;ret_ok.
      EXIT.
    ENDIF.

    SET HANDLER me-&amp;gt;on_close_document FOR lcl_proxy.
  ENDMETHOD.                    "create_document

  METHOD close_document.

    DATA: is_closed TYPE i, has_changed TYPE i.
    DATA: doc_url(256).

    IF NOT lcl_proxy IS INITIAL.
      CALL METHOD lcl_proxy-&amp;gt;is_destroyed
        IMPORTING
          ret_value = is_closed.

      IF is_closed IS INITIAL.
        CALL METHOD lcl_proxy-&amp;gt;close_document
          EXPORTING
            do_save     = do_save
          IMPORTING
            has_changed = has_changed
            retcode     = retcode.
        IF retcode NE c_oi_errors=&amp;gt;ret_ok.
          EXIT.
        ENDIF.
      ENDIF.

      IF NOT has_changed IS INITIAL.
        CALL METHOD lcl_proxy-&amp;gt;save_document_to_table
          IMPORTING
            retcode        = retcode
          CHANGING
            document_table = l_att_data_table
            document_size  = l_att_data_size.
        IF retcode NE c_oi_errors=&amp;gt;ret_ok.
          EXIT.
        ENDIF.
      ENDIF.

      CALL METHOD lcl_proxy-&amp;gt;release_document
        IMPORTING
          retcode = retcode.

      SET HANDLER me-&amp;gt;on_close_document FOR lcl_proxy ACTIVATION ' '.
    ELSE.
      retcode = c_oi_errors=&amp;gt;ret_document_not_open.
    ENDIF.
  ENDMETHOD.                    "close_document

  METHOD on_close_document.

    DATA: l_resp, l_save.

    IF has_changed EQ 1.
      CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
          titlebar              = 'MSWORD On Save Event Demo'
          text_question         = 'Do you wanna Save?'
          display_cancel_button = ' '
        IMPORTING
          answer                = l_resp.
      IF l_resp EQ '1'.
        l_save = 'X'.
      ELSE.
        l_save = ' '.
      ENDIF.
      CALL METHOD me-&amp;gt;close_document
        EXPORTING
          do_save = l_save.
      CALL METHOD c_oi_errors=&amp;gt;show_message
        EXPORTING
          type = 'E'.
    ENDIF.
  ENDMETHOD.                    "on_close_document
ENDCLASS.                    "c_msword_doc IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:33 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:34 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:36 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 13, 2011 3:36 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 10:03:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895008#M1596191</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-13T10:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Triggerring Standard Interface Event</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895009#M1596192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We made changes in the same program....&lt;/P&gt;&lt;P&gt;We tried pasting the full code but it was not legible to read, thats why we pasted some part of the code....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hey can you give us the mail id so that we can send the code...Atleast the code will be legible to go through....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 11:38:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/triggerring-standard-interface-event/m-p/7895009#M1596192</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-13T11:38:21Z</dc:date>
    </item>
  </channel>
</rss>

