Change query in Workbook

Hi,
I want to replace a query in a workbook via VBA. I already managed to replace the references of the query on the hidden sheet SAPBEXqueries. But when I refresh the new query, the textelement are not displayed correctly. Some are missing or   there are addional blank rows.
Regards,
Karen

Hi Karen,
I might know what you are facing.  When you write that you have replaced reference to the old query with reference to the new query in the hidden sheets ...
Did you do anything other than replace the query's server ID in column B?  If not, then any of your structures that are not published as re-useable structures will be messed up.  Since you did not mention this as a problem, I am going to assume that you got this part right.
So, then, if you got the part related to the repository worksheets completely correct, the remaining problem is getting the workbook Names right.  I am not referring to the file name, of course.  I am referring to what some people call "Named Ranges".  There are many of these, as you probably know. 
The easiest way to visualize the names is to the use the sapbexDebugPrint API function.  If you can find that and use it (do a search on this Forum), it is a handy tool to have.  Otherwise, here is my own slightly different version of this.  Once you have visualized the Names, I think you will quickly see where you need to go.
Sub listNames()
Dim nm As Name, ws As Worksheet
Dim wb As Workbook, wbNew As Workbook
    Set wb = ActiveWorkbook
    Set wbNew = Workbooks.Add
    n = 0
    With wbNew.Sheets(1)
    For Each nm In wb.Names
        On Error GoTo errorClear
        n = n + 1
        .Range("A" & n) = nm.Name
        .Range("B" & n) = nm.RefersToRange.Parent.Name
        .Range("C" & n) = nm.RefersToRange.Address
        .Range("D" & n) = "'" & nm.RefersTo
    Next nm
    .Columns("A:D").AutoFit
    End With
errorClear:
    If Err.Number <> 0 Then
        Err.Clear
        Resume Next
    End If
End Sub
I did something like this (although my task was much simpler) when we migrated from an "old" template workbook to a new template workbook.  Since none of the Names needed to change, I could use the following code:
    'copy workbook named ranges
    Application.StatusBar = "Copying Query Ranges"
    For Each nm In wb1.Names
        wb2.Names.Add Name:=nm.Name, RefersTo:=nm.RefersTo
    Next nm
In your case, the problem will be more difficult since technical names of some elements ... particularly Conditions ... will need to change.  But, I am certain that with the right cross-reference table you will be able to work this out.
Hope this helps.
- Pete

