Executing saved query in B1

Hi,
   Is it possible to execute a saved query in B1 or a formatted search from an addon.
Appreciate your help.
Gopal

1. Every saved query get a menuitem... See Tools > Queries > User Queries (These are menuitems are dynamic but it might work)
2. Regarding formatted searches you can activate a formatted search by setting focus of the field containing the search and make a send-keys (sboApplication.SendKeys("+");)

Similar Messages

  • Execute Saved Query in Business One

    Hi,
        We have the following functionality in one of our addons :
    User can associate saved queries in B1 with any window in B1 and execute via a right click menu.
    this is how we have written code to do this:
    1. user clicks menu to exeute query from any window (e.g. BP window)
    2. addon "programatically" scans the menu name under Tools >> Queries >> User Queries >> User defined Categories till it gets to the menu name specified
    3. Gets the menu id of the query and fires a menu click event.
    As you may know already the menu id's "User Defined Categories" in B1  change dynamically every time a user logs in. Majority of the time the menu id for user categories is a 6-9 digit positive number.
    However sometimes one of the user categories is a 10 digit -ve number. In this case the logic that we I have laid out above breaks when it gets to the user category with the -ve menu id. When this happens,  the final result is that the query is not executed and the user cannot see the results.
    This has been a recent development that I have seen only on 2007 environments. On some machines this never happens and on some it happens very rarely (1 in 25-30 times the user logs on). But recently we came across a machine (one of our test machines where this happens 1 in 3 times when the user logs on).
    We have tried to recreate this -ve 10 digit menu id by prorgamtically adding it to the menu structure via the xml file but the menu id does not show up in the SAP menus.
    So I m hoping you can help me with 2 things:
    1. Ideas on how get a query's menu id differently than the logic I laid out above.
    2. This looks like an SAP issue since it doesnt let me add the menus via the UI API. any thoughts on that?
    I really appreciate if anyone can help me out with this.
    Thanks,
    Gopal

    Gopal>
    We use the following code to get to a specific query based on is id in the database (The code use a few wrapped UI and DI-methods but I think you will understand)
    B1Recordset rsUserQueryData = new B1Recordset("SELECT T0.QName, T1.CatName FROM OUQR T0 JOIN OQCN T1 ON T0.QCategory = T1.CategoryId WHERE T0.IntrnalKey = '" + targetMenuUidOrParam + "'");
                                if (rsUserQueryData.RecordCount > 0)
                                    string name = rsUserQueryData.GetValueAsString("QName");
                                    string category = rsUserQueryData.GetValueAsString("CatName");
                                    B1MenuItem miUserqueries = B1MenuItem.GetMenuItem(SBO.ID.Topmenu.Tools.Queries.UserQueries._UID);
                                    for (int i = 0; i < miUserqueries.SubMenus.Count; i++)
                                        if (miUserqueries.SubMenus.Item(i).String == category)
                                            B1MenuItem categoryHeader = new B1MenuItem(miUserqueries.SubMenus.Item(i));
                                            for (int j = 0; j < categoryHeader.SubMenus.Count; j++)
                                                if (categoryHeader.SubMenus.Item(j).String == name)
                                                    B1MenuItem.ActivateMenuItem(categoryHeader.SubMenus.Item(j).UID);
                                                    return;
                                    Notification.StatusbarError(Language.GetString("MI_ERROR"));
    >Yatsea Li
    It is not correct that you only can add your own menus into the Module menuitem... You can place new menuitems anywhere in the menu-structure... Only limitation is that you can't add a new root menuitem (on level with File, Edit...)

  • Error while executing the query-VIMP

    Dear alll
    I am executing the query in production i am getting this below error message
    BRAIN 629 Specify a value for variable companycode(single values,entry,mandatory)
    BRAIN  629 specify a values for variables Simulkation ID1Individal values,requireed entry)
    RSBOL 000 Program error in class SAPMSSY1 Method UNCAUGHT_EXCEPTION
    BRAIN 633 varibale contain invalid values
    It have been worked untill yesterday
    Please suggest me in futhuru its very very imp to deliver the reports

    Hi,
    Try one of these
    1. Take of the infoobject from the query definition and see if the query is working.
    2. Try saving this Query as another one and try executing it.
    REgards
    Govind

  • How i create report on sccm 2012 based on saved query or collection

     i tray to create report based in saved collection or query
    i copy query statement  and create new report example
    (select SMS_G_System_PRINTER_DEVICE.DriverName, SMS_G_System_PRINTER_DEVICE.Name, SMS_R_System.Client, SMS_R_System.IPAddresses, SMS_R_System.Name from  SMS_R_System inner join SMS_G_System_PRINTER_DEVICE on SMS_G_System_PRINTER_DEVICE.ResourceID =
    SMS_R_System.ResourceId where SMS_G_System_PRINTER_DEVICE.Name >= "HP LaserJet" and (not SMS_G_System_PRINTER_DEVICE.DriverName >= "microsoft office") and (not SMS_G_System_PRINTER_DEVICE.DriverName >= "ZDesigner") and
    (not SMS_G_System_PRINTER_DEVICE.DriverName >= "Send To Microsoft") and (not SMS_G_System_PRINTER_DEVICE.DriverName >= "PDF Complete Converter") and not SMS_G_System_PRINTER_DEVICE.DriverName like "Microsoft XPS Document Writer"))
    i paste the query statement when i execute the query  appear error  as in photo in link  
    please help me 
    http://social.technet.microsoft.com/Forums/getfile/527879

    Your picture doesn't seem to work.
    Your query above is in WQL, however reporting uses SQL. You will need to translate the query to SQL first.
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Failed to execute MDX query. Reason: returned server error (). (IES 10901) (WIS 10901).

    Hi,
    I am trying to create a Webi report based on an OLAP Universe. I am using BI 4.1 SP01
    I did the following:
    1. I have setup a databse connection for SAP SSM via the create connection wizard in the Universe Design Tool. My connection is created sucessfully.
    2. Next I created a Universe saved it and exported it.
    3. In webi I am trying to create a report, I selected a couple of measures in the "results objects" section. In the qurey filters section I selected month.
    When I run this query, I am getting an error message: Database error: Failed to execute MDX query. Reason: returned server error (). (IES 10901) (WIS 10901).
    I tried to search for similar issues reported on SCN forums and other places and it looks like a generic error and this was not answered in some of the discussions
    Any help is very much appricated.
    Thanks
    Imtiyaz

    Hi,
    I have verified in BEx query properties, it's "allow External Access to this Query" is checked.
    I have filter in BEx query, so not need to had it to query selection again in webi report.
    Could any other solution??
    Regards,

  • Function Module to Execute BEx Query and Save as work book.

    Hi
    I have a requirement for executing the Query after the data is loaded into the cube and save as Workbook and emailing to the user. Is there any Function module to Execute the Query and saving as Work book? . Please suggest me the way how to approach the problem.
    Thanks for your help in advance.

    Hi,
    It is possible to execute the Query and send the result as workbook vial email to the user.
    For that use should use Information Broadcaster.
    Steps:
    1. Goto information broadcaster.
    2. Choose object type as "Query"
    3.Click create new setting.
    4. Give description and choose distribution type as "Broadcast E-mail"
    5.Choose output format "XML(MS Excel)
    6.In recipient tab Give valid e-mail addres which you want to send.
    7.Save it. and give technical name
    8.Click schedule.
    9.choose "Execution with Data Change in the InfoProvider " correspondig infoprovider will be shown (check the check box)
    10. that's it. whenever data loaded in your infocube, it will be automatically executed and send to user mail.
    <removed> if u want more information let me know.
    Regards,
    Senthil Kumar.P

  • Running a saved Query in SAP2005

    Hi
    I want to repeatedly run a saved query from my application which I can do with the activatemenu command. One of our guys wants a list of current support calls on screen, I will update this every few minutes.
    The problem I have is that a system message appears on screen that you must press enter on.
    An ideas how I can clear that message so I can display the next query please ?
    Thanks
    Regards Andy

    This snippet seems to work. Well... most of the time:
                   p_old = Cursor.Position
                   Cursor.Position = New System.Drawing.Point(1, 1)
                   SBOApplication.StatusBar.SetText(System.Windows.Forms.Application.ProductName & ": A click on 'OK' is needed in the case that the 'System Message' window does not get closed by itself in 30 seconds.", SAPbouiCOM_BoMessageTime_bmt_Long, SAPbouiCOM_BoStatusBarMessageType_smt_Warning)
                   frmQuery.Select()
                   frmQuery.Items.Item("15").Click()                ' Edit button - Disables editing
                   System.Threading.Thread.Sleep(500)
                   SendKeys.Send("{LEFT 100}{ESC}")               'Fill the keyboard buffer with harmless keystrokes + ESC to clear the 'System Message' window
                   frmQuery.Items.Item("1").Click()                ' Execute
                   SendKeys.SendWait(("{LEFT}"))               'wait that all keystrokes are processed
                   Cursor.Position = p_old
    HTH
    Juha

  • Error while executing a query

    Hi,
    While executing a query in portal it is giving internal server error.
    In the input screen help, we are searchign using wild card characters.I.e "  141",its giving internal server error,
    If we are giving the one value/no value the report is executing correctly.
    The input variable is a heirarchy variable. We tried to give it in the heirarchy format also. Still its not working.
    Could anybody help on this.
    Thanks

    u might be using "select * from <table name>", instead try this
    "select slno as slnod,title as titled.."
    http://www.javagalaxy.com

  • GO button to execute a query once report parameters are selected.

    I am familiar with the GO button depicted in chapter 10 of the 2 Day Developer manual that does not cause the report to be rendered until a user chooses a value from a select list of values. The GO button is used in conjunction with Null Value Text (ex. -Select-), Null Value (ex. -1), and Default (ex.-1).
    I need an alternative to the above method that will still force the user to pick a value from the List Of Values parameters prior to executing the query and rendering the report. Please provide.
    Thanks, Don From Maine

    Why don't you use a validation process?
    Denes Kubicek

  • Can I stop a report from Re-executing the query when I go back to that page

    I have a report that has a complicated query and looks at a lot of information to display the results. This query then links of to show details of individual items that were displayed in the result. But when I hit the back button on the browser, it executes the query again and it takes a while for the page to load.
    Is there any way to stop this and only execute the query when the User pushes a Button on the page else display the previous results.
    Thanks
    Sriram

    Another alternative is to make that detail link open in a popup window using
    javascript:popupURL(...);This way, the complicated report page is always visible.

  • How Can I Execute Sql Query in Managed bean?

    Hi,
    I want to execute sql query in managedbean and get the query result. How can I do?
    Best wishes!

    You can do this by having current Database connection your application is using like this
    public static synchronized DBTransaction getDBTransaction(){
    FacesContext ctx = FacesContext.getCurrentInstance();
    ValueBinding vb = ctx.getApplication().createValueBinding("#{data}");
    BindingContext bc = (BindingContext)vb.getValue(ctx.getCurrentInstance());
    DataControl dc = bc.findDataControl("AppModuleDataControl");
    ApplicationModuleImpl am = ((ApplicationModuleImpl)(ApplicationModule)dc.getDataProvider());
    return am.getDBTransaction();
    and then user DBTransaction object to create Statement and PreparedStatement you can find those in java doc.

  • Error in executing Std query -  Incorrect FRANGE row in FORM/DIM?FAC

    Hi,
    NOTE: We are on BI 7.0 Spport Pack 12 (SAPKW70012)...
    When I try to execute a query(one of the standard queries in HR - 0PA_C01_Q021), I got the following error messages:
    ABEND: Incorrect FRANGE row in FORM/DIM?FAC for InfoObject 0AGE
    ABEND: Incorrect FRANGE row in FORM/DIM?FAC for InfoObject 0ORGUNIT
    ABEND: Program error in class SAPMSSY1 method: UNCAUGHT EXCEPTION
    I searched the OSS and found a note 1001621 which said apply support package: SAP_BW_VIRTUAL_COMP - Rel 700 - Pkg name SAPK70012NVCBWTECH
    But, our basis guys came back with the reply that the solution suggested in OSS note is for SAPKW70011, but our system is already on SAPKW70012. So, this note cannot be applied.
    Is there any hidden solution out there? Please respond asap.
    Thanks

    Hi Raj and Sunny,
    Actually solution is very simple. You have to open this query in Query Designer and redefine the corresponding selection. The problem is that OLAP in BW 7.x is much more strict to query definition than in BW 3.x. Therefore queries from BW 3.x  are not accepted quite often. This error is just one example. So try to touch  the corresponding selection using hierarchy and save a query once again. For sure this will help. If not, create a message, we will look at the problem directly in your system.
    Best regards,
    Maxim

  • While executing the query in the web template I am  facing below issue

    Hello SAP geniuses,
    Please help me on my issue  ,
    while executing the query in the web template i am  facing below issue.
    The variable for characteristic (region) is appearing but this characteristic (region) is not appearing in the free characteristic zone  but when we are executing the query with out webtemplate it is showing both variable and free characteristic
    can anybody help us to identify what is the issue with the web template.
    Thanks
    Alok

    Hi,
    Plz check ur report and execute at the designer and take its technical name and go to RSRT. log out and log in and try..
    if not check ur authorisation.
    Regards....KP

  • Internal Error while executing a query with varaints in BEX

    HI All,
    I am executing a query which has 4 variants. when I use the first 3 variants the query is working fine.....but when I try to execute the same query for the 4th variant....the system is giving an error message called Internal Error.....
    when I executed the same query with same variant...in RSRT transaction code...I was able to see the results....
    The error messages that I am getting as follows...
    <Internal Error> receiving from the BW Server Failed. BW server raised exception SYSTEM_FAILURE. DO you want to see more information...
    when I selected YES....I got the following message
    Error in a ABAP statement when processing an Internal Table.table.
    Error Group
    RFC_ERROR_SYSTEM_FAILURE
    when clicked on the OK button the following message is displayed....
    <Internal Error> Can not determine text elements for the current query.
    Can any one explain me what went wrong...is there any thing that I need to do in the BEX settings...are there any patches that needs to be installed...or any OSS notes available for this sort of errors...?
    Advance in thanks
    Dilse...
    Hash

    Hi Harish,
    Execute the query in RSRT and check whether you have any short dump is in ST22. This would give a clear idea at what might have gone wrong.
    Another thing is to check whether the code for the variable is fine in the user exit.
    Hope this helps.
    Bye
    Dinesh

  • Auth Error in BW while executing a query with Company hierarchy

    Hi All,
    I have an issue in BW Reporting auth objects.. Hope to get resolved here.
    We are using BI 7.0. However We  are still using the Reporting auth objects for fiield level security. We are having a problem while executing a query with company code hierarchy ,which is built on a multiprovider.
    The Background is as below
    Multiprovider: ZM_CD01 with 5 infocubes
    Query: Has 0COMP_CODE as free characteristics with display hierarchy for Japan (Node APSC_012 is fixed value)
    Node APSC_012 has 4070,4076,407A,408A,9830 company code values under it.
    Reporting Auth Objects:
    Z0COMPCODE: (for flat values)
    4070,4076,407A,408A,407M,407P,8236, :
    ZHCOMPCODE: (For tree structure)
    4070,4076,407A,408A,407M,407P,8080, :
    APSC_MGMT_HIER (Nodes: APSC_012,APSC019)
    Both the reporting authorization objects are checked for multi provider ZM_CD01 in RSSM
    While executing the query the following Auth error is received.
    You do not have authorization to read object  "Z0COMPCODE" authorization on '0COMP_CODE'
    When I change the values for Z0COMPCODE to * it works fine. No Auth error.
    Please help me resolve this issue. It is very critical now as the user needs to execute some important reports.
    Thanks in Advance.
    Ramkumar C

    Hi Chandra,
    Try the following:
    1. Go to tcode RSSM
    2. Enter the cube ZM_CD01 (all the other cubes) then click change.
    3. Afterwards, u201Cunchecku201D ALL Authorization Objects under this cube. (Repeate the same for all the cubes)
    4. Click Save.
    This will resolve the issue.
    Rgds,
    Raghu

Maybe you are looking for