11-05-2016 9:11 AM - edited 02-03-2024 5:10 PM
Hi, everybody
I am closing my previous thread and posting a much simplified version so as to encourage response.See previous:
https://answers.sap.com/questions/50761/how-can-we-catch-the-after-pressed-event-of-the-re.html
Please see the attached picture which explains my problem:
Any help will be much appreciated.
Thanks,
Leon Lai
Hi Leon,
Use the following if statement:
If (pVal.BeforeAction = False 'After sap action
And pVal.ActionSuccess = True 'Action with sucess
And pVal.FormTypeEx = "120060805" 'Reconciliation form
And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED 'Item pressed with BeforeAction false will be fired after close the system message
And pVal.ItemUID = "120000001" 'Reconcile button
And pVal.FormMode = 1
Then
'Do your logic
End If
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leon,
Switch from the Click event to the Item_Pressed event.
Click event ActionSuccess is generally equal to true (think of the Click event as the "mouse button down" event).
The Item_Pressed however, takes into consideration whether the action performed by the button was actually successful (think of the Item_Pressed as the "mouse button up" event).
Pedro Magueija
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Diego,
Thanks for your reply.
Your suggestion seems to work. I am doing a few more tests before marking your answer correct.
Just one question:
Please see the attached picture capture1.jpg which explains my question:
ALSO I am a bit lost with the new website. How do we mark an answer Useful or Answered?
ADDED -----------------
Where, in the UI API Help File can we get the codes for form modes?
I got BoFormMode in the Help Files (see capture2) but I am not sure if we are talking about the same thing.
Best Regards
Leon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leon,
As you show in the second image, the FormMode indicates the state of the form, if it is in Add, update, search, ok mode. In the answer that I wrote, the system message doesn't matter.
1. We will listen the item pressed event on Reconciliation Form(120060805).
2. When you click on Reconcile Button(12000001), the event item pressed will be fired with the beforeAction equals true, and the formMode is equal 2 (Update mode).
3. The system message will appear, and suppose you click yes. The sequence of Item pressed of Reconcile button will be fired, but now with beforeAction equals false. If the action of reconcile occurs with sucess, SAP will change the form mode for 1(Ok mode) and our action will be executed. Suppose that in the system message you click no. The sequence of Item pressed of Reconcile button will be fired, with beforeAction equals false, but the formMode of the form it will formMode 2, because you still with in Update mode(with some rows selected).
Hope it is clear.
Kind Regards,
Diego Lother
Hi, Diego
Your explanation is very clear.
And your code works perfectly. Great!
I have been struggling in vain for the correct answer for months.
Thanks a lot and Best Regards,
Leon
--------
PS.
I am trying now to mark the question as answered. But this is the 1st time I do this.
So, if it doesn't work, hope you won't mind.
Hi, Pedro
Thanks for your reply. I will try your suggestion on Monday.
But I have a bigger problem. How can I ensure that the Item Pressed event refers to the YES button I am interested in, and not to the YES button on other System Message forms?
The problem appears to be a hard nut to crack.
Best Regards
LEON
ADDED
How do we award points in this new web site?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.