Similar Messages

  • Changed query, hopw to surpress msg in workbook?

    hi,
    changed a query(info objects few removed and few added), so after attaching the changes query to workbook...
    after refreshing evrytime it is showing a msg box with title
    "bex application msgs for query"
    and warings like "waring query changed, characterstic _xyz-" no longer exist" is coming.
    is there any method to surpass this msg box?/
    what to do not to get this?

    Hi,
    If you are getting the Warnign messages after refreshing the Query , then go to that particular work book,Menu>Bex Analyzer>Supress Warning messages.
    Save the work book.
    It will avoid the Warning messages that were displayed by the Query.
    Assign points if it helps............

  • Problems in creation of workbook using Change query local view.

    Hi Experts,
    I have created a Multiprovider by using union of two infocubes and created a Query based on Multiprovider.  I want to restrict one infocube in Change Query local view for creating new workbooks.  In Query global view we drag and drop the Infocube under Filters, but in the Query local view Filter panel is in disable mode. (My requirement is to create the workbooks using change query local view only)
    How can I restrict the one Infocube values in the workbooks by using Change query local view? 
    Thanks in advance.
    Venkat.

    Hi Venkat Prasad
    As you told that the query is on multi provider and the view is not allowing to declare/define filter value
    Just drag the infoprovider info object avilable under packet dimension to rows and right click on it restrict by selecting the name of the info provider when u right click it will show you the option of restrict once u click on it,it will takes to u a pop up where you can able to see the name of info providers and you specify according to it and finally in the display of results if you dont want to to display the info provider name then just right click on the 0infoprovider object under rows go to properties then choose hide option under display.
    Hope its clear a little..!
    Thanks
    K M R
    **Assigning points is the only way of saying thanks in SDN***
    >
    venkata prasad wrote:
    > Hi K M R,
    >
    > Thanks for ur quick response.  Most of the Infoobjects are common for both infocubes. I didn't understand this sentense "retrict the value with the infoprovider which values you are trying to view".
    > Please explian elaborately how to restrict the values speicfic to infoprovider under rows.

  • Query on workbook.

    Is it possible to build Query on workbook?
    ie: Is it possible to summarize the results of two querys and to display the result in another query.
    Problem: Due to wrong definition of field the data get overflowed and results in sql error in query.
    Now if i change the field definition thant its a risky process due to the data presence for field in different target.
    Instead of that i have planned to built two queries with different selection and summarize the result in third query and attach the third query in webtemplate for web reporting.
    Sure points for valid inputs.
    Thanks in advance.

    Hi Armstrong,
    Yes, it is possible to summarize the results of two querys and to display the result in another query by using workbook.
    Create a workbook with the two queries in two seperate worksheets(sheet1 & sheet2) in the workbook.
    Take a new work sheet(sheet3) for the 3rd query i.e. result query. In this worksheet you copy the result of 1st query and 2nd query and add it
    or
    You can write a formulia for adding these two query result.
    Select the cell which you want the summiation of 1st and 2nd query to be displayed in sheet3. Type = in that cell and click the sheet1 and select the result of 1st query ( we displayed 1st query in sheet1) then type + and click sheet2 and select the result of 2nd query ( we displayed 2nd query in sheet2) then press enter. Now you can see the summiation of these two queries in that cell in sheet3.
    Now attach this workbook in webtemplate for web reporting.
    I hope you understand the procedure. If you have any clarifications let me know.
    Regards,
    Patil.

  • Query and Workbook BI 7.0

    Hi
    I am in BI 7.0
    1)I created a query X and saved it as workbook. When I edit the changes in query, I don't see the changes reflected in workbook.I thought if I change the query or workbook, the changes should take place.
    2) I have to create 12 queries of same structure but contains different hardcoded costcenters.Can somebody advice me what is the  best method to accomplish the above requirement.Should I create query or query views and what major differences did you guys observe between Query and Query View from your expereince and practices...

    Hi Jacky,
        If you change the query this way you wont have to re-insert the query each time you make changes.
    1. Open the workbook.
    2. Select the query by clicking on it. Then use the Edit query option from the toolbar.
    3. Make changes to the query.
    4. Execute the query by clicking the Green check mark.
    5. After making sure that the changes have been applied, save the workbook.
    Hope this helps...

  • How to add more than 1 query in workbook

    Hi All,
    How do we add More than 1 query in workbook, Can any one provide me steps.
    Thanks in Advance.

    Hi,
    If you are using BI7 Bex analyazer, please check whether the following explanation helps you:
    "Steps of creating workbook and to insert more than one query in a workbook.
    •When you run a query and it opens in Bex Analyzer you can click the save button and pick "Save as Workbook".
    •Once you save it as a workbook Click on the "Design Mode" button in the Bex toolbar (looks like an A).
    •Click in the sheet where you want the new query to go, click the "Analysis Grid" button. It will add the analysis grid to your new sheet.
    •Right click on the Analysis grid and go to properties.
    •Click on button to change data provider and select the query you want to attach.
    •Exit design mode and you should be all set. "
    Thanks & Regards,
    Sapna

  • Query or Workbook or Web Template-Process chain

    Hai Friends,
                   I want to broadcast reports.Which type of the report is more attractive among Query or Workbook or Web Template?Suppose if we select Workbook as type,will it support for process chain which will create to automate the broadcasting process?On every data change will the workbook automatically changes it's data.Usually we will do layout settings ONLY for workbook.Will all the settings remain same when the new data is changed every month?
    Please, reply me with ur valuable answers
    Thanks
    Mohan Chand Reddy A

    Hi Mohan,
    You can use either of them for broadcasting, just check the requirement with your business. And using process chain you will raise an Data change event and in your broadcast setting you will have to mark the option i.e. Broadcast on data change.
    So whichever queries or workbooks have that setting on the particular Infoprovider. And once you raise the data change event for that Infoprovider through process chain, all the reports will be broadcasted.
    Regards,
    Durgesh.

  • Reassign query in Workbook

    Hello,
    actually a query in our development system became corrupt and it was necessary to delete the query with transactio rszdelete. Now I rebuilt that query using the same technical name.
    The problem I am having is, that it is not possible to open former worbooks based on that query.
    I already tried following:
    1) open workbook containing that query on quality system
    2) assign relevant dataprovider to another query
    3) open workbook in development and reassign dataprovider to the original query
    --> no success
    Any idea how I can use the old workbook? When I try to open the workbook in development system I get an exception and connection to bw system from bex is lost.
    Thank You!
    Markus

    Hi Markus ,
    The workbook to query link is not based on tech name of query but the linking is based on unique GENUNIID .
    If you will check in table RSRWORKBOOK and RSRREPDIR you will get relationship between them .
    1. One way is you can try changing GENUNIID  of workbook in table with new GENUNIID  from developed query ,but i am not sure as their may be more tables where entries are maintained .
    2. Create new workbook same as old one .
    You should have change the existing query instead of deleting and creating new .
    Regards,
    Jaya Tiwari

  • Find query from workbook

    I want to change a sheet in workbook (i.e I want to insert selections for only one sheet) but when I goto that sheet and then goto change query global def it shows "please select the query".Please tell me how to find out from where the data is coming on that sheet and how to change that.

    Seacrch in metadata repository with your workbook name.You will find Query used.
    and Query sheet is hidden in your workbook?
    format>sheet>unhide>select Query.Then place the cursor on Query output>change Query global definition.
    <i>"want to change a sheet in workbook (i.e I want to insert selections for only one sheet)"</i>  what are you trying to do exactly?

  • Change Query for SnapShot in Outlook Express Addon

    Expert,
    I am using SAP 8.8 PL15 and using Outlook Add-On.
    we are using SnapShot for our report also but we need report in specific format,
    can we change query so that report will change and we have our own report format
    Thanks
    Nilesh Shah

    Hi Nilesh Shah,
    You can try under test environment. Then you will know.
    Thanks,
    Gordon

  • Using "Restrict by app" in change query causes issues with Search Results

    Hello!
    I am hoping some experienced SP admin can help me out. I am having issues with the relevance ranking for my search results web part.
    I created a Wiki (OOTB) within a site collection and on the home page of the Wiki I was looking to apply a Search Box and Search Results web part for easy searching. I wanted to ensure the search results were restricted to the scope of the pages within the
    wiki. I did the following after adding the 2 web parts:
    Entered edit mode for the page
    Started to edit the Search Results web part
    Under Properties for Search Results clicked on "Change Query"
    Navigated to BASICS and clicked "Switch to Quick Mode"
    For Select Query, picked "Wiki (System)" option
    For Restrict by app, picked "Specify a URL" and input the wiki URL "http://webapp.com/sites/sitecollection/wiki"
    Click OK
    The web part has 6 automatic results when I hit the page. These are the only 6 pages in my wiki. When I search a word or title of a page, they are not ranked in order or relevance. The ordering is static to what was being shown before the search, but the
    keywords I'm searching are bold. With out the taking the steps above, I can easily search these pages and have them ranked appropriately so I'm not too sure what I'm doing wrong. 
    Other Details
    The pages have been crawled and can be searched from anywhere else in SP.
    I am only a site collection admin for this specific site collection.
    I other than the steps above, I have not made any changes or customization to the search web parts; they are both out of the box SP.
    The SP Farm admin we unable to pin point what the root cause is either.

    Hi Mikael,
    Sorry for the wait, I was unable to post pictures, which i felt would better describe my issue.
    Could you output the query template you are ending up with?
    If you can tell me how to accomplish this, then I can provide it. Please keep in mind that I am only a site collection admin.
    Also, is the ranking/sorting for your webpart set to ranking?
    When looking at the web part settings, I didn't see an option to modify the ranking. Unfortunately, some sites in my intranet are down now so I can't even double check. Once it's back up, I will verify this as well.
    And how do you know they are ranked incorrectly?
    I wanted to display an image showing what I meant by this. As the wiki is down, I'll do my best with words. When I visit the wiki home page, I already have the search and search results web parts there. Without searching anything, the search results
    web part displays 6 pages that are available in the wiki. When I search, I expect to see the most relevant result at the top. similar to the following: 
    *Search result from another section of the intranet site.*
    What I receive instead is the same list of wiki pages, in the same order. The most relevant result
    is not moved to the top like in the image above, but I can see that the word "rush" is highlighted in bold. I hope this helps.
    If you need more of a description, please let me know.
    Thank you

  • Change query dynamically in DB Adapter

    Hi,
    Please answer these questions.
    1. How to change query dynamically in DB Adapter?
    2. I have 2 db adapters, if i got error in 1 db adapter then how to rollback?
    Regards,
    kpr

    Hi,
    <div class="jive-quote">How to change query dynamically in DB Adapter?</div>
    Unfortunately there is no way to pass the query dynamically in DB Adapter. The reasoning behind that is that the DB adapter configuration wizard creates multiple assist files for each operation including the xsd which can not be created for any query dynamically.
    <div class="jive-quote">I have 2 db adapters, if i got error in 1 db adapter then how to rollback?</div>
    Either use XA datasources or throw a rollback fault in the catch block.
    Regards,
    Neeraj Sehgal

  • Insert Query in workbook

    Hi
    Can anyone of you please give me some information or any links explaning step by step procedure on:
    1. How to copy a query
    2. How to insert query in Workbook
    Many Thanks

    Hello,
    1. How to copy a query
    Open the Query Designer and choose edit of the query then choose "Save as". This will copy your query. You can also use transaction RSZC to copy queries between different InfoProviders if possible
    2. How to insert query in Workbook
    Just open the workbook, go to the place you want and click on the option Tools->Insert query (with BW 3.x); With BI 7, just open your workbook, choose a place you want to insert the query and click on the table button, then you have to assign that table to a dataprovider (a query)
    Diogo.

  • Discoverer EUL Workbooks - Query Statistics, Workbooks Queried By User

    Hi there.
    I've just ran Discoverer EUL workbooks and found out a nice functionality on one of those queries. It's on EUL Query Statistics workbook, "Workbooks Queried By User" worksheet (and others).
    If you take a look at the "Worksheet Usage" column, you'll notice that there's an effect that looks a lot like a "progress bar". According to the times that worksheet was used, this bar advances or retract.
    I noticed it's a calculated column, but when I try to edit it, it shows no more than COUNT_DISTINCT("Date & Sheet"). I got a little confused on how this COUNT_DISTINCT shows that "progress bar"....
    So... how can I implement this on my DM queries?
    TIA.

    You need Desktop. When you format the data, there is a check box to show graphical bars. This option is not available in Plus, but the bars will show up when the report is displayed in Plus.

  • Change query using abap

    hi all,
    i find a situation when i need to change many queries to include a common variable of a characteristic. is it possible to create a program to change query? are there any function modules for this?
    thanks.

    Hi,
    You can run or get an URL for query with ABAP Function modules. but for creation, it may not possible.
    As this is a different tool.
    Regards,
    Ravi Kanth

Maybe you are looking for

  • Sometimes doesn't automatically add invitations

    iCal in Leopard has been a huge pain to say the least. I am the IT director for a law firm with 20 attorneys. One of the senior partners upgraded to 10.5 back in December. He's had continuous problems getting the invitations to go from email to iCal

  • Object Open Error while trying to export the vDataFact table

    I am getting an error when trying to export the vDataFact table to a flat file.  I have been able to do this several time before with the segment tables but would like to run this against vDataFact The error in the error log is:    ERROR:        Code

  • Cannot pass parameters

    Hello guys, I made a sql query with 4 columns, I want to post the results of on row to an update jsp page to make change within the databases. The code I used below does not permit me to retrieve the four values of the row within text input type to p

  • Problems adding second laptop to network

    Hi, I just bought a Linksys WRT54GS router and followed the setup instructions to get my first laptop up and running wirelessly.  I had to use the linksysfix.com site, but everything works great.  Now I want to add another laptop.  I go to the linksy

  • Which standby redolog directory is OK?

    I have tried many times to configure a physical standby database manually. But no once succeed. The error message is "ORA-02778: Name given for the log directory is invalid." I don't know which standby redolog directory should I specify? The rodolog