cancel
Showing results for 
Search instead for 
Did you mean: 

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

leon_laikan
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

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

Answers (3)

Answers (3)

pedro_magueija
Active Contributor

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

leon_laikan
Participant
0 Kudos

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

former_member185682
Active Contributor
0 Kudos

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

former_member185682
Active Contributor
0 Kudos

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

leon_laikan
Participant

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.

leon_laikan
Participant
0 Kudos

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?