cancel
Showing results for 
Search instead for 
Did you mean: 

​SDK: How to properly execute click button

former_member272979
Participant
0 Kudos

Hi,

I’m currently writing code for the procurement wizard to default to a certain step of the wizard. For my below code example, when the user on panel two, it will execute the next button and go to step three. However, with the below sample code, the same code keeps executing again for panel 2. Do you know what I need to add to my code to ensure the code only execute once?

If pVal.FormType = "540010007" And pVal.ItemUID = "_wiz_next_" And pVal.EventType = 1 Then 'And pVal.BeforeAction = True Then
	Dim oSOForm As SAPbouiCOM.Form
	oSOForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)


	If (oSOForm.PaneLevel = 2) Then
		MsgBox(pVal.EventType)
		Dim btnNext As SAPbouiCOM.Button
		btnNext = oSOForm.Items.Item("_wiz_next_").Specific
		btnNext.Item.Click()
	End If
End if

<br>

Regards

William

Accepted Solutions (1)

Accepted Solutions (1)

former_member233854
Active Contributor
0 Kudos
If pVal.FormType = "540010007" And pVal.ItemUID = "_wiz_next_" And pVal.EventType = 1 Then And pVal.BeforeAction = False Then
	Dim oSOForm As SAPbouiCOM.Form
	oSOForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)


	If (oSOForm.PaneLevel = 2) Then
		MsgBox(pVal.EventType)
		Dim btnNext As SAPbouiCOM.Button
		btnNext = oSOForm.Items.Item("_wiz_next_").Specific
		btnNext.Item.Click()
	End If
End if
former_member272979
Participant
0 Kudos

Hi Danilo,

Your suggestion does change the panel but the procurement wizard does not work correctly using that method as it still thinks it on the previous step. Since the procurement wizard SAP provides expects the buttons to be used to change the panel, I must simulate having the next button pressed to skip the next step.

Is there a event I can catch when the panel is done loading, execute btnNext.Item.Click() ?

Regards,

William

former_member233854
Active Contributor
0 Kudos

I update the answer, I used BeforeAction = false now

Din`t test though.

former_member272979
Participant

Hi Danilo,

The new solution you provided work. Can you do one favour for me? For the if statement I have part of the code was comment out. It was this text showing below

'And pVal.BeforeAction = False Then

Can you remove the single quote before the word and, and also before the text before and, remove the word then? This was the change I need to make the code work correctly.

Thanks for the help,

William

former_member233854
Active Contributor

Good that it works! I edited the answer as your comment, tks!

Answers (0)