Skip to Content
0

How to catch pValActionSuccess event when the YES button on a System Message form is clicked?

Nov 05, 2016 at 09:11 AM

81

avatar image

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:

capture.jpg

Any help will be much appreciated.

Thanks,

Leon Lai

capture.jpg (360.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
DIEGO LOTHER Nov 05, 2016 at 05:17 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 05, 2016 at 11:39 AM
1

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

LinkedIn | Twitter | Blog

Share
10 |10000 characters needed characters left characters exceeded
Leon Lai Kan Nov 05, 2016 at 03:59 PM
0

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?

Share
10 |10000 characters needed characters left characters exceeded
Leon Lai Kan Nov 07, 2016 at 05:54 AM
0

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:

capture1.jpg

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.

capture2.jpg

Best Regards

Leon


capture1.jpg (88.1 kB)
capture2.jpg (184.8 kB)
Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

0

Leon,

About mark as answer as a correct answer. I still not open any question at this new forum, then I still don't know how to do that. :(

Kind Regards,

Diego Lother

0

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.

1