Execute query in background and write it's content in transparent table

Hi,
Is there an easy way to execute one query in background and write it's content in transparent table?
Thanks,

Hello,
Yes you can do this in so mamy ways...
GOTO RSCRM_REPORT -> select your query -> click on the extract button and set the parameters...table or file Execute.
Create an APD in RSANWB select your query and you can store the result in ODS table...cube...
Create a reporting agent and store the result.
Regards,
Pavan.

Similar Messages

  • Execute Query in Background get notified per email

    Hello together,
    In a project we use BSP's to select variable values in a more comfortable way compared to the SAP Standard variable screen.
    For some long-running queries (e.g. show all line items in the ODS where the item text contains keyword 'XXX') our users want a button to calculate the query in background and to be notified per email containing the corresponding link as soon as the result is available.
    We use BW 3.5, so Information Broadcasting is available, but this does not really solve the problem.
    In the Broadcaster, you can specify the variables using the SAP standard variable screen. But of course we want to use our BSP's. In addition, we first want to specify the variable values before we decide whether to run the query online or in batch. And finally, running the query in the background should be a one-click action. This is not possible with Information Broadcasting.
    Does somebody know a solution for this problem.
    I assume it can be reduced to some magic FB's and methods that have to be called from the BSP to get what we want.
    Thanks for your help.
    Juergen

    HI Alex,
    Could you please help me with the solution. I have a similar requirement where I have to execute the query or workbook in background via a process chain.
    Thanks in advance.
    Rgds,
    Sree.

  • How to find last executed query on database and or schema.

    hi,
    how to find last executed query on database and or schema.
    yours sincerely

    Sessionwise if you wanna see means use v$session.. Because it will show execution time also so you can analyze it easily and get sql based on SID and serial number ..
    Try :
    select * from v$session;
    Regards..

  • Read and write data from content repository .

    Hi All,
    We are using content repository to store some document and images on web center server .
    So we have created/setup a content repository on web center .
    Please proivde me some documnet /wiki page to get some idea how can i read and write date in
    content repository .
    You are most welocme to provide some idea /suggestion .
    Thanks,
    Arun.

    Have you already configured webcenter spaces so it can use content server?
    Have you installed the content server seperatly from webcenter or as a part of the webcenter installation?
    Check if you have the webcenter spaces component installed in content server because without i don't think it will work...
    If you already have configured UCM to work with spaces it's quiet easy.
    From your groupspace, open the settings page of your groupspace. Go to the services tab. In the left hand side you can enable the documents services. WHen you have done that, you are able to add the document services taskflows to your pages. Just go to a page in your pagegroup and edit it. Open the resource catalog and you will find some extra taskflows you can add.
    If you haven't configured UCM and webcenter to work together, here some steps that will help you:
    * Integrating UCM with Spaces
         * They both need to use the same LDAP store.
         * Since there is no LDAP server available, we choose for embedded WLS LDAP.
         * Integrating the ucm into apache
              * Stop UCM
              * In /oracle/product/wls10320/WebCenter/ucm/config/config.cfg, check the SocketHostAddressSecurityFilter to contain 127.0.0.1
              * Add the SocketHostAddressSecurityFilter to /oracle/product/wls10320/WebCenter/ucm/admin/bin/intradoc.cfg
              * Add to /oracle/product/wls10320/WebTier/instances/instance1/config/OHS/ohs1/httpd.conf
                   include /oracle/product/wls10320/WebCenter/ucm/data/users/apache22/apache.conf
              * Change the mod_wl_ohs.conf file to
                   <IfModule weblogic_module>
                         WebLogicHost localhost
                         WebLogicPort 7001
                         Debug ON
                         WLLogFile /tmp/weblogic.log
                   </IfModule>
                   <Location /webcenter>
                      SetHandler weblogic-handler
                      WebLogicCluster localhost:8888
                   </Location>
                   <Location /webcenterhelp>
                      SetHandler weblogic-handler
                      WebLogicCluster localhost:8888
                   </Location>
                   <Location /owc_discussions>
                      SetHandler weblogic-handler
                      WebLogicCluster localhost:8890
                   </Location>
                   <Location /em>
                      SetHandler weblogic-handler
                   </Location>
                   <Location /console>
                      SetHandler weblogic-handler
                   </Location>
                   <Location /consolehelp>
                      SetHandler weblogic-handler
                   </Location>
              * Restart UCM & WebTier
              * Test URL: http://yourServer:7777/idc
         * Configure the Identity Store for UCM & WebCenter
              * Set the password for the embedded ldap in WLS
                   Console => Domain Name => Security tab => Embedded LDAP tab => reset credentials
              * Restart AdminServer
              * Stop UCM
              * Add the following to /oracle/product/wls10320/WebCenter/ucm/config/jps-config.xml
                      <serviceInstance name="idstore.oid" provider="idstore.ldap.provider">
                          <property name="subscriber.name" value="ou=myrealm,dc=webcenter_domain"/>
                          <property name="idstore.type" value="WLS_OVD"/>
                          <property name="security.principal.key" value="ldap.credential"/>
                          <property name="security.principal.alias" value="JPS"/>
                              <property name="ldap.url" value="ldap://yourServer:7001"/>
                          <extendedProperty>
                              <name>user.search.bases</name>
                              <values><value>ou=people,ou=myrealm,dc=webcenter_domain</value></values>
                          </extendedProperty>
                          <extendedProperty>
                              <name>group.search.bases</name>
                              <values><value>ou=groups,ou=myrealm,dc=webcenter_domain</value></values>
                          </extendedProperty>
                          <property name="username.attr" value="uid"/>
                          <property name="user.login.attr" value="uid"/>
                          <property name="groupname.attr" value="cn"/>
                      </serviceInstance>
              * In the same file, change the serviceInstanceRef ref="idstore.ldap" to "idstore.oid"
              * Go to /oracle/product/wls10320/WebCenter/ucm/custom/FustionLibraries/tools
              * ./run_credtool.sh
                   Alias: default
                   Key: default
                   User Name: cn=Admin
                   Password: weblogic123
                   JPS Config: default
              * Start UCM
              * Check Provider:
                   * Go to http://yourServer:7777/idc
                   * Login : sysadmin/idc
                   * Administration -> Providers
                   * jpsuser should be good
                   * When a ldapuser exist, disable it!!
         * Configuring UCM for content search
              * Change the file /products/WebCenter11gR1/WebCenter/ucm/config/config.cfg
                  SearchIndexerEngineName=DATABASE.METADATA to SearchIndexerEngineName=DATABASE.FULLTEXT
              * Restart UCM server
              * Run the /products/WebCenter11gR1/WebCenter/ucm/database/oracle/admin/batchsnippet.sql in the wcbepsc_ocserver schema
              * Restart UCM server
              * Open the /products/WebCenter11gR1/WebCenter/ucm/bin/RepositoryManager (sysadmin/idc)
              * Recreate the indexes
         * Registering UCM with WebCenter
              * Go to http://yourServer:7777/em
              * Login with weblogic/weblogicPassword
              * Go to WebCenter - WebCenter Spaces - webcenter (WLS_Spaces)
              * From the top menu, select Settings - Service Configuration     
              * Select Content Repository
              * Add
                   Connection Name: ucm_connection
                   Repository Type: Oracle Content Server
                   Active Connection: checked
                   Administrator User Name: sysadmin
                   Root Folder: /WebCenterSpaces
                   Application Name: Spaces
                   CIS Socket Type: Socket
                   Server Host: localhost
                   Server Port: 4444
                   Authentication Method: Identity Propagation
              * Restart WLS_Spaces
         * Test the connection by creating a new group space and upload a document to the document page of this group spaceHope this helps.

  • Executing query in background : EXPORT_NO_SHARED_MEMORY

    Hi,
    I am using reporting agent to execute the query in background.The actual requirment is to print the report and send the report as mail after the triggeting of an event by a ABAP program.We want the same report to run with 9 different varints at the of trigger of this event.
    Let me explain what I have done.
    1.I went to reporting agent-->print
    2.Created 9 settings for the report
    3.Added all these settings in a package
    4.scheduled the package to run after the triggering of the event
    Now the job that executes the report in backgroung gets cancelled with error
    "ABAP/4 processor: EXPORT_NO_SHARED_MEMORY"
    When I checked the spool ,it showed result of the report with one variant.
    Is it because I have assigned the alll settinmgs under a single package ?
    Also can some one tell me about mailing the output  to the user?

    Hi Fazil,
    It sounds like a system problem. You might want to ask Basis people to help you. You can check trx ST22 or SM21 to get any log..
    Hope this helps.
    Regards,
    Diego

  • Problem in executing query in browser and bex analyzer

    i am not able to execute query in browser nor bex analyzer...
    problem is that i dont have option to run in bex analyzer in query designer (menu bar seems missing in query designer and how can i get enabled
    and when execute the query in browser using bex query designer ..it prompts me with following error
    URL http://saperpdev.saperpdev.com:8002/sap/bw/BEx call was terminated because the corresponding service is not available
    Note
    ■The termination occurred in system ERD with error code 403 and for the reason Forbidden.
    ■The selected virtual host was 0
    ErrorCode:ICF-NF-http-c:000-u:SAPSYS-l:E-i:SAPERPDEV_ERD_02-v:0-s:403-r:Forbidden
    and i tried to open the query from bex analyzer  level
    it prompts me as follows
    macros are disabled because the security level is set to high and digitally signedtrusted certificate is not attached to the macros,to run the macros change the security level to lower settings
    pls suggest me

    hi suman,
    thanks for your response.. but let me be more clear
    i am using sap gui 7.20 front end and when i execute rrmx i am able to navigate to BEx analyzer but when i tried to open a report which i create i get following error message..
    you do not have sufficient authorization for infoprovider zic_proj
    function module  /SDF/AL_MAP_TRANSID_LOGH doesnt exit
    second thing is that i tried from bex query designer to execute the report ..but i am not able to execute the report...
    i hope some connections seems missing..please let me know what to do ASAP..
    and where can i post this question to get fast reply

  • How to cancel a query when execute query builtin fire and No Records found.

    Hi,
    I am unable to cancel a query when i make query (fire enter-query) then fire (execute-query) and no records found then the form status is enter-query mode. Plz help me that how can i back to normal mode of form.
    here i use the code for coming back to enter-query to normal mode but no results.
         if :system.mode = 'ENTER-QUERY' THEN
    ABORT_QUERY;
         clear_form;          
         END IF;
    thanks in advance....

    Hello,
    I would test the record status of the first record in the block. If this status is 'NEW', then there is no record retrieved, so that you can exit the query mode with exit_form()
    Francois

  • Query in background and mail

    we have a user who executes some three queries daily with fixed selection criteria . since
    the queries are based on top of a remote cube and are slow , we were thinking of scheduling them
    in the Background and setting them to go to the user's email daily at a specified time . I know
    all this is possible with reporting agent , can anyone provide me with the steps to do this ?
    thanks all
    oooooops

    Hi,
    If you are using version below 3.5 then reporting agent can help you in precalculation, I don;t think it can be mailed ( until there are some exceptions)
    with BW 3.5 & above - use information broadcasting features.
    hope it helps
    Regards
    Vikash

  • How to read and write data to a user defined table?

    I have created a srf with 2 edit box and a ok buttin, I want to insert data to the user defined table i created using sql query while i press OK button..
    Please provide the complete code to insert and select da from the user defined table.

    Hi,
    You can use the code below.
    Dim ret As Long
    d
    Private Sub Add_Table_Click()
        Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
        Set oUserTablesMD = oCompany.GetBusinessObject(oUserTables)
        ' When adding user tables or fields, use a prefix
        ' identifying your partner name space. This will
        ' prevent collisions from different partner add-ons
        ' SAP's name space prefix is "BE_"
        'Set the two mandatory fields
        oUserTablesMD.TableName = "T1"
        oUserTablesMD.TableDescription = "Table1"
        'Add the table (which contains 2 default, mandatory fields, 'Code' and 'Name')
        ret = oUserTablesMD.Add
        If ret <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Table: " & oUserTablesMD.TableName & " was added successfully"
        End If
    End Sub
    Private Sub Add_UDF_Click()
        Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
        Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)
        oUserFieldsMD.TableName = "T1"
        oUserFieldsMD.Name = "AlbUDF"
        oUserFieldsMD.Description = "Albert UDF"
        'Add the field to the table
        lRetCode = oUserFieldsMD.Add
        If lRetCode <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Field: '" & oUserFieldsMD.Name & "' was added successfuly to " & oUserFieldsMD.TableName & " Table"
        End If
    End Sub
    Private Sub Add_Data_Click()
        Dim oUserTable As SAPbobsCOM.UserTable
        Set oUserTable = oCompany.UserTables.Item(1)
        oUserTable.GetByKey ("T1")
        'Set default, mandatory fields
        oUserTable.Code = "A"
        oUserTable.Name = "Albert"
        'Set user field
        oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"
        oUserTable.Add
        If ret <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
        End If
    End Sub
    Regards,
    Noor

  • Drag and Drop of cell content between 2 tables

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Execute query in mapping and map the result to next field in target

    Hi Guys,
    Doing file to jdbc Scenario.
    source:
    root:
      row
           sf1
    target:
    root:
        row
           target1
           target2
    I have requirement as:
    I have to map sf1 to target1 ( I do not have any problema in it)
    target2 field must populate basing upon query which results. this should run with the input parameter sf1. If the query results then update target2 else update with MESSAGE_DONE.

    Hi Swarna,
    What kind of query do you mean? In certain cases, it might be worthwhile to consider ABAP mapping, which seems to be the easiest way to do some sequential steps, especially for such a simple message structures.
    Hope this helps,
    Grzegorz

  • Powershell use Connection String to query Database and write to Excel

    Right now I have a powershell script that uses ODBC to query SQL Server 2008 / 2012 database and write to EXCEL
    $excel = New-Object -Com Excel.Application
    $excel.Visible = $True
    $wb = $Excel.Workbooks.Add()
    $ws = $wb.Worksheets.Item(1)
    $ws.name = "GUP Download Activity"
    $qt = $ws.QueryTables.Add("ODBC;DSN=$DSN;UID=$username;PWD=$password", $ws.Range("A1"), $SQL_Statement)
    if ($qt.Refresh()){
    $ws.Activate()
    $ws.Select()
    $excel.Rows.Item(1).HorizontalAlignment = $xlCenter
    $excel.Rows.Item(1).VerticalAlignment = $xlTop
    $excel.Rows.Item("1:1").Font.Name = "Calibri"
    $excel.Rows.Item("1:1").Font.Size = 11
    $excel.Rows.Item("1:1").Font.Bold = $true
    $filename = "D:\Script\Reports\Status_$a.xlsx"
    if (test-path $filename ) { rm $filename }
    $wb.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx)
    $wb.Saved = $True #flag it as being saved
    $wb.Close() #close the document
    $Excel.Quit() #and the instance of Excel
    $wb = $Null #set all variables that point to Excel objects to null
    $ws = $Null #makes sure Excel deflates
    $Excel=$Null #let the air out
    I would like to use connection string to query the database and write results to EXCEL, i.e.
    $SQL_Statement = "SELECT ..."
    $conn = New-Object System.Data.SqlClient.SqlConnection
    $conn.ConnectionString = "Server=10.10.10.10;Initial Catalog=mydatabase;User Id=$username;Password=$password;"
    $conn.Open()
    $cmd = New-Object System.Data.SqlClient.SqlCommand($SQL_Statement,$conn)
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1))
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    How would I read the columns and data for $sql_output into an EXCEL worksheet. Where do I find these tutorials?

    Hi Q.P.Waverly,
    If you mean to export the data in $sql_output to excel document, please try to format the output with psobject:
    $sql_output=@()
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output+=New-Object PSObject -Property @{data1 = $rdr.GetValue(0);data2 =$rdr.GetValue(1)}
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    Then please try to use the cmdlet "Export-Csv" to export the data to excel like:
    $sql_output | Export-Csv d:\data.csv
    Or you can export to worksheet like:
    $excel = New-Object -ComObject Excel.Application
    $excel.Visible = $true
    $workbook = $excel.Workbooks.Add()
    $sheet = $workbook.ActiveSheet
    $counter = 0
    $sql_output | ForEach-Object {
    $counter++
    $sheet.cells.Item($counter,1) = $_.data1$sheet.cells.Item($counter,2) = $_.data2}
    Refer to:
    PowerShell and Excel: Fast, Safe, and Reliable
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • Enter and execute query in ADF

    Hi Experts,
    I am trying to implement Enter-Query/Execute-Query in adf and using Jdev 11.1.2.2.0. I put Find and execute operation on the form. When i press execute button i says me to enter value for mandatory fields. But i am try to execute query not trying to create or update records. In forms we can query on any attribute.
    Please guide
    Thanks

    Enter and execute query in Oracle Forms starts with a simple row by row form for updating a table. When you press the "Enter Query" button, the form clears and the user can enter query by example criteria for any of the fields on the form. Then the user presses the "Execute Query" button, and is back in the update form, but with the data for the first matching row shown.
    Here is a page with some links to articles by Steve Muench that explains some ways to implement this in ADF 10.1.3 - I think these techniques should still work in ADF 11g:
    http://radio-weblogs.com/0118231/2006/02/13.html#a658
    Another way with ADF 11g might be to put an af:query component in one facet of an af:switcher and the update form in the other facet. The Enter Query button on the update form tells the switcher to switch to the query facet, and executing the query also tells the switcher to switch back to the update form.

  • Authorization issue to execute query via analyzer

    Dear,
    We are experiencing an authorization issue that we can not solve...
    We have grant to user the expected objects to execute query (S_RS_COMP & S_RS_COMP1) and the central objects like S_GUI, S_USER_AGR.
    When we test in RESCEADMIN, everything is fine. We can execute the query.
    When we test it in the analyzer, the variable screen does not pop-up and we get the error message:
    "There is no variable in the workbook, which allows user input"
    Does anybody have a direction to help us to orientate our investigation?
    Many thanks,
    Rodolphe

    Hello,
    What is the basic settings you have in the Query Properties basic setting tab
    Try making it mandatory
    Regards
    Nitin Bhatia

  • Why do I get a table read error in DB Tools Execute Query.vi

    Hello all,
    I am using LV8 and the database connectivity toolkit.  I can connect to my server database and use the "DB Tools List Tables.vi" to pull the list of tables in the database, but when I try to use an sql command into "DB Tools Execute Query.vi" I get a : Error -2147217911 occurred at Conn Execute.vi->DatabaseTest2.vi message.  In the possible reasons it says : Possible reason(s):
    Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'tblShopOrders'. in Conn Execute.vi->DatabaseTest2.vi
    I can open and edit this table with MSAccess.
    Any ideas as to the cause of this error?
    Jim
    Jim
    LV 2013

    Hey Andy,
    Since my first post I have discovered a bit more (not enough yet).  Firstly, I can access all of the tables using MSAccess (causing me to assume that I have the necessary permissions).  I am using the "DB Tools Execute Query.vi" with an SQL query and "DB Tools Fetch Recordset Data.vi" objects to try to get data.  I don't get an error when connecting to the database, but the error occurs at the execute query vi.  The database has a large number of tables, and I discovered that I can retrieve data from some of them using the above method.  I looked into the user and group permissions in the MS access security settings and found that the permissions were checked for all of the tables that I could open, and not for the rest.  I checked them on the ones I want to open, but this didn't help.  I went back into Access and made sure that they were still checked and they were.  And that's as far as I have gotten so far.
    Thank you for any help that you can provide.
    Jim
    Jim
    LV 2013

Maybe you are looking for