Refreshing queries from VBA that expect prompted values

Please consider:
Run "SAPBEX.XLA!SAPBEXrefresh", False, SAP01.Names("SAPBEXq0001").RefersToRange
(SAP01 is my code name for SAPBEXqueries.)
Assuming the query requires a date for refresh, I would expect the following to work:
Run "SAPBEX.XLA!SAPBEXrefresh", False, SAP01.Names("SAPBEXq0001").RefersToRange, format(Date,"mm/dd/yy")
but it does not... replying, 'invalid # of arguments'.
So I tried:
Run "SAPBEX.xla! SAPBEXSetFilterValue", Format(Date, "mm/dd/yy"), "", BEXD02.Range("ab6")
(BEXD02 being the codename of the query embedded sheet.)
but no dice.

Pete,
There are a few things I do when first I embed queries.
1) Change CODENAMES based on a simplistic naming convention.
codename for tab SAPBEXqueries becomes SAP01
codename for tab SAPBEXfilters becomes SAP02
codename for 1st tab of queries becomes BEXD01
codename for 2nd tab of queries becomes BEXD02 (Bex data, etc.)
Not to bore you, I bring that up to lead into the following code references.  Perhaps like you, I use a SELECT CASE once a query has refreshed and I'm sure to last implant a query for which workbook dates can be derived. Once that last query has refreshed and control is returned to my project, I use the following to grab the date supplied by the user (RefreshWBDates is a sub that derives a host of dates based on the value passed):
RefreshWBDates SAP01.Names(queryID & "tVARIABLE_ZGVCPPD2").RefersToRange.Cells(1, 2)
(Variables of course are dependent on the query used and I change them accordingly.)
Or for example I want to create a named range based on the headings of a query I might do the following:
[BEXD01].Names.Add "Indices", query.Offset(0, 2).Resize(1, query.Columns.Count - 2)
OK, the last example isn't quite inline with your question but until very recently, 'query' was set according to the following:
Set query = SAP01.Names(queryID).RefersToRange
In this I was again utilizing the named ranges on the SAPBEXqueries page.  Little did I realize I could have just used RESULTAREA instead:)  But actually I never thought to use RESULTAREA because for debugging purposes I wanted to test my code WITHOUT bex so I'd use the reference above like so:
Private Sub TrixBex()
  'No purpose for the range but to satisfy the parameters
  SAPBEXonRefresh "SAPBEXq0017", Range("A1")
  SAPBEXonRefresh "SAPBEXq0016", Range("A1")
  SAPBEXonRefresh "SAPBEXq0015", Range("A1")
end sub
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
  ProcessQuery queryID, resultArea
End Sub
Private Sub ProcessQuery(queryID As String, resultArea As Range)
dim query as range
  Set query = SAP01.Names(queryID).RefersToRange
'processing...
end sub
But now that I've 'grown', I use the following for my debugging:
Private Sub SeedBex()
  CallBex "SAPBEXq0002"
  CallBex "SAPBEXq0001"
End Sub
Private Sub CallBex(queryID As String)
  SAPBEXonRefresh queryID, SAP01.Names(queryID).RefersToRange
End Sub
Sub SAPBEXonRefresh(queryID As String, query As Range)
  RefreshBexQuery queryID, query
End Sub
Sub RefreshBexQuery(queryID As String, query As Range)
'processing...
end sub
So in essence, I've totally avoided reading from the SAPBEXqueries page completely and instead pull from BEX's named ranges.  Of course, I do that because I've seen a number of SAPBEXqueries pages pooched that totally destroy the linked queries.  But I suppose in the long run doing it this way is probably more bullet proof since the blasted page is undocumented and could change upon any revision. Possible but doubtful the named ranges will ever radically change as you've probably deduced.
No reward points for this post though eh? 

Similar Messages

  • Optional prompt value to be set from java bo sdk

    hi
    i am trying to refresh a report which has 4 prompts
    2 of them are mandatory and 2 of them are optional.
    Please find the code below
    Prompts prompts = di.getPrompts();
               if(prompts != null){
                       promptCount = prompts.getCount();
                     for(itemCount = 0; itemCount < 4; itemCount++) {
                       prompt = prompts.getItem(itemCount);
                       String paramValue = null;
                         if(promptName != null) {
                       if("Billing Period Prompt".equalsIgnoreCase(promptName)){
                            paramValue = billingPeriod;
                       }else if("Fleet Number Prompt".equalsIgnoreCase(promptName)){
                            paramValue = fleetNo;
                       if(paramValue != null){
                            String paramValArr[] = {paramValue};
                            System.out.println("paramValue "+paramValue);
                            prompt.enterValues(paramValArr);
                       }else{
                            paramValue = "null";
                            String paramValArr[] = {paramValue};
                            prompt.enterValues(paramValArr);
                     di.setPrompts();
                     di.refresh();
    initially, am trying to get all prompts and setting up values for the mandata prompts only. but i did not get any report
    then i tried to give some default value to optional parameters also by giving "ALL", "all","*", "null
    ,"NULL","*"
    stil it is not working
    please tell me what should i

    First I'd read the ReportEngine SDK Developer Guide.
    Then I'd try calling refresh() first, then setting prompts after that.
    The refresh method you can interpret as 'reset the document state such that new prompt values may be applied'.
    Sincerely,
    Ted Ueda

  • Dashboard prompt value is not passing into the report

    Hi,
    I am using OBIEE 10g. The problem is in Oracle BI Answers
    I have a prompt and its related report. In the prompt, in one of the column, I am using sql result. The sql query is a co-related sub query where i have used 2 tables. employee_data and employee_region. The reason for using sub-query is that there is no data_center column in the employee_data table. It has the records for all the data_center e.g USA, UK,IND,AUSTRALIA etc So, I used the sub query with condition which will give the result on a particular data center (here it is USA) and this sub query's output is input for the main query. And the prompts works fine and gives correct result
    The sql query used for the column in the prompt (in Oracle BI Answers) as
    SELECT EMPLOYEE_DATA.ENAME FROM EMPLOYEE WHERE EMPLOYEE_DATA.ENAME IN (SELECT EMPLOYEE_REGION.ENAME FROM EMPLOYEE WHERE EMPLOYEE_REGION.DATA_CENTER = 'USA')Now in the report, there are 2 coulmns. - EMPLOYEE_DATA.ENAME and EMPLOYEE_REGION.DATA_CENTER
    I have used the main column EMPLOYEE_DATA.ENAME for filter as 'prompted'.
    The problem is the value from the prompt is not passing from the prompt to the report, what I found. Because, instead of showing the result for 'USA' data_center, It also shows other data_center 's (UK,IND,AUSTRALIA) data.
    How filter condition I should use for EMPLOYEE_DATA.ENAME column in the report so that the prompt value will pass to the report properly ?
    Thanks
    Edited by: Kuldip on Feb 21, 2013 6:17 AM

    Hi Kuldip,
    There are 2 ways of doing it.
    1. Nice and good: For the section where the report is put have a condition to display only if it returns rows. For details please refer to :
    http://bischool.wordpress.com/category/guided-navigation/
    2. The easy way: Add a "No Result" view to your report and add few spaces in the text.
    Let me know if this helped.
    Regards,
    Jay

  • WebI showing random value from give prompt value

    Dear All,
    I have made an universe on top of SAP BW Query.
    I have designed webI report on top of that. In that I have "Fiscal Year.Period" as Interval Prompt in WebI not in BW Query and I can't put prompt in BW Query because based on same universe i have other report as well.
    I have user cross-tab in Report and in column section I have "Fiscal Year.period".
    Now the issue is, when I refresh document, it is asking me to enter From & To Period. I am giving input as example 001.2010 to 012.2010 then it should show me values between 001.2010 to 012.2010 only but instead it is giving me values for 2011, 2007 year as well.
    Does anyone have idea why it is happening ?
    As per my analysis, during prompt value LOV is by default sorted in Asscending order :
    1)V3/001.2010
    2)V3/001.2011
    etc.
    I really appreciate your quick input on this.
    Regards,
    Rishit

    hi ,,
    I have tried and understand your scenario....the data thing it having issue with bo .....but resolved by using this notes......
    1494404 - Using Webi query filters based on dates using "Greater than" and "Less than" and "between" does not work properly when based on SAP BEx.
    Try this and give the feed back......

  • How could I pass parameter that depend on values in report from report to form?

    In my case, I want to pass 'gno' and 'qno' values of report
    to form. When click on the button then the form is showed.
    There are automatically values in gno field on form so that user
    don't complete this filed.
    So I create a button on the report . I enter Javascript in
    PL/SQL Code tab in '...after displaying the footer' as follow :
    htp.formOpen
    (owa_util.get_owa_service_path||'portal30.wwa_app_module.link?
    p_arg_names=_moduleid&p_arg_values=1736929105&p_arg_names=_show_h
    eader&p_arg_values=YES&p_arg_names=GNO&p_arg_values=1&p_arg_names
    =QNO&p_arg_values=2');
    htp.formSubmit(null,'New Answer');
    htp.formClose;
    The above code can pass only static value, while I want to
    pass values that depend on value in column of report to form.
    So please tell me how can I pass this value to form. I look
    forward to hearing from all of you. Please!!!!!!
    Thank You

    Thanks for the prompt reply.
    Yes. I am using a Custom Step Type.
    I have attached a trial code which contains the trial VI, sequence and the type palette ini file.
    Please have a look at it.
    Regards,
    Mirash
    Attachments:
    Injection trial.zip ‏35 KB

  • BPC NW 10.0 - Data Manager Prompt changing from SELECTINPUT to SELECT cleared values

    Dear BPC Experts,
    We recently went from SP13 patch 4 to SP19 patch 1.  When we made changes in the PROMPT values in the Data Manager Organize>Package>Modify Script>PROMPT, we experienced different behavior switching from SELECTINPUT to SELECT in our development system than we did in our production environment.  In development, when we changed the value from SELECTINPUT to SELECT, the values entered for Variable name such as %SELECTION% in Property1 and "Select the members to CLEAR" in Property2, and %DIMS% remained.  However, when we changed from SELECTINPUT to SELECT in production system, the values for Variable Names and Properties were cleared out.  Does anyone know why in our developmet system values were kept but not in our production system during this type of activity?  I would like to understand the two different behaviors and what controlled it.  We prefer not to have the values for Properties clear.
    Thank you in advance for your assistance.
    Kind regards,
    Lisa

    Hi Vadim,
    Excellent point, I should have included images as that likely would have shown this odd behavior.
    When I made the changes in our development system to a package to switch from SELECTINPUT to SELECT the values outlined in the image below were retained for Varialbe Name, Property 2, and Property 3 after we applied the SP19 patch 1.
    When I made the same change in our system to a package in our production system after we applied the SP19 patch 1, the values for Varialbe Name, Property 2, and Property 3 were cleared per the image below.  The odd thing is that initially it looked like the values stayed.  It was only after you saved and went back in did you see that the values were gone.
    Any help in understanding this behavior change would be greatly appreciated.
    Thank you,
    Lisa

  • Refresh Prompt Values

    Hi, I'm using Crystal reports XI and when I refresh a report, the system will prompt for new values. If the value is a calendar date and I chose the calendar to pick the date, Windows Vista generates a close error and kicks out of Crystal. If I type the date in without using the calendar, everything is Ok. Does anyone have any idea why this is happening? Thanks Roger

    It might be a possibility that the prompting folder has got corrupted.This is a typical (and known) issue with the date picker(calender) in the parameter window.
    if you have some other machine on which CR is installed and this functionality is working fine there,then replace this prompting folder on your machine with the one where its working fine.
    Thanks !

  • How to refresh the grid so that default  values come on adding new row.

    Hi Experts,
    In alv grid while adding new row, i want some 2-3 column values to come by default from already existing row in grid.
    i am getting new row in internal table with 2-3 default values and rest columns blank on adding new row in alv grid
    but the entire row is coming blank, not able to get the default values in new row
    how can i refresh the grid so that default  values come on adding new row.
    thanks

    Hi Surabhi,
    Use this in Interactive section even if you are doing simple ALV.
    DATA:
    lv_ref_grid TYPE REF TO cl_gui_alv_grid.
    CLEAR : gv_tcode.
    *-- to ensure that only new processed data is displayed
    IF lv_ref_grid IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    e_grid = lv_ref_grid.
    ENDIF.
    IF NOT lv_ref_grid IS INITIAL.
    CALL METHOD lv_ref_grid->check_changed_data.
    ENDIF.
    THis will solve your problem.
    Regards,
    Vijay

  • Need to clear last selected prompt values while refreshing webi report

    While using ALL within cascading prompts its  still showing the last prompt values selected  in infoview and not while editing and trying to run webi reports.
    Is there any way to clear this?
    I have implemented following options to resolve but did not work
    1) Delete the .lov files of universe.                                                                               
    2) Delete the contents in data folder by going into storage directory
    3) Implemented the non_persistent concept in prompts
    Code is as follows for the filter with in universe
    @Select(Customised LOV\State) = @Prompt('Select State','A','Customised LOV\State',mono,free,Not_Persistent,,)
    or
    'ALL' = @Prompt('Select State','A','Customised LOV\State',mono,free,Not_Persistent,,)

    Hi,
    In Web Intelligence, the Query Filter Condition consists of 3 parts:
    - Object on which condition is applied
    - Operator (=,<,>,matches pattern, etc)
    - Operands (constant, LIst of Values, etc)
    You will find a button with a "?" sign which is also called as Prompt properties. When you click on this button, a new window will open and in this you have an option for "Keep last values selected" which is checked by default.
    Uncheck this check box --> Click OK. Run the report and save --> Relaunch InfoView to avoid any caching problems.
    Hope this works for you
    Sheeba

  • How to write a formula that includes the value of a cell from another external numbers file ?

    Hello,
    Maybe my Numbers is too old : Numbers '08 v 1.0.3
    But it doesn't seem to allow me to write a formula that includes the value of an external cell...
    Any answers ?
    Upgrading to Numbers '09 ?
    Thanks !

    Olivier,
    Be sure to Send Feedback to Apple using the Feedback tool in the Numbers menu. That will help the Numbers design team prioritize their feature requests for the next version.
    Jerry

  • Setting a Prompt value for KeyDate in WebI on SAP OLAP universe

    I have a webi report which has as its dataprovider a query against an SAP olap universe against a BEx query which has the KeyDate parameter exposed.
    Iu2019d like to get at this prompt from the SDK.
    In infoview if I run the report it pulls up the keydate prompt (a special dialogue which seems to be implemented as part of the connection definition) - this prior to pulling up the full prompts dialogue and showing all universe based @prompt filters.  In WebI I can see the prompt value entered using =UserResponse("dp.kd.value") .   So it does seem to see the keydate as a prompt of some sorts.
    I've got a little jsp that allows me to set prompts very nicely (and packeaged as a jar in the CMC that schedules ok as well) but when I put it against a report with a key date u201Cpromptu201D it just wonu2019t see it.  When I call a getCount() as below it returns 0.
    oDocumentInstance.getDataProviders().generateQueries();     
    Prompts oPrompts = oDocumentInstance.getPrompts();
    out.print(oPrompts.getCount());
    This is all in an attempt to get around the scheduler limitations of key date which would give me two queries, two universes and two reportsu2026 one report for scheduling (using a customer exit to set key date) and a second for user refresh  (with a prompted key date)  which would all be rather messey to say the least!
    So any cunning ideas on how I can get hold of this key date thingymebob in the SDK?
    (ps. "Fixed in V4" would be nice to hear as an aside to thisu2026 In playing with the ramp up Iu2019ve got the same issues however so Iu2019m not to hopefull )
    Thanks!
    Jeremy.

    Hi,
    First I think you have to create a support ticket because normally the object in the universe must be generated with data data type nad it is not the case.
    We are awere of some limitations with data types.
    Secondly, if you want to have users entering date you have to specify date in the prompt data type like this:
    <OPTIONAL><FILTER KEY="[PERIOD SD].[DB Full Date].[DB Full Date]"><CONDITION OPERATORCONDITION="Equal"><CONSTANT CAPTION="@Prompt('Enter Date ','D',,mono,free)"></CONSTANT></CONDITION></FILTER></OPTIONAL>
    Regards
    Didier

  • Running multiple refreshes using a VBA macro

    My company has just moved from BO 5.1.5 to BO XI 3.0 and I'm having some probelms running a VBA macro which extracts a large ammount of sales data to a text file. The macro uses an array and a For Each Next loop to enter variable details before the Refresh and then it downloads the text data, looping back to enter different Major Product values before the next refresh.
    Here is the code I'm using in BO 5.1.5 and would like to rewrite as event based code ie BeforeRefresh/AfterRefresh.
    Sub Main_Report()
        Dim Docs As Documents
        Dim Doc As Document
        Dim Rep As Report
        Dim Reps As Reports
        Dim DocNum As Integer
        Dim RepNum As Integer
        Dim Location As String
        Dim VarName As Variable
        Dim DataPro As DataProvider
        Dim FileName
        Dim Majors
        Dim MajorList
        Dim Period
        Dim Counter
        MajorList = Array("001", "002", "003")
        Period = Format(DateAdd("m", -1, Now), "YYYYMM")
        Counter = 0
    '   Enter user prompt values into query for current period and YTD
        For Each Majors In MajorList
        Counter = Counter + 1
            For i = 1 To ActiveDocument.Variables.Count
                Set VarName = ActiveDocument.Variables(i)
                If VarName.IsUserPrompt Then
                    Select Case VarName.Name
                        Case "Major Group"
                            ActiveDocument.Variables(i).Value = Majors
                        Case "Period"
                            ActiveDocument.Variables(i).Value = Period
                    End Select
                 End If
            Next i
        '   Refresh the current report and save data
            Application.Interactive = False
            ActiveDocument.Refresh
            Location = "
    seausdcff015\saracm$\My Documents\Tables\Sales\"
            Set Docs = Application.Documents
            Set Reps = ActiveDocument.Reports
        '   Export each report as "TXT" files from current document
            Set Doc = Docs.Item(1)
            FileName = Location & Doc.Name & "_" & Counter & ".txt"
            Set DataPro = ActiveDocument.DataProviders.Item(1)
            Call DataPro.ConvertTo(boExpAsciiTab, 1, FileName)
            Application.Interactive = True
        Next
    End Sub
    Can you please help. Cheers Milos.

    A coworker found this thread on asktom:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:861518416236107::::P11_QUESTION_ID:10498431232211
    It sort of details a similar (if not the same) method to that above.

  • Call BEX-Query from VBA with BEX-automatic login?

    Hi,
    I'm trying to call a query from VBA. I have two problems/questions:
    1. Automatic login?
    I want to do an automatic login. I found this peace of code here, but I get an error:
    Public Function  LogonToYourBW()
    ' create Logon & RFC-Handle
    logonToBW = False ‘ clear connect Flag the flag can be used to find out if connected or not
        'load SAP functionality by opening BEX file ( use your installation path)
            Workbooks.Open (“c:\sappc\bw\sapbex.xla”)
        With Run("sapbex.xla!sapbexGetConnection") ‘ call the connection
           ' Set the params for Auto logon
           .client = “YOUR CLIENT NO”
           .user = “YOUR BW USER”
           .Password = “YOUR BW PWD” ‘ I recommend to create a dummy reporting user for this task
           .Language = “YOUR LANGUAGE YOU LIKE TO USE FOR QUERY DISPLAY ( i.E.  “EN”)”
           .SystemNumber = “YOUR SYSTEM NO” ‘
           .ApplicationServer = “YOUR SERVER Name OR IP-ADDRESS”
           .UseSAPLOgonIni = FALSE 'important for automatic connection
           .logon 0, True ‘ This will provide a dialog to appear
            If .IsConnected <> 1 Then
                .logon 0, False
                If .IsConnected <> 1 Then Exit Function
            Else
                Set g_oFunction = CreateObject("SAP.Functions")
                Set g_oFunction.Connection = g_oConnection
            End If
        End With
        Run "sapbex.xla!sapbexinitConnection" ‘ this will enable the connection you just created
        logonToBW = True
    End Function
    The error is by this row:
    Set g_oFunction.Connection = g_oConnection
    Object is needed! How is the g_oConnection-object defined?
    2. How can I pass values for the parameters from VBA?
    If I open the query usually from SAP-BEX-Toolbar, after selecting the query, I get a parameter mask, where I must put in a value. How can I this automatize from VBA? Has anybody a short samplecode for that?
    Thank you for your help
    Stefan
    [email protected]

    Peter and others:
    What I really want to do … is write a stand-alone application that I can run from windows scheduler … that queries our BW for sales data for certain items (in a tabular form) … and pulls that data into a VB recordset, or a .NET dataset … so that I can insert the rows into another database (SQL Server, or Access) … I already know how to do all the data movement to/from datasets and databases … I just cannot figure out how to programmatically grab this sales data from BW … our company has “workbooks” already set up that aggregate WW sales information by region (IE, there is a separate workbook for each region of the world) … I can manually go into the Excel interface, tell it which items to pull the sales info for, and it dumps the data into the worksheet (organized by customer, and then by cat #) …
    So, what I’d like to do is write an app that will pull data every week or so from the BW (from each region’s sales invoice detail “workbook”), and insert it into another database that we use for reporting other, non-sales, data.
    Thoughts on this ?  Is there another, non-BEx method that is better ?
    thanks !!

  • Can we combine prompt values in Webintelligence Report(Combined Q:Union)

    Hi Every One,
    I had 4 Queries which are combined queries(Union).When i run the report ,displaying prompt values which are there in first Query.Can't we get combined prompt values when i run the report.I will explain with Scenario.
    Eg:
    Q1:Product level Country Information
    Prompt Values:Country(A,B,C,D,E,F,G,H)
    Q2:Component level Country Information
    Prompt Values:Country(A,B,C,D,E,F,L)
    Q3:Product level Source Information
    Prompt Values:Country(A,B,C,D,E)
    Q4:Product level Country Information
    Prompt Values:Country(A,B,C,D,E,F,M)
    When i run the report iam getting prompt values for country as (A,B,C,D,E,F,G,H)
    Could you help .
    Regards,
    Swapna.

    I'm having trouble understanding your scenario as you explain it.
    You are doing a union of the queries?
    So create query A, combine queries, union, create query B, etc.
    All of them use the same prompt message?
    So you either build the condition and reuse the same prompt message or you use a filter from the universe.
    In this case it is not possible to specify something different for each of the various subqueries.
    So you would have only one prompt answer, being whatever you answered to the prompt.
    If you have different prompt messages, you can give different answers, but then you have 4 prompt answers to display.
    It would be logical that only the first one is displayed if that is the one you display, you should display all four.
    If you just want to display the superset of countries which have been retrieved by the query you can put this information in a separate table block. If you make it a horizontal one, without borders, you should be able to come close to a normal prompt layout.
    Good luck,
    Marianne

  • Web Service prompt value

    Hi
    i creates a web service through rich client BI services
    i imported it to Xcelsius
    in the input values i have a prompt value which is durected to a specific cell
    this cell is updated from an input value or a flash variable or just typing it
    the problem is that the web service refreshed on load or activated by a connection button does not take the value for the prompt
    what am doing wrong ?
    10x

    Hello,
    We have a known issue with prompts in BI Services XI 3.1 SP2 that prevents input values to be correctly matched with query prompts during BI Service runtime / consumption, when prompt labels (names) include special characters (like spaces, dash, question marks, etc. that are escaped with underscores '_').
    Besides avoiding to expose prompts in BI Services, workaround is to simplify query prompt names in WebI document query so they do not include any special characters.
    Fix for this issue will be delivered with FP2 (XI 3.1 SP2.2).
    Hope that helps,
    David.

Maybe you are looking for

  • Can I change the database Listener name in 11.5.10.2

    Hi Hussen Is it possible to change the Listener name and port on database node. My Application is of 4 node env. 2 rac database nodes 2 shared application tier nodes. My requirement is to change the Database node listener name and port. Thanks reddy

  • Java Package/Class Dependency

    Hi, friends, I would like to get a list of packages that a given package depends on. If it is possible, I would also know which class of the given package depends on which classes. Is there any software to do this? If I would like to write a Java uti

  • Cannot Download Yosemite - error message

    I tether my iPhone to my iMac for internet access and downloads of software, etc.  While trying to download Yosemite several days ago, the download stopped "froze," with "calculating" appearing for how much time remained in the download.  It just sto

  • SOLMAN 3.2  LIS to SLD Migration

    Are there any notes on this?  We'd like to move from LIS to SLD.  Other than needing the Java stack is there any other gotchya's? M. Message was edited by: Michael Brierley

  • Where do I find the enable cache option in CS5?

    Where do I find the enable cache option in CS5?