Skip to Content

How to get item events for "B1 User Query" form

Hello all,

I have an important doubt regarding the event filters. I am using event filters for my application and it is working fine.

Now I have a requirement that I need to add a button in the B1 Query execution form.

By B1 Query Execution form, I am referring to a form which is launching launching from the Query manager form. When we double click a query from query manager, this will launch with two parts, the upper part is the query string and bottom part with the execution result.

This form is having different FormTypeEx properties.

When I open 3 forms of the same kind, all the three are having different FormTypeEx properties.

1. 66-U-R

2. 70-U-R

3. 6-S-R

So I can't add event filters for these forms in common. I need a button for every forms and when the button is pressed, i have to do some specific task.

How can I add event filters to this? or how can I manage this?

Thanks in advance

Anoop

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 07, 2010 at 10:53 AM

    Hello,

    follow these steps:

    FormTypeEx for User queries based on Internal key of User Query in ouqr table. Take care, it is chaning, when you add a new query.

    You can track the FormTypeEx of an Query Result window by the following logic

    -U-R if a user defined Query

    -U-S if a system defined Quey

    select cast(intrnalkey as nvarchar)+'-S-R', QName from OUQR where QCategory = -2
    select cast(intrnalkey as nvarchar)+'-U-R' as FormTypeEx, QName from OUQR where QCategory != -2

    By this, you can add your eventfilter, and you can put a button on ET_FORM_LOAD and Before Action = false conditions

    Regards,

    J

    Edited by: János Nagy on Apr 7, 2010 12:53 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Anoop Krishnan

      Hello,

      Use AddEx Function of filer object to record the FormTypes to the filters. (et_form_load event)

      So :

      1. Run a recordset agains the requested queries (by name you can locate) to receive the formtypeex parameters

      2. Use oEventFilter.AddEx (FormTypeEx) to record the filters

      You can use them as normal sap/user defined forms, just the name formtype is string type not numberic

      You can use pval.FormTypeEx to locate them in eventhandler.

      Regards,

      J.

  • Apr 08, 2010 at 12:37 PM

    I had looped 1 to 1000 and added 1000 query forms using

    for(i=1;i<=1000;i++)

    oFilter.Addex(i.ToString()+"-U-R");

    I know this is not a perfect way to achieve this and I am looking for it.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Anoop,

      I have given every information to you, and i do not understand why you looped.

      Based on I have written, you can provide a simple code like this

      Dim oRs As SAPbobsCOM.Recordset = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
              Dim s As String = "select cast(intrnalkey as nvarchar)+'-S-R', QName from OUQR where QCategory = -2 and QName in ({0})"
              ' replace QUERYNAME1 with your 1st Query Name , QUERYNAME2 with 2nd query name
              s = String.Format(s, "'QUERYNAME1','QUERYNAME2'")
              oRs.DoQuery(s)
              Dim oFilters As New SAPbouiCOM.EventFilters
              Dim oFilter As SAPbouiCOM.EventFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_ALL_EVENTS)
      
              Do While Not oRs.EoF
                  oFilter.AddEx(oRs.Fields.Item(0).Value)
                  oRs.MoveNext()
              Loop
      
              s = "select cast(intrnalkey as nvarchar)+'-U-R', QName from OUQR where QCategory != -2 and QName in ({0})"
              ' replace QUERYNAME1 with your 1st Query Name , QUERYNAME2 with 2nd query name
              s = String.Format(s, "'QUERYNAME1','QUERYNAME2'")
              oRs.DoQuery(s)
              Do While Not oRs.EoF
                  oFilter.AddEx(oRs.Fields.Item(0).Value)
                  oRs.MoveNext()
              Loop
      
              sbo_application.SetFilter(oFilters)

      Regards,

      So Simple ? Not?

      J

      Edited by: János Nagy on Apr 9, 2010 9:03 AM

      Edited by: János Nagy on Apr 9, 2010 9:03 AM