cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member682029
Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

former_member682029
Contributor
0 Kudos

That's fine.

But How can I update the event filter so that all these forms will be managed in the item event?

Thanks

Anoop

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

former_member682029
Contributor
0 Kudos

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.

Former Member
0 Kudos

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