cancel
Showing results for 
Search instead for 
Did you mean: 

catch close event in order's form

former_member344412
Participant
0 Kudos

Hello all,

I would like to know what is the event when I close an order in sap form.

Tks for your help.

Laetitia

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Laetitia,

I think catching form close Item event works. Because as I found, when choosing Close menu, a message box will send out saying that do you want to cancel/close form. When you click the button, a form close event will be sent.

In this case, you could do this with the code below.

Private Sub m_oApplication_ItemEvent(ByVal FormUid As String, pVal As SAPbouiCOM.ItemEvent, BubbleEvent As Boolean)

Select Case pVal.EventType

Case et_FORM_CLOSE

MsgBox "Catch!" ' please add your code here.

End Select

End Sub

If this solution does not fit your situation, you can catch the menu event directly. Please refer to the code below.

Private Sub m_oApplication_MenuEvent(pVal As SAPbouiCOM.IMenuEvent, BubbleEvent As Boolean)

If pVal.BeforeAction = True Then

Select Case pVal.MenuUID

Case "1286"

' Do whatever you want here.

End Select

End If

End Sub

Hope these two solutions work.

Best Regards,

Nicky He

former_member344412
Participant
0 Kudos

I tried the 2nd solution. Because I do not find the form id for the first solution.

The second one works but I have to catch if the user click on "Yes" or "No". But it is a good solution for the moment

Tks for your help.

Laetitia

Former Member
0 Kudos

One way of doing it would be to watch for the followng ItemPress events:

SAP close button ( ItemUID = 2 )

SAP Ok button ( ItemUID = 1 ), ( when FormMode = OK )

former_member344412
Participant
0 Kudos

In fact I would like to close order and not form.

I can close order via data / close. And this is the event that I want to catch.

Tks

Former Member
0 Kudos

In that case, look for the 'Close' menuevent.