I_OI_DOCUMENT_PROXY- EXECUTE_MACRO in excel

Hi,
I want to execute a macro to add a chart into excel. I created the macro 'graphic' in excel then I call it from abap with the metod execute macro but it doesn't work.
DATA:  DOCUMENT    TYPE REF TO I_OI_DOCUMENT_PROXY.
  CALL METHOD DOCUMENT->EXECUTE_MACRO
    EXPORTING
      MACRO_STRING = 'Modulo1.graphic'
    IMPORTING
      ERROR        = ERRORS
      RETCODE      = retcode
Also I tried
  CALL METHOD DOCUMENT->EXECUTE_MACRO
    EXPORTING
      MACRO_STRING = 'graphic'
    IMPORTING
      ERROR        = ERRORS
      RETCODE      = retcode
I would like you give me instructions for make it work. Do I have to do anything else to make it work?.

Hi,
Please refere thie demo (Pie Chart) program GFW_PROG_PIE. This will help you.
Need more ifn fo please send me an e-mail.
Cheers.
Message was edited by: Lanka Murthy

Similar Messages

  • Execute an Excel Macro?

    Hello all,
    I created a report in which I show the result in an Excel...so far no problem... I open an Excel Template document, I pass the information I want to the places I want etc. The only problem is that I method for executing a macro seems not to work!
    Does somebody has an idea whats wrong?
    The security for macros in the excel is at medium...I already tried to put the security level to low...but nothing.
    The <i>retcode</i> has as result "MACRO_OR_SCRIPT_FAILED"
    I created the Macro and I am sure it works...because when I execute it manualy it does what it should do. Even after my report has open the documente and shows the document I can execute de macro and it works.
            call method p_g_document->execute_macro
              exporting
                macro_string = 'COPYSHEET'
              importing
                error        = it_errors
                retcode      = retcode.
    Just for information, the only thing the macro does is copying a spreadsheet.
    I somebody could help it would be great, I already lost some days to find the solution.
    Thanks in advanced.
    Marcelo Moreira

    Hey all,
    Does not seemes that someone has the answer I need, but my last question for this topic is....
    Does someone of you already implement a report, using an excel with macro calling from ABAP?
    I have doubts if the method
    <i>call method I_OI_DOCUMENT_PROXY->execute_macro</i> really work for Excel.
    Even in the SAPOFFICEINTEGRATION example I am not sure if it works.
    Maybe someone of you has an working example of macro calling from ABAP for Excel.
    I would be very glad if somebody has some ideas for my problem....I getting mad with this... :-S
    Greetings,
    Marcelo Moreira

  • Executing a macro (for WORD)

    Hi everyone,
    I created a macro in Word.
    Now I am calling it successfuly from ABAP using i_oi_document_proxy->execute_macro.
    Is there a way to pass a parameter from ABAP to the macro ?
    Thanks in advance.

    HI
    GOOD
    GO THROUGH THIS CODE , I HOPE YOU WILL GET SOME HELP YOU SOLVE YOUR PROBLEM.
                          EXAMPLE                      *
    REPORT ZVALDATE . 
      Data: v_date(8).
      V_date = '20030102'.
    VAL_DATE <DATE> <FORMAT>  <-- Passing Parameters
      val_date v_date 'YYYYMMDD'.
      if sy-subrc = 0.
        write: 'Valid Date' .
      elseif sy-subrc = 1.
        write: 'Invalid Date' .
      elseif sy-subrc = 2.
        write: 'Invalid Date Format' .
      endif.
                      END OF REPORT                    *
    To use the macro "VAL_DATE" GLOBALLY, Insert the  *
    below 2 macros in table TRMAC using Txn SM30.     *
    Sytax :                                            *
    VAL_DATA <Date> <Date format>.                     *
    It return sy-subrc.                                *
          0 => Valid date - as per the specified format*
          1 => Invalid date                            *
          2 => Invalid date format                     *
    <Date format> :                                    *
    You can pass the following date formats            *
    DDMMYYYY  MMDDYYYY  YYYYMMDD  YYYYDDMM             *
                  Macro    VAL-DATE                    *
    This macro validate Date according to the specified*
    format.                                            *
               Created by Abhishek Kumar               *
               [email protected]                        * 
    define val-dat.
      clear: %_date1, %_date2.
      %_date1(4)   = &1. "Year
      %_date1+4(2) = &2. "Month
      %_date1+6(2) = &3. "Date
      %_date2 = %_date1 - 1.
      %_date2 = %_date2 + 1.
      if %_date1 <> %_date2.
        sy-subrc = 1.
      else.
        sy-subrc = 0.
      endif.
    end-of-definition.
                  Macro    VAL_DATE                    *
               Created by Abhishek Kumar               *
               [email protected]                        *
    define val_date.
      data %_date1 like sy-datum.
      data  %_date2 like sy-datum.
      data %_date3(8).
      case &2.
        when 'DDMMYYYY'.
          val-date &14(4) &12(2) &1+0(2).
        when 'MMDDYYYY'.
          val-date &14(4) &10(2) &1+2(2).
        when 'YYYYMMDD'.
          val-date &10(4) &14(2) &1+6(2).
        when 'MMYYYYDD'.
          val-date &12(4) &10(2) &1+6(2).
        when others.
          sy-subrc =  2.
      endcase.
    end-of-definition.
    THANKS
    MRUTYUN

  • Opening an Excel document using I_OI_DOCUMENT_PROXY

    Hi,
    I'm currently opening an Excel document using the OPEN_DOCUMENT method of the I_OI_DOCUMENT_PROXY interface. A macro is then run to populate specified columns in the spreadsheet and then proceeds with printing the document.
    Within Excel, we've set Application.ScreenUpdating = False, which hides the document from the user. When launching the document directly from the local drive (not from SAP), it doesn't get displayed.
    However, calling it from SAP seems to bring up Excel, and it shows the processing of the macro as well as the automatic printing and only then will Excel close.
    My question is, is there anyway we'd be able to run the Excel macro and print the spreadsheet without Excel ever opening at all?
    Thanks and regards,
    Adeline.

    Hi,
    I'm currently opening an Excel document using the OPEN_DOCUMENT method of the I_OI_DOCUMENT_PROXY interface. A macro is then run to populate specified columns in the spreadsheet and then proceeds with printing the document.
    Within Excel, we've set Application.ScreenUpdating = False, which hides the document from the user. When launching the document directly from the local drive (not from SAP), it doesn't get displayed.
    However, calling it from SAP seems to bring up Excel, and it shows the processing of the macro as well as the automatic printing and only then will Excel close.
    My question is, is there anyway we'd be able to run the Excel macro and print the spreadsheet without Excel ever opening at all?
    Thanks and regards,
    Adeline.

  • How to open a excel with VBA button using I_OI_DOCUMENT_PROXY

    same this image:
    http://www.ImageThe.net/show-image.php?id=d367faef6ed7333acc2edd0290481fc8
    how to use OPEN_ACTIVEX_DOCUMENT?
      CALL METHOD DOCUMENT->OPEN_ACTIVEX_DOCUMENT
        EXPORTING
          DOCUMENT_URL = ITEM_URL
        IMPORTING
          ERROR        = ERRORS.

    Look at the below excel, it has macro, like sum. It will help you..
    <%@page language="abap"%>
    <html>
      <head>
      </head>
      <body>
        <object id="msx" style="width:100%;height:300px;margin-top:50px"
                classid="clsid:0002E510-0000-0000-C000-000000000046">
          <param name="DisplayTitleBar" value="false"/>
                <param name="HTMLData"  value=""/>
        </object>
        <script type="text/javascript">
          layout_sheet = document.all("msx");
          layout_sheet.Cells(1,5) = 'Test mit einzelner Zelle';
          msx.range('F1').value = 'F1';
          range  = layout_sheet.Range(layout_sheet.Cells(1,1),layout_sheet.Cells(1,4));
          record = "Jahr;Januar;Februar;März";
          range.ParseText(record, ';');
          range  = layout_sheet.Range(layout_sheet.Cells(2,1),layout_sheet.Cells(2,4));
          range.value = [ 2006, '15', '17', '19' ];
          msx.range('a3:d3').value = [ 2007, 33, 15, 13 ];
          msx.range('a4:d4').value = [ 'Summen', '=SUM(B2:B3)', '=SUM(C2:C3)', '=SUM(D2:D3)' ];
          msx.range('b2').NumberFormat = '####.00';
          msx.range('b2').Interior.Color = 'red';
          msx.range('c1:d1').Font.Name = 'Courier';
          msx.range('c1:d1').Font.Color = 'blue';
          msx.range('c1:d1').Font.Size = 12;
          msx.range('c1:d1').Font.Bold = 1;
          layout_sheet.Cells.AutoFitColumns();
        </script>
      </body>
    </html>
    *Reward each useful answer
    Raja T

  • Running Excel macros from ABAP

    Hello everyone,
    I am trying to execute an Excel macro from an ABAP program.  We are currently on a 46C system.  While doing some research on help.sap.com I came across the method execute_macro in class i_oi_document_proxy.  I’ve never used methods in ABAP before and I’m not really sure what I’m doing.  Has anyone got this to work?  When I try to run the program it dumps with error OBJECTS_OBJREF_NOT_ASSIGNED.
    Thanks,
    Becky
    Here is the program:
    REPORT ztest_program.
    INCLUDE ole2incl.
    DATA gs_excel TYPE ole2_object .
    DATA gs_wbooks TYPE ole2_object .
    DATA gs_wbook TYPE ole2_object .
    DATA gs_application TYPE ole2_object .
    DATA: h_sheet TYPE ole2_object.
    DATA: document TYPE REF TO i_oi_document_proxy.
    *Name of the macro in Excel
    DATA: macro_string(50) TYPE c
                     VALUE 'FB03process.FromTheBeginning',
          no_flush TYPE c,
          param_count TYPE i VALUE 0,
          script_name TYPE c VALUE 'X',
          error TYPE REF TO i_oi_error
                OCCURS 0 WITH HEADER LINE,
          retcode TYPE soi_ret_string,
          error_string(50) TYPE c,
          retvalue(30) TYPE c.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
             text       = text-007
         EXCEPTIONS
              OTHERS     = 1.
    CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
    GET PROPERTY OF gs_wbooks 'Application' = gs_application .
    *--Opening the existing document
    CALL METHOD OF gs_wbooks 'Open' = gs_wbook
         EXPORTING #1 = 'D:\temp\FB03process.xls' .
    tell user what is going on
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
              PERCENTAGE = 0
             text       = text-009
         EXCEPTIONS
              OTHERS     = 1.
    GET PROPERTY OF gs_excel 'ACTIVESHEET' = h_sheet.
    CALL METHOD document->execute_macro
         EXPORTING macro_string  = macro_string
                   param_count   = param_count
                   script_name   = script_name
                   no_flush      = no_flush
         IMPORTING error         = error
                   retcode       = retcode
         CHANGING  error_string  = error_string
                   retvalue      = retvalue.
    disconnect from Excel
    FREE OBJECT gs_excel.
    PERFORM err_hdl.
    FORM err_hdl.
      IF sy-subrc <> 0.
        WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL

    Hi,
    Please correct me if I am wrong but it seems that you have not fetched a handle to the document object before issuing the statement CALL METHOD document->execute_macro. Hence the error OBJECTS_OBJREF_NOT_ASSIGNED is being dislayed. If you want to use SAP Desktop Office Integration using ABAP Objects, take a look at this article at http://www.intelligenterp.com/feature/archive/ or http://www.sapinfo.net/public/en/index.php4/article/comvArticle-193333c63b4bd807d2/en/articleStatistic
    Hope this helps.
    Regards
    Message was edited by: Shehryar Khan

  • How to execute Excel Marco from SAP using Office Integration Classes

    Is there a way to trigger Excel Macro from SAP? I tried using method CALL METHOD document->execute_macro
    of i_oi_document_proxy  but it does not work.
    Thanks
    Vivek

    Try this:
    If you are using OLE to populate the Excel Sheet then, then yes you can run a macro.
      CALL METHOD OF OBJ_EX_APP 'Run'
           EXPORTING #1 = MACROSTR.
    Adding a Field Exit
    To add a field exit first find the data element that is linked to the screen field- the screen number and program
    Run program RSMODPRF. You will need to create two function modules one FIELD_EXIT_MEPO_VENDOR and
    FIELD_EXIT_MEPO_VENDOR_A
    FIELD_EXIT_MEPO_VENDOR should have code simply of input = ouput.
    FIELD_EXIT_MEPO_VENDOR_A should have the code for whatever the functionality is required
    Go back to RSMODPRF and run the program without parameters. Use the push buttons to assign the screen, 'A' and program. Use the drop down to activate the field list.
    This should now work, but there is no way of debugging. For further information look at OSS 29377
    program zzdirlist.
    for AIX this method also works.
    DATA: BEGIN OF TABL OCCURS 0,
          TEXT(80) TYPE C,
          END OF TABL.
    DATA: COMMAND(256) TYPE C.
    COMMAND = 'ls'.
    CALL FUNCTION 'RFC_REMOTE_PIPE' DESTINATION 'SERVER_EXEC'
    EXPORTING COMMAND = COMMAND
    READ = 'X'
    TABLES PIPEDATA = TABL.
    LOOP AT TABL.
       WRITE:/ TABL-text.
    ENDLOOP.

  • I_OI_DOCUMENT_PROXY and I_OI_SCRIPT_COLLECTION

    Afternoon,
    Has any one been able to create a macro within an excel document using I_OI_DOCUMENT_PROXY and I_OI_SCRIPT_COLLECTION interfaces? If so how did you go about doing this?
    I get a CONTROL_INTERNAL_ERROR from the method gx_script_collection->add_script_from_table and can't seem to get beyond this poing:
    MESSAGE_ID    SOFFICEINTEGRATION
    MESSAGE_NR  118
    MESSAGE         Script contains errors
    Any help would be appreciated,
    Regards,

    Hi John,
    I found the error was not actual from EXCEL, but deep in from the Proxy service return error 118.
    In the mean time I found the problem :o)
    I have by mistake typed in macro wrong !
    CALL METHOD lc_document->execute_macro
        EXPORTING
    *      macro_string = 'CopySheet.Module1' -> Wrong call!
          macro_string = 'Module1.CopySheet'
    *      script_name  = ''
          no_flush     = ''
        IMPORTING
          error        = lo_error
          retcode      = l_retcode.
    Thanks for your help my code are working fine now :o)
    Jørgen Jensen

  • Error reading a Excel sheet in BDS

    Hi Team,
    I have uploaded an excel sheet in BDS by OAER. Now in my program I want to read the excel file. I am putting the code snippet.
    DATA;
          l_v_proxy   TYPE REF TO i_oi_document_proxy,
          l_v_control TYPE REF TO i_oi_container_control,
          l_v_container TYPE REF TO cl_gui_custom_container.
    CALL METHOD l_v_control->init_control
               EXPORTING r3_application_name =
                                       'BDS-DOI'
                          inplace_enabled = 'X'
                          inplace_scroll_documents = 'X'
                          parent = l_v_container
                         register_on_close_event = 'X'
                         register_on_custom_event = 'X'
                IMPORTING retcode = v_retcode.
        CALL METHOD c_oi_errors=>raise_message
          EXPORTING
            type = 'E'.
      CALL METHOD l_v_control->get_document_proxy
        EXPORTING
          document_type   = 'Excel.Sheet.8'
          document_format = l_v_doc_format "OLE
        IMPORTING
          document_proxy  = l_v_proxy
          retcode         = v_retcode.
      IF v_retcode NE c_oi_errors=>ret_ok.
        EXIT.
      ENDIF.
      CLEAR l_v_error.
      CALL METHOD l_v_proxy->has_spreadsheet_interface
        IMPORTING
          error        = l_v_error
          is_available = l_v_has
          retcode      = v_retcode.
      IF v_retcode NE 'OK'.
        RETURN.
      ENDIF.
    But in has_spreadsheet_interface it returns error return code like 'DOCUMENT_NOT_OPEN'.
    Can you please help me that what would be the possible causes of the error.
    Thanks,
    Mainak

    Hi,
    Its clear now.
    Merci
    MFH

  • I_oi_document_proxy - open_document_from_table

    Hello everybody,
    I would like to show an intern table from ABAP in Excel and afetr change save data in table. I try to use the method
    i_oi_document_proxy ->open_document_from_table but it not woks correct. The data are not correct in columns and rows assigned. Can anybody give me a tip or a link to tutorial?
    Regards
    Bogdan

    Hi Jonathan,
    I have analized the SAPRDEMO_SPREADSHEET_INTERFACE Programm. The transfer of data with use the Interface methode get_ranges_data works fine. But when I try use this method in event handler for close_event it return an error code INTERFACE_NOT_SUPPORTED. I suppose that first the sheet is destroyed und then is event fired (during handlig sheet exist no more).
    regards
    Bogdan

  • Excel remains in memory after using by DOI.

    Hi.
    I'm trying to use DOI but
    Excel instance remains in memory after I have run macro and leave program. If I don't run any macro - everything is Ok.
    I run macro by this way:
        CALL METHOD document->execute_macro
          EXPORTING
            macro_string = 'MyMacro'
            param_count  = 0
          IMPORTING
            error      = error.
    Before leaving the program I release DOI objects as in demo
        IF NOT documentproxy IS INITIAL.
          CALL METHOD documentproxy->close_document.
          CALL METHOD c_oi_errors=>show_message
            EXPORTING
              type = 'E'.
          FREE documentproxy.
        ENDIF.
        IF NOT olecontrol IS INITIAL.
          CALL METHOD olecontrol->destroy_control.
          FREE olecontrol.
        ENDIF.
    Thanks for your help.
    Mike Menkov.

    Hello, long time no see,
    but anyway, executing a macro prevents excel then to be closed over ole, as i've tried many ways to get it done, here is a work-around.
    it's frustating that I cannot use excel as Inplace there, because users could then easily USE or even UPLOAD their own excel-spreadsheets over the custom control with the use of ALV-Grid firstly, wich is really nice. Because of this 'bug', (i think it definitely is one, but don't know on wich side, MS or SAP) excel-spreadsheet functionality over ALV-Grid imho simply cannot be used fine with spreadsheets containing 'bigger' macros which where executed over ole - in eo_start_macro.
    For closing this issue, I just wanted to add how I could 'overcome' the sympthoms of this still remaining temp-files (+excel holding them open) when using excel + ole automation over SAPGUI:
    You could just NOT use excel "Inplace" on a custom control of a dynpro, but outside SAP, still OLE-driven.
    Start it in foreground guarantees you can close the temp-file with or without saving at a time and not surprisingly at the end on shutdown, because the controls of excel (and excel as a whole) are visible anytime - ole automation works also fine this way.
    This is the order of preparing excel and setting data into it i've done it, therefore i've created a single include for all the excel-ole stuff:
    (complete source could be looked up at http://pastebin.com/zmr6xdZm)
    1.eo_get_templ_uri
    2.eo_build_spreadsheet_interface - goes ahead with parameter inplace_enabled = SPACE
    3.eo_build_named_area
    4.eo_set_data_into_sheet
    5.eo_start_macro
    after the data is sent to excel (+ the macro on the spreadsheet has done it's job), excel is holding the filled temp file (spreadsheet) in foreground, so users can directly close it with- or without saving.
    *** using inplace_enabled = SPACE here, on Initializing the control
    CALL METHOD cl_control->init_control
       EXPORTING
         inplace_enabled          = ' '
         no_flush                 = 'X'
         INPLACE_SHOW_TOOLBARS    = insert_toolbar
         r3_application_name      = sy-cprog
         parent                   = cl_container
       IMPORTING
         error                    = error
       EXCEPTIONS
    *          javabeannotsupported     = 1  " ex. nicht im Minisap
         OTHERS                   = 2.
    *** and on Load document from BOR
         CALL METHOD cl_document->open_document
         EXPORTING
           "startup_macro    = 'DieseArbeitsmappe.start' "funkt nicht
           document_title = sy-cprog
           document_url   = doc_url
           no_flush       = 'X'
           open_inplace   = '  '
         IMPORTING
           retcode          = soiret
           error          = error.
         APPEND error TO t_errors.
       ENDIF.
    Cheers,
    David

  • Modify excel sheet from BDN/GOS and add to sales order

    Hello,
    Iu2019ve import a excel-template in OAOR (BDN) and now i want to modify the excel-sheet with my own data.
    After then I want to put it to a Sales Order (BUS2032).
    The excel sheet must indicated in the attachment list of VA02 (GOS).
    Which method I must use to copy a existing excel sheet from BDN?
    How can i modify my excel sheet from BDS and add to a existing sales order?
    Can I set the document write protected?
    Can anyone help me or have any examplesu2026
    Thanks in advance
    Edited by: Thomas Druetschel on Dec 2, 2008 3:20 PM

    Hello,
    now i can get a template from BDN and modify the excel sheet. But i want to modify the excel spreadsheet in BACKGROUND ==> have anybody a idea?
    And i need the correct method to save the modified document to BDS...
    Thanks
    i use the following code:
    TYPE-POOLS: sbdst.
    DATA go_control TYPE REF TO i_oi_container_control.
    DATA go_docking_container TYPE REF TO cl_gui_docking_container.
    DATA go_document_proxy TYPE REF TO i_oi_document_proxy.
    DATA go_excel_iface TYPE REF TO i_oi_spreadsheet.
    DATA go_error TYPE REF TO i_oi_error.
    DATA gc_exceltype TYPE soi_document_type VALUE soi_doctype_excel_sheet.
    DATA gv_retcode TYPE soi_ret_string.
    DATA gv_sheetname TYPE soi_string.
    DATA gv_inplace TYPE c.
    DATA: gv_value TYPE string.
    START-OF-SELECTION.
      PERFORM open_excel_doc_from_bds
                  USING
                      'BUS2032'
                      'BO'
                      '0010163117'
      PERFORM fill_cell
                  USING
                      'TEST123'
                      '1'
                      '2'.
    ==>> Now i want to SAVE the modified Excel Spreadshet to another Sales Order...
    *&      Form  init_excel_proxy
          text
         -->UV_INPLACE text
    FORM init_excel_proxy USING uv_inplace TYPE c.
      DATA lv_repid TYPE sy-repid.
      DATA lv_dynnr TYPE sy-dynnr.
      DATA lv_str   TYPE soi_string.
      lv_repid = sy-repid.
      lv_dynnr = sy-dynnr.
      CALL METHOD c_oi_container_control_creator=>get_container_control
        IMPORTING
          control = go_control
          error   = go_error.
      CREATE OBJECT go_docking_container
        EXPORTING
          repid     = lv_repid
          dynnr     = lv_dynnr
          side      = cl_gui_docking_container=>dock_at_bottom
          extension = 0.
    I don´t want to modify the document in the front*
      CALL METHOD go_control->init_control
        EXPORTING
          r3_application_name = ' '
          inplace_enabled     = uv_inplace
          parent              = go_docking_container
        IMPORTING
          error               = go_error.
      CALL METHOD go_control->get_document_proxy
        EXPORTING
          document_type  = gc_exceltype
        IMPORTING
          document_proxy = go_document_proxy.
    ENDFORM.                    " init_excel_iface
    *&      Form  open_excel_doc_from_bds
          text
         -->UV_CLASSNAME  text
         -->UV_CLASSTYPE  text
         -->UV_OBJECTKEY  text
         -->UV_INPLACE    text
    FORM open_excel_doc_from_bds USING uv_classname TYPE sbdst_classname
                                       uv_classtype TYPE sbdst_classtype
                                       uv_objectkey TYPE sbdst_object_key
                                       uv_inplace TYPE c.
      DATA lt_doc_uris TYPE sbdst_uri.
      DATA ls_doc_uri LIKE LINE OF lt_doc_uris.
      DATA lt_doc_signature TYPE sbdst_signature.
      DATA lv_doc_url TYPE bapiuri-uri.
      DATA lv_repid TYPE sy-repid.
      DATA lv_dynnr TYPE sy-dynnr.
      IF go_document_proxy IS INITIAL.
        PERFORM init_excel_proxy USING uv_inplace.
      ENDIF.
      CHECK NOT go_document_proxy IS INITIAL.
      CALL METHOD cl_bds_document_set=>get_with_url
        EXPORTING
          classname       = uv_classname
          classtype       = uv_classtype
          object_key      = uv_objectkey
        CHANGING
          uris            = lt_doc_uris[]
          signature       = lt_doc_signature[]
        EXCEPTIONS
          nothing_found   = 1
          error_kpro      = 2
          internal_error  = 3
          parameter_error = 4
          not_authorized  = 5
          not_allowed     = 6.
      IF sy-subrc NE 0 .
        MESSAGE 'cl_bds_document_set=>get_with_url error' TYPE 'I'.
        EXIT.
      ENDIF.
      READ TABLE lt_doc_uris INTO ls_doc_uri INDEX 1.
      lv_doc_url = ls_doc_uri-uri.
      CALL METHOD go_document_proxy->open_document
        EXPORTING
          document_url  = lv_doc_url
          open_inplace  = uv_inplace
          open_readonly = ''
        IMPORTING
          error         = go_error.
      IF NOT go_excel_iface IS INITIAL.
        FREE go_excel_iface.
      ENDIF.
      CALL METHOD go_document_proxy->get_spreadsheet_interface
        EXPORTING
          no_flush        = 'X'
        IMPORTING
          sheet_interface = go_excel_iface
          error           = go_error.
    ENDFORM.                    "open_excel_doc_from_bds
    *&      Form  fill_cell
          text
         -->UV_VALUE   text
         -->UV_COLUMN  text
         -->UV_ROW     text
    FORM fill_cell USING uv_value TYPE string
                         uv_column TYPE i
                         uv_row TYPE i.
      CHECK NOT go_document_proxy IS INITIAL.
      CHECK NOT go_excel_iface IS INITIAL.
      DATA: lt_ranges TYPE soi_range_list,
            lt_contents TYPE soi_generic_table,
            ls_contents LIKE LINE OF lt_contents[],
            lt_rangesdef TYPE soi_dimension_table,
            ls_rangesdef LIKE LINE OF lt_rangesdef.
      ls_rangesdef-row = uv_row.
      ls_rangesdef-column = uv_column.
      ls_rangesdef-rows = 1.
      ls_rangesdef-columns = 1.
      APPEND ls_rangesdef TO lt_rangesdef.
      ls_contents-row = 1.
      ls_contents-column = 1.
      ls_contents-value = uv_value.
      APPEND ls_contents TO lt_contents.
      CALL METHOD go_excel_iface->set_ranges_data
        EXPORTING
          ranges    = lt_ranges[]
          contents  = lt_contents[]
          rangesdef = lt_rangesdef[]
          no_flush  = 'X'
        IMPORTING
          error     = go_error.
    ENDFORM.                    "fill_cell
    *&      Form  get_cell
          text
         -->UV_COLUMN  text
         -->UV_ROW     text
         -->CV_VALUE   text
    FORM get_cell USING  uv_column TYPE i
                         uv_row TYPE i
                  CHANGING cv_value.
      DATA: lt_ranges TYPE soi_range_list,
          lt_contents TYPE soi_generic_table,
          ls_contents LIKE LINE OF lt_contents[],
          lt_rangesdef TYPE soi_dimension_table,
          ls_rangesdef LIKE LINE OF lt_rangesdef.
      ls_rangesdef-row = uv_row.
      ls_rangesdef-column = uv_column .
      ls_rangesdef-rows = 1.
      ls_rangesdef-columns = 1.
      APPEND ls_rangesdef TO lt_rangesdef.
      CALL METHOD go_excel_iface->get_ranges_data
        EXPORTING
          rangesdef = lt_rangesdef[]
        IMPORTING
          contents  = lt_contents[]
          error     = go_error
        CHANGING
          ranges    = lt_ranges[].
      cv_value = space.
      READ TABLE lt_contents INTO ls_contents INDEX 1.
      IF sy-subrc = 0.
        cv_value = ls_contents-value.
      ENDIF.
    ENDFORM.                    "get_cell
    *&      Form  insert_table
          text
         -->COLUMN     text
         -->ROW        text
         -->CT_DATA    text
         -->ANY        text
    FORM insert_table USING column TYPE i
                            row TYPE i
                      CHANGING ct_data TYPE table any.
      CHECK NOT go_document_proxy IS INITIAL.
      CHECK NOT go_excel_iface IS INITIAL.
      CALL METHOD go_excel_iface->insert_range_dim
        EXPORTING
          name     = 'Table'
          top      = row
          left     = column
          rows     = 1
          columns  = 1
          no_flush = 'X'
        IMPORTING
          error    = go_error.
      DATA: lt_fields_table TYPE soi_fields_table.
      CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'
        TABLES
          data   = ct_data[]
          fields = lt_fields_table.
      go_excel_iface->insert_one_table(
        EXPORTING
          data_table   = ct_data[]
          fields_table = lt_fields_table[]
          rangename    = 'Table'
          no_flush     = 'X'
          wholetable   = 'X'
        IMPORTING
          error        = go_error
    ENDFORM.                    "insert_table=

  • SAP Office Integration Excel 2013 problem - dummy window pops up with inplace

    Hi experts all around the globe,
    we are facing a strange problem by some of our users since they have installed Excel 2013 on their PCs. An annoying Excel sheet pops up while generating an excel file in the background.
    They are working with several Y (or Z if you like it better so) transactions, and create multiple Excel files (Excel.Sheet.8 -> .xls) in the background. The programs are using Office Integration (interfaces I_OI_CONTAINER_CONTROL and I_OI_DOCUMENT_PROXY) to create the files.
    Method OPEN_DOCUMENT is called with the parameter OPEN_INPLACE, modified, and then closed with the CLOSE_DOCUMENT method, then saved with SAVE_DOCUMENT_TO_URL. The document gets only assigned to a dummy container, this means under normal circumstances the user shouldn't see anything - the file gets created, modified and stored in the background - end of the story. The programs are like 10 years old, and have been doing good since then.
    Now some of our users reported, that they have an issue when generating Excel files with those programs. We have investigated / debugged, and here is the thing: in several cases when the method OPEN_DOCUMENT is called, an empty worksheet pops up (see attached screenshot). It also gets in focus, and then in 1 sec is it closing again (as the CLOSE_DOCUMENT is called). This is really annoying when the user has to generate hundreds of Excel sheets (it is quite often the case). The window gets opened and closed with every single file that gets created.
    We have tried to identify the problem, but it is user independent, the SAP GUI, Office and Windows versions seem to be all the same - though it appears by some users. The most of us work with SAP GUI 730 Patch level 4, but upgrade to Patch level 9 has also not solved the problem. We have found the notes 1908528 and 1804535. They address similar problems but not exactly the same. We think it has something to do with incompatibility of the releases, or simply an Office / SAP setting we could not think of.
    Has someone encountered the same? Any ideas?
    Your help is greatly appreciated.
    Boldi

    Hello Daniel,
    thank you very much for your reply, it is really appreciated.
    We have SAP GUI 7.30 Version 7300.3.9.1084 Build 1496147 Patch Level 9 on the test machine. This one should be the latest available version, am I right?
    The issue is a little bit different from the ones described in the SAP notes you suggested. The data is getting "correctly" displayed inplace, but Excel is also getting called up in the same time, and an additional emtpy sheet is displayed, which gets in the focus, disturbing the user. It is just like described in the SAP notes 1425448 and 1567380
    To 1425448 (Solution Point 2 below): this is our standard setting, and it does not help us.
    To 1567380 (Prerequisites): there is no macro in our sheet.
    We could reproduce the issue with the standard report SAPRDEMO_SPREADSHEET_INTERFACE (this is the one suggested in SAP note 1908528 - "Verifying that Excel inplace functionality is working correctly"). The SAP GUI overtakes the focus after a while, as described in the SAP note 1567380, but the empty sheet is active at first, and it is a little bit more than annoying.
    How is it on your side, could you please run the standard report (EXCEL, checkbox for inplace set, then Enter) to confirm that the problem exists?
    Thanks a lot in advance and have a nice day!
    Boldi

  • Manuel Page Breaks / Excel Output

    Hello,
    I did a report which opens an Excel Sheet "inplace" to output the data. Therefore I used the interfaces "i_oi_spreadsheet" and "i_oi_document_proxy". Unfortunately these interfaces do not provide me with a possibility to insert a manual page breaks into the Excel Sheet.
    I tried to do it directly with OLE but without success so far. Does anybody have an idea, how I can insert the manual page breaks.
    Many thanks for the help
    Daniel

    To get the same page breaks, you must use
    the same paper size,
    the same margins
    the same headers/footers, the same row heights
    the same columns widths
    the same fonts so that there is no extraneous wrap in dome cells.
    From my point of view it's something like "Hercules's works'.
    If you nead identical layout, use the same app in both worlds.
    Yvan KOENIG (VALLAURIS, France) samedi 10 octobre 2009 19:28:19

  • No "file - send to" with excel inplace

    In excel (Version excel 97) I can send files via "file - send to - email" which starts my email client and attaches the xls file to the mail.
    When I use excel inplace in an abap program this option is not available. I still can see it, but it is grey and I cannot choose it
    Is it possible to activate this options? I use the methods of desktop office integration to get excel inplace and fill it with data (i_oi_container_control,  i_oi_document_proxy, i_oi_spreadsheet).
    regards
    Herbert

    USB Thumb drive?
    Patrick

Maybe you are looking for