How to call excel macros in ODI

Hi gurus,
I am new In ODI please help me with this. i want to store sheet name of excel file in a variable.I have written a macro function for this please help me how to call that macro function in ODI
Thanks & regards

this are my thoughts ,since you will have to deal with multiple files and read multiple sheets . While dealing with Excel ,we have to deal with DSN and so multiple Excel can a be a little complex.
I think we can make use of your macro function by calling via VB and once you find the correct value write a in separate txt File. Now this File can be called in ODI and read and processed as you wish to .
Step 1. Call your Macro Function via VB
Step 2. Call this VB program via OS Command, which write to a separate file.
Step 3. Call this variable and read from the file via this methods http://odiexperts.com/?p=243 , http://odiexperts.com/?p=273.
Does this helps you .

Similar Messages

  • How to call excel macros programmatically in C#?

    Hi,
    I have a requirement where i need to call excel (2003) macros in C# program. Can anyone help me with a code snippet to do the same?
    The excel macro function takes two input parameters? how can the parameters be passed?
    Any code snippet to do the same in C# would be helpful.
    Thanks.

    Hey there, Sid.  I am tryin gto run your code, but I couldn't even gte it to fire.  Here's what I ahve now:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Excel = Microsoft.Office.Interop.Excel;
    namespace WindowsFormsApplication2
        public partial class Form1 : Form
            private void button1_Click(object sender, EventArgs e)
                //~~> Define your Excel Objects
                Excel.Application xlApp = new Excel.Application();
                Excel.Workbook xlWorkBook;
                //~~> Start Excel and open the workbook.
                xlWorkBook = xlApp.Workbooks.Open("C:\\Users\\Ryan\\Desktop\\Coding\\Microsoft Excel\\Work Samples\\Work Samples\\Historical Stock Prices.xlsb");
                //~~> Run the macros by supplying the necessary arguments
                xlApp.Run("ShowMsg", "Hello from C# Client", "Demo to run Excel macros from C#");
                //~~> Clean-up: Close the workbook
                xlWorkBook.Close(false);
                //~~> Quit the Excel Application
                xlApp.Quit();
                //~~> Clean Up
                releaseObject(xlApp);
                releaseObject(xlWorkBook);
            //~~> Release the objects
            private void releaseObject(object obj)
                try
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    obj = null;
                catch (Exception ex)
                    obj = null;
                finally
                    GC.Collect();
    When I hit the play button nothing happens.  When I hot F5 nothing happens.  Do you ahve any idea what I'm doing wrong.  I'd appreciate any advice with this!! 
    Thanks!!
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Call Excel Macros function from Java

    Hi All,
    can u guide me How to call excel macros from java.
    The thing is first I have to enable macros and then call the macors function.
    Is this possible to call from Java. If yes guide me.
    Thanks in Advance

    Seems like something you'd have to do through COM.
    http://sourceforge.net/projects/jacob-project/
    HOW you do that is something you'll really have to figure out yourself, its not a Java question.

  • How to call custom API in ODI

    Hi All,how to call custom API in ODI and how can multiple people run the scenario at same time. I explained my process below
    1. Through ODI console pass parameter (file name) to scenario and read the file form configured location
    2. Insert the data from flat file to custom table
    3. Call custom API
    4. Generating a report in ODI in same location where we read the file from. Creating sample report just reading from custom table
    5. The above design should be such that multiple people can run the scenario at same time.
    can any one help me on step 3 and step 5 how to go forward..
    Thanks in Advance.
    Edited by: 981371 on Mar 4, 2013 3:19 AM

    You can invoke java api in the procedure or KM tasks. You can select Jython technology type and can call the custom java API.
    You may find relevant info at
    http://docs.oracle.com/cd/E23943_01/integrate.1111/e12643/procedures.htm#CHDIDDFE
    http://docs.oracle.com/cd/E23943_01/integrate.1111/e12645/intro.htm#sthref5
    http://docs.oracle.com/cd/E23943_01/integrate.1111/e12645/api_intro.htm#CEGFCFHC
    You can directly put DB functions in the your mapping expressions.

  • How to call Oracle Procedure into ODI

    Hi,
    I'm using ODI 10g.
    Before executing the interface in a package i wanted to place my Procedure.
    I created following procedure in d/b (target)
    CREATE OR REPLACE PROCEDURE TEST_MY_NEW_PROCE
    AS
    BEGIN
    DELETE FROM EMPLOYEE_TABLE
    WHERE EMPLOPYEE_ID LIKE 'P%';
    COMMIT;
    END;
    The Procedure is working fine in target database.
    Now, before executing my interface i would like to run this procedure in my package. So, can some one please help me how to call this oracle procedure (Created in Target schema) into ODI and run this.
    thank you.

    Hi GRK,
    You can create an ODI procedure, add a single step, choose Oracle as Technology and your target schema.
    Then just call it through a pl/sql block :
    BEGIN
    TEST_MY_NEW_PROCE;
    END;Then drag this ODI procedure in your package.
    Regards,
    JeromeFr

  • How to access excel(macros defined) in Infoview?

    Hi All,
    Can anyone help me out to know how to view Excel with Macros in Infoview.
    Regards,
    Anisa

    Hi,
    So you mean to say, I just need to use the ConnectionManager.getConnection() method. It requires a pool connection name. Do I specify the same pool name as in the connectionmanager.xml config file ? And that will do it ? Please clarify. Following is a code snippet. Please verify if this is correct.
    Connection conn = null;
    try
    conn = ConnectionManager.getConnection(poolname);
    if(conn == null) {
    throw new IOException("No such connection found");
    thanks,
    Mainak

  • How to run Excel Macros using JDBC-ODBC

    Hi,
    I want to run the excel macros in the excel file, after I connected to excel file, using JDBC-ODBC bridge.
    How macros treated here?
    Help needed please..........
    - Ramesh

    How to run Excel Macros using JDBC-ODBCYou don't.
    As my fuzzy understanding goes.....
    Macros (excel, word, etc) run via a "OLE" extension of the script host system.
    So the only way to run them is via the OLE interface. That has nothing to do with ODBC. You can write your own JNI to do that, or you might get lucky and find that someone else has written a java library to do it for you.

  • How to run excel macro from ole

    hi to all experts.
    i need to run excel macro from ole

    Hi,
    *& Report  ZKC_TEST
    *& Description: Fancy report output in XL
    *&Programmer: Krishna Chauhan
    *&Date:       20 Feb 09
    REPORT  ZKC_TEST.
    * INCLUDES                                            *
    INCLUDE ole2incl.
    *&   TYPES                                            *
    TYPES: BEGIN OF ty_marc,
           matnr TYPE marc-matnr,
           werks TYPE marc-werks,
           pstat TYPE marc-pstat,
           lvorm TYPE marc-lvorm,
           ekgrp TYPE marc-ekgrp,
           END OF ty_marc.
    TYPES: BEGIN OF ty_titles,
           title(20) TYPE c,
           field(20) TYPE c,
           END OF ty_titles.
    *&   INTERNAL TABLES                                  *
    DATA: t_marc TYPE STANDARD TABLE OF ty_marc,
          t_titles TYPE STANDARD TABLE OF ty_titles.
    *&   FIELD-SYMBOLS                                    *
    FIELD-SYMBOLS: <fs_marc>   LIKE LINE OF t_marc,
                   <fs_titles> LIKE LINE OF t_titles,
                   <fs> TYPE ANY.
    *&   VARIABLES                                        *
    DATA: w_tabix TYPE sy-tabix,
          w_titles TYPE sy-tabix,
          w_line TYPE sy-tabix,
          w_field TYPE string,
          filename TYPE string,
          path TYPE string,
          fullpath TYPE string.
    DATA: data_titles TYPE REF TO data.
    DATA: e_sheet TYPE ole2_object,
          e_activesheet TYPE ole2_object,
          e_newsheet TYPE ole2_object,
          e_appl TYPE ole2_object,
          e_work TYPE ole2_object,
          e_cell TYPE ole2_object,
          e_color TYPE ole2_object,
          e_bold TYPE ole2_object.
    *&   SELECTION-SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    PARAMETERS: p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b1.
    *&  START-OF-SELECTION                                *
    START-OF-SELECTION.
      PERFORM get_titles.
      PERFORM get_data.
      PERFORM create_excel.
    *& AT SELECTION-SCREEN                                *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = 'Select archivo'
          default_extension = 'xls'
          file_filter       = '*.xls'
        CHANGING
          filename          = filename
          path              = path
          fullpath          = fullpath.
      IF sy-subrc EQ 0.
        p_file = fullpath.
      ENDIF.
    *&      Form  get_titles                              *
    FORM get_titles.
      CREATE DATA data_titles TYPE ty_titles.
      ASSIGN data_titles->* TO <fs_titles>.
      <fs_titles>-title = 'Material'.
      <fs_titles>-field = 'MATNR'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'Plant'.
      <fs_titles>-field = 'WERKS'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'PSTAT'.
      <fs_titles>-field = 'PSTAT'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'Deletion Flag'.
      <fs_titles>-field = 'LVORM'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'EKGRP'.
      <fs_titles>-field = 'EKGRP'.
      APPEND <fs_titles> TO t_titles.
    ENDFORM.                    "get_titles
    *&      Form  get_data                                *
    FORM get_data.
      SELECT matnr werks pstat lvorm ekgrp
      INTO TABLE t_marc
      FROM marc
      WHERE matnr = '000000000001013351'.
    ENDFORM.                    " get_data
    *&      Form  create_excel                            *
    FORM create_excel.
      w_line = 1.
      CREATE OBJECT e_appl 'EXCEL.APPLICATION'.
      SET PROPERTY OF e_appl 'VISIBLE' = 1.
      CALL METHOD OF e_appl 'WORKBOOKS' = e_work.
      CALL METHOD OF e_work 'Add' = e_work.
      GET PROPERTY OF e_appl 'ActiveSheet' = e_activesheet.
      SET PROPERTY OF e_activesheet 'Name' = 'Material Plants'.
      LOOP AT t_marc ASSIGNING <fs_marc>.
        w_tabix = sy-tabix.
        w_line = w_line + 1.
        LOOP AT t_titles ASSIGNING <fs_titles>.
          w_titles = sy-tabix.
          CALL METHOD OF e_appl 'Cells' = e_cell
            EXPORTING
              #1 = 1
              #2 = w_titles.
          SET PROPERTY OF e_cell 'Value' =  <fs_titles>-title.
          GET PROPERTY OF e_cell 'Interior' = e_color.
          SET PROPERTY OF e_color 'ColorIndex' = 35.
          GET PROPERTY OF e_cell 'Font' = e_bold.
          SET PROPERTY OF e_bold 'Bold' = 1.
          CALL METHOD OF e_appl 'Cells' = e_cell
            EXPORTING
              #1 = w_line
              #2 = w_titles.
          CONCATENATE '<fs_marc>-' <fs_titles>-field
          INTO w_field.
          ASSIGN (w_field) TO <fs>.
          SET PROPERTY OF e_cell 'Value' = <fs>.
          GET PROPERTY OF e_cell 'Interior' = e_color.
          SET PROPERTY OF e_cell 'ColumnWidth' = 20.
          SET PROPERTY OF e_color 'ColorIndex' = 0.
          GET PROPERTY OF e_cell 'Font' = e_bold.
          SET PROPERTY OF e_bold 'Bold' = 0.
        ENDLOOP.
      ENDLOOP.
      CALL METHOD OF e_work 'SAVEAS'
        EXPORTING
          #1 = p_file.
      CALL METHOD OF e_work 'close'.
      CALL METHOD OF e_appl 'QUIT'.
      FREE OBJECT e_appl.
    ENDFORM.                    " create_excel

  • How to call HR Macros in ABAP-Webdynpro

    HI all,
    I want to extract HR data in webdynpro view.
    Where should I give Logical Database PNP?
    The ifnotypes key word is not accepting in Webdynpro coding?
    Where should I give GET PERNR event in Webdynpro?
    When I use RP_PROVIDE_FROM_LAST .... says error message
    Statement "RP_PROVIDE_FROM_LAST" is not defined. Check your spelling .
    How to use the Macros in Webdynpro (VIEW) methods.
    First time I'm working in ABAP-HR Webynpro.
    Please help me out..
    Thanks,
    Prasad

    Hi,
    How did u  solve this? pls provide the solution.
    Regards,
    Lakshmi.

  • How to run excel macros using lookout

    Hi,
    I want use Excel macros for generating custom reports.Is it possible to run macros using run object in lookout
    thanks

    Hi,
    I am pretty sure you can activate macros in Excel using the Run object in Lookout. I can think of two ways you can do this:
    1. You can setup your Excel to run macros on startup using the Auto_Activate method. In this case, you will just launch excel with your workbook using the Run object and that should run the macros automatically. No brainer!
    2. To better control as to when the macros are run we can assign in Excel some shortcut keys for their launching. We then would need to simulate these keystrokes to launch our macros. This can be done using the SendKeys method and some scripting, WHS Scripting for instance. See this pos
    t for a scripting example which simulates Alt+Tab keys to bring-to-front an app.
    You will launch the script from the Run object and this in turn launches Excel and then simulates the keys for luanching the appropriate macros. I admit this is kinda involved, but hey it works!
    Hope this helps,
    Khalid

  • How to call a macro(check for unsaved data) before calling refresh button of EPM TAB

    Hi,
    I want to show a popup message for any unsaved data before USER hit the refresh button on EPM tab.
    I write the macro like as below in module
    Function TestForUnsavedChanges()
        If ActiveWorkbook.Saved = False Then
            If MsgBox("There is unsaved data, save the data otherwise u will loose the data. Do You Want to Save the Data ?", vbYesNo, "Warning") = vbYes Then
            bSave = True
            Else
            bSave = False
            Application.Undo
            End If
        End If
    End Function
    so how to execute this macro before Refresh ?
    Thanking in Advance !!

    Hi Nilesh,
    Try to add this macro under Function BEFORE_REFRESH.
    Hope this helps.
    Regards,
    Astha

  • How I call  SAP BAPI IN ODI ?

    Hello
    This is possible in the ODI ?
    ODI make RFC Calls to SAP and Data post to SAP and return status flag /massage to ODI
    Please any one help me.
    Ranjeet
    Edited by: 892937 on 24.10.2011 07:34

    You can invoke java api in the procedure or KM tasks. You can select Jython technology type and can call the custom java API.
    You may find relevant info at
    http://docs.oracle.com/cd/E23943_01/integrate.1111/e12643/procedures.htm#CHDIDDFE
    http://docs.oracle.com/cd/E23943_01/integrate.1111/e12645/intro.htm#sthref5
    http://docs.oracle.com/cd/E23943_01/integrate.1111/e12645/api_intro.htm#CEGFCFHC
    You can directly put DB functions in the your mapping expressions.

  • How to call java program through ODI

    Hi,
    I have written java program which i want to run though ODI.My questions are as follows:
    1. At which place i need to put my code and jar files i.e. do i need to put my code on the machine where ODI is installed?
    2. which technology to use i.e. jython or java bean shell.
    3. Commands format for jython or java bean shell.
    Is there any book or forum to which i could refer to get a deeper knowledge about these as i am new to ODI.
    Thanks
    Abhi

    881195 wrote:
    Hi,
    I have written java program which i want to run though ODI.My questions are as follows:
    1. At which place i need to put my code and jar files i.e. do i need to put my code on the machine where ODI is installed?You need to place the JAR file at ODI's driver folder.
    2. which technology to use i.e. jython or java bean shell.You can use Jython or Java bean shell . I prefer Jython .
    3. Commands format for jython or java bean shell.In your procedure , set the technology to Jython .
    Write normal java commands ... like
    import <your_class_name>
    <you operation etc>
    >
    Is there any book or forum to which i could refer to get a deeper knowledge about these as i am new to ODI.
    Thanks
    Sutirtha

  • How to call WSDL in ODI procedure

    Hi experts,
    Please help me on "how to call web service in ODI procedure"
    Thanks in advance
    Regards
    Phani

    Hi,
    use the OdiInvokeWebService command... take a look into the manual for options reference...
    Does it help you?
    Cezar Santos
    http://odiexperts.com

  • Excecting excel macro

    Hi,
    I have an excel macro, in which the user insert some inputs , press buttons
    and as a result, new file is being generated with list of suppliers.
    I would like to activate this excel application from web dynpro.
    Can someone tell me if it's possible to call excel macro from web dynpro
    and how.
    Thanks,
    Ronit.

    Hi Ronit,
    Open you excel file, go to VB editor (ALT F11).
    Add the following code to "ThisWorkbook"
    Private Sub Workbook_Open()
    your code
    End Sub
    p.s
    You must set the security low (Tools -> Macro -> Security -> Security Level)
    Omri

Maybe you are looking for