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...)

Similar Messages

  • 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("+");)

  • Query SAP Business One Orden de venta, entrega, factura

    Hola que tal,
    De antemano muchas gracias por su apoyo, me gustaría mucho me pudieran ayudar con una consulta para mostrar las ordenes de venta que pertenezcan a una entrada y esta a su vez a las facturas?
    Select
    D1.U_FOLIO as 'Folio',
    T3.Docnum as 'Entrega',
    T0.DocNum as 'Factura',
    T0.Doctotal as 'ImporteFactura',
    end as Total,
    t0.DocDate as 'FechaCont',
    D1.U_FECHFORM as 'FechaFor',
    t0.CardName as 'Banco'
    from ODLN T3
    left JOIN DLN1 D1 ON T3.DocEntry = D1.DocEntry
    left JOIN ORDR T2 ON T2.DocEntry = D1.BaseEntry
    left join rdr1 t1 on t2.docentry = t1.docentry
    right join OINV T0 ON T3.NumAtCard = t0.NumAtCard  or T3.Doctotal=T0.Doctotal
    Me funciona perfecto para cuando una factura no esta cancelada por nota de crédito, que si esta cancelada con nota de crédito me vuelve a mostrar la entrega tanto la cancelada como la que esta abierta.
    Gracias, que pasen buena tarde!

    Hola, para estar claros con la pregunta. Si el objetivo es que me muestre las facturas que tienen por obligacion que estar en una orden, luego en una entrada y por ultimo la factura debes utilizar el siguiente query con INNER JOIN
    from ODLN T3
    INNER JOIN DLN1 D1 ON T3.DocEntry = D1.DocEntry
    INNER JOIN ORDR T2 ON T2.ObjType  = D1.BaseType and T2.DocEntry = D1.BaseEntry
    INNER JOIN RDR1 t1 on T2.DocEntry = T1.DocEntry
    INNER JOIN INV1 T4 ON D1.ObjType  = T4.BaseType and D1.DocEntry = T4.BaseEntry 
    INNER JOIN OINV T0 ON T0.DocEntry = T4.DocEntry and T0.DOCSTATUS='O'
    Si lo que necesitas es que sea opcional, dime cuales condiciones debe considerar para entenderlo bien.
    Yo hice la prueba en mi ambiente de esta manera y tiene el resultado que te comento.

  • Query SAP Business One Orden de Venta x Entrega x Factura x Pago

    HOLA COMO PUEDO HACER ONU Reporte Qué me muestre El Numero De La Orden de Venta (ORDR) y me muestre also do Entrega (ODLN) y me muestre do Factura (OINV) y do Pago (ORCT), Como SI FUERA ONU Mapa de Relaciones , ademas de Filtrar por serie de similares pedido y Rango de Fechas ya Que lo intente relacionando Pedidos estafa Entregas Pero me error sin marca en el BaseType:
    T0 SELECT. [DOCNUM], T0. [DocTotal], T2. [DOCNUM]
    DE ORDR T0 INNER JOIN NNM1 T1 EN T0.Series = T1.Series RIGHT JOIN ODLN T2 EN T1.BaseType = 15 y = T1.BaseEntry T2.DocEntry
    DONDE T1. [SeriesName] = [% 0] y T0. [DocDate]> = [% 1] y T0. [DocDate] <= [% 2]
    Si Alguien Puede del ayudarme estafa this please consulta Gracias.

    Hola, para estar claros con la pregunta. Si el objetivo es que me muestre las facturas que tienen por obligacion que estar en una orden, luego en una entrada y por ultimo la factura debes utilizar el siguiente query con INNER JOIN
    from ODLN T3
    INNER JOIN DLN1 D1 ON T3.DocEntry = D1.DocEntry
    INNER JOIN ORDR T2 ON T2.ObjType  = D1.BaseType and T2.DocEntry = D1.BaseEntry
    INNER JOIN RDR1 t1 on T2.DocEntry = T1.DocEntry
    INNER JOIN INV1 T4 ON D1.ObjType  = T4.BaseType and D1.DocEntry = T4.BaseEntry 
    INNER JOIN OINV T0 ON T0.DocEntry = T4.DocEntry and T0.DOCSTATUS='O'
    Si lo que necesitas es que sea opcional, dime cuales condiciones debe considerar para entenderlo bien.
    Yo hice la prueba en mi ambiente de esta manera y tiene el resultado que te comento.

  • Business one : multilocation invoicing

    scenario : We have a prospect in retail and trading industry. They have six locations at present and a head office. The location will increase in near future. Their main activity is retailing through their locations. At locations : the main activity's are i) invoicing / billing and ii) stock checking and few reports at the end of the day.
    Query:  Is Business one will support multi location invoicing/ billing ?

    也有一个类似的问题:客户提出2005B怎么实现法语界面?

  • How to add drop down list for query manager report in sap business one

    Hi Every one,
    I need drop down list for parameter selection in sap business one Query Manager.I have two Parameters 'Sales Order','Invoice'.
    Please suggest.
    Thanks and Regards
    DEV

    Hi,
    you need to use this :
    /*select from [dbo].[OINV] T2*/
    DECLARE @Invoice varchar(100)
    /*where*/
    set @Invoice =/* T2.DocNum  */N'[%2]'
    you can change the tables and the parameter number but you have to write it exactly that way.
    when you run the query within the SBO you will get list of objects ( in this case list of invoices)
    hope it was helpful
    Shachar

  • I am using apple mail on my Mac and have two different accounts set up, one personal and one business. when i send mail a copy of the message is being saved into my business account swell.

    Both accounts are Imap but the business one is Gmail and the persoanl one is 1and1. when i compose new mail in my personal account I make sure it says its going from my 1and1 account but for some reason the message appears in both sent boxes.
    I need to fix this as I dont want other people using the business account seeing my personal sent emails!
    This has only just started in last couple of days when I did something on accounts but cant think what that would have been.
    hope someone can help.

    I'd like to have one Apple Mail application for my one very important email account while the rest can stay on a different Apple Mail app.
    Consider using Thunderbird for the "rest."

  • SAP Business One UI/DI API SQL query

    I am using SAP Business one UI/DI API with C#, how do I get data from the database using a select statement? I would like to obtain items from the database using a condition 'WHERE' and fill a matrix with the information.

    ok - here's a c# sample:
    oForm = globals.SBO_Application.Forms.Item(FormUID);
    oForm.DataSources.DataTables.Add("DATA");
    oForm.DataSources.DataTables.Item("DATA").ExecuteQuery("SELECT CardCode, CardName FROM OCRD");
                   ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtxList").Specific)).Columns.Item("ColCC").DataBind.Bind("DATA", "CardCode");                       
    ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtxList").Specific)).Columns.Item("ColCN").DataBind.Bind("DATA", "CardName");
    ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtxList").Specific)).Clear();
    ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtxList").Specific)).LoadFromDataSource();
    ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtxList").Specific)).AutoResizeColumns();
    i hope it helps
    regards
    David

  • IBolt - SAP Business One query

    Hi,
    I have a question regarding using ibolt to push a ar order to Business One , using an xml file
    I keep getting the error
    "1006 , Internal error(3): Failed to call method: GetXMLelementCount (Illegal XML)"
    driving me nuts...
    any help is appreciaed to debug  this..
    following is the piece of xml i used.
      <?xml version="1.0" encoding="UTF-8" ?>
    - <!--  edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by MAGIC SOFTWARE INDUSTRIES (MAGIC SOFTWARE INDUSTRIES)
      -->
    - <!-- Sample XML file generated by XMLSPY v2004 rel. 3 U (http://www.xmlspy.com)
      -->
    - <Order xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="New_Order.xsd" orderDate="2004-07-13">
    - <CustomerDetail country="US">
      <Customer_ID>7</Customer_ID>
      <Customer_Name>Rachel Ackerman</Customer_Name>
      <state>Israel</state>
      <city>Jerusalem</city>
      <street>King David St.</street>
      <zip>95464</zip>
      </CustomerDetail>
      <OrderNumber>10234</OrderNumber>
      <Order_Total>799</Order_Total>
    - <items>
    - <item partNum="KT0006">
      <Product_ID>6</Product_ID>
      <Product_Name>Mixer</Product_Name>
      <quantity>1</quantity>
      <USPrice>75</USPrice>
      <shipDate>2004-07-25</shipDate>
      </item>
    - <item partNum="KT0007">
      <Product_ID>7</Product_ID>
      <Product_Name>Food Processor</Product_Name>
      <quantity>2</quantity>
      <USPrice>82</USPrice>
      <shipDate>2004-07-25</shipDate>
      </item>
    - <item partNum="VD0010">
      <Product_ID>10</Product_ID>
      <Product_Name>Television</Product_Name>
      <quantity>1</quantity>
      <USPrice>560</USPrice>
      <shipDate>2004-08-10</shipDate>
      </item>
      </items>
      </Order>

    Hi Indika,
    I remember having a similar problem.
    Solved it through removing the
    "<!-- Sample XML file generated by XMLSPY v2004 rel. 3 U (http://www.xmlspy.com)
    --> "
    B1 seems to have problems with comments in the XML .....
    Regards,
    Holger

  • Error in saving query

    Dear All,
    I have installed 2007B release. I have created new database. When i am trying to save a new query in this database, an error message appears "To generate this document first define document series in administration module. Message [131-3]"
    If anyone has the solution for this kindly help.
    Regards,
    Ammheya

    Dear,
    As of SAP Business One 2007 A January patch (PL15), user queries are saved properly.
    If you encounter the above described scenario while working in an earlier patch, please contact the Global Support Center.
    Regards
    Apple

  • 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

  • Problem while importing a Crystal Report in SAP Business One

    Hi Experts,
                        I am facing a problem while importing a Crystal Report in SAP Business One, it displaying an error  "No matching records found  'Queries' (OUQR) (ODBC -2028)  [Message 131-183]" , and there is no use of this table OUQR  in the Query.
    Kindly let  me know the solution.
    Regards
    Rahul Singh

    Hi Rhaul,
    i don't exactly know why this is a problem, but if your not on latest (881 p10) then upgrade and try again.
    Or as a workaround,
    try saveing from CR to SAP with the CR add-on. That usualy works better then the import.
    Regards,
    D

  • How can I execute a query from a BSP application?

    How can I execute a query from a BSP application?
    I´m trying to execute a Query from intranet. I´ve been looking for examples, but the templates I´ve found doesn´t help me.
    does anybody has an example?
    Thanks.

    Hi
    Have you designed the BSP application ?
    design it first with one page
    page will have layout and Event handlers
    Design the layout with the fields
    in the event handler there are events
    in the event On Initiailization or ON inputprocessing write the select query similar to what we write in routine ABAp and fetch the data into ITAB and that has to be passed to the Layout
    see the doc
    BSP
    To learn how to create Web applications with Business Server Pages, you can work through the simple tutorials that build on each other. You should be able to run through all of the steps described here in your own system.
    If you want to develop Web applications with BSPs, your system must meet the following requirements: Prerequisites for Creating Web Applications.
    The following tutorials are available:
    · First Tutorial: First Steps with Business Server Pages…
    · Second tutorial: A Small BSP Application and A Small BSP Application with HTMLB
    · Third tutorial: Our First Online Bookshop
    · Fourth tutorial: Further Developing the Bookshop
    · A small Tutorial is also available for your first steps with the Model View Controller design pattern.
    · For a more complex MVC tutorial based on the third tutorial, see: Our Little Online Bookshop Using MVC and HTMLB
    When creating BSP applications, note the browser dependencies described in Note 598860.
    steps:
    1) start the transaction RZ10.
    2) now u u have to select Profile name, so select the INSTANCE Profile from the list of options given with the Profile parameter list.U may find multiple instance profile in the list, so select the profile in which ur server name is given.
    3) u will also find three options in the same window.
    Administrator data, Basic Maintenance, and Extended Maintenance. So select the last one from that.
    4) Now click on change button.
    5) here u will find parameter icm/host_name_full, so now set it as FQDN.
    6) Now copy ur settings with new version number.
    7) Activate that version.
    8) And now please restart ur WAS.
    So this will set ur FQDN, and also don't forget to login using Admin User.
    Now u also check for following service are active in your ICF setting or not,( just start transaction code SICF)
    /default_host/sap/bc/bsp/sap
    /default_host/sap/bc/bsp/sap/system
    /default_host/sap/bc/bsp/sap/public/bc
    /def ault_host/sap/public/bc
    /default_host/sap/public/bc/ur
    /default_host/sap/public/bsp/sap/public
    /default_host/sap/public/bsp/sap/public/bc
    /defaul t_host/sap/public/bsp/sap/system
    /default_host/sap/public/bsp/sap/htmlb
    if not then activate all.
    check this link
    Read this weblog...
    /people/brian.mckellar/blog/2003/09/25/bsp-in-depth-fully-qualified-domain-names
    http://www.thespot4sap.com/articles/SAP_WAS_Creating_BSP_Apps.asp
    it consists of screen shots also
    Check it.
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/101c3a1cf1c54be10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e9/bb153aab4a0c0ee10000000a114084/frameset.htm
    Regards
    Anji

  • Hide and activate fields in SAP Business One

    Hi,
    How do I see the following in SAP Business one 2007 A?
    1 - Where do I see the option of hiding or making a filed mandatory, optional etc.? Can i hide some fields in A/P invoice entry? How do I do that?
    2 - How do I create a field or a column which will populate necessary details. For example..How do I create a column named amount in the A/P invoice so that it shows the corresponding amout of the invoice near the column named Invoice number?
    3 - How to access a particular column from a table structure? Do I need to write an SQL query for this?
    4 - How to pull up a field from a table and make is visible for the users? Do I need to be an ABAP expert for this?
    5 - What are stored procedures?
    Please let me know!! Thanks

    3 - How to access a particular column from a table structure? Do I need to write an SQL query for this?
    Try the link below:
    how do make link between query and UDF
    Yes, you write the query by going to Tools->Query Generator.
    You need to know the FMS number for the varialbe AMOUNT you created.
    You can know that by turning on debug info View->Ssystem Info, and then placing your cursor on AMOUNT. At the bottom left know its FMS variable number. There are multiple ways of dealing with.
    Use the above variable in the Query Generator with a $ sign. Save the query. General (some name)
    Then attach the above query to AMOUNT ShiftF2 and click to dril down to saved query and attach it. Choose the type refreshment.
    I am missing out on some small details, but you have to try it you will get there.

  • How to Define and Use Formatted Search in Sap Business One 2007

    Hi
        Any Document on How to Define and Use
    Formatted Search in Sap Business One 2007.
    Thanks

    Hi Manish,
    It is Very simple Procedure of defining FMS(Formatted Search)
    in SAP 2007B Same as SAP 2005B & SAP8.8 Version
    Do this,
    ->> Open the require Document.
    for ex. IF you add the UDF in Marketing Document(Sales/Purchase)
    1. Goto the UDF (or) any Default(Original) Field and Click ShiftAltF2.
    2. Select the SEARCH BY SAVED QUERY.
    3. Assign the FMS Query.
    4. Select the AUTO REFRESH WHEN FIELD CHENGES.
    5. Select the require Auto refresh field
    6. Check the Refresh Regularly (or) Display Saved Values.
    Regards,
    Madhan.

Maybe you are looking for

  • Need Help Uninstalling the Audig

    I have an Audigy 2 SB0240 sound card in the pc. I want to perform a fresh re-install of the original creative disc software & drivers?that came with the card. I need to know in exactly in what order in the Control Panel\ add\remove list should I star

  • Can't delete or save contacts

    I'm on a 17" mid 2010 MacBook Pro running OS X 10.9.3. When I open contacts and try to add a new contact then click done or save it doesn't save after closing. My entry will only exist until closing, when I open up contacts again it's gone. Also I ca

  • How to install Firefox 5.1 in Ubuntu 11.4

    How do I install Firefox 5.1 into Ubuntu 11.4 using a terminal window.

  • Need to change as one insert stmt

    Hi, I'm using below two insert statements in side the procedure.can i re write as a one insert.pls help         INSERT INTO REP_ITEM_STAT_OPN (         REP_ID, ITEM_ID, TOT_STUD_BY_ITEM, TOT_TIME_BY_ITEM, MIN_TIME_BY_ITEM,MAX_TIME_BY_ITEM)         SE

  • Install and configure Cisco Network Analysis Module NAM-2

    Hi, Does anyone have a step-by-step document on how to install and configure Cisco NAM-2 module ? Thanks in advance. Regards, Lamine