cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Button to Active Form

Former Member
0 Kudos

Hi,

I created button in PO on Form load event. its working fine.but

how to add a button on the active(PO) form once My add-on is started?

Regards,

Ganesh k

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Ganesh,

you must add the button on system form everytime the form is loaded. There is no method for loading once and dont care about new opening of form.

Former Member
0 Kudos

hi Petr,

i will expalin little bit more about my problem. currently i created a button while the PO is Loaded. sofar is working fine.

now the add-on is disconnected..and new PO is opened. now PO screen in Active Status. now my add-on is connected again. since i written button creation code on the form load event. the active form doesnt contain the button.

how to add button on active PO?

(Without closing the Active Form and Opening again)

regards,

Ganesh K

Former Member
0 Kudos

ok, I undestand now. Try to check in form form activate event, if the button is there and if not, add there (same method as in form load event)

Former Member
0 Kudos

U can use SBO_Appln_AppEvent and put ur code here.

Here u get the active form and if its PO then u can add ur button i guess....

But this will not work if PO form is not in focus.

Just check the feasiblity of the idea.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Ganesh,

When the Add-On loads, you can check the oApplicatication.Forms collection and check if there is any PO open.


    Public Function OpenPO() As Boolean
        For Each iform As SAPbouiCOM.Form In oApplication.Forms
            If iform.TypeEx = PO_FORM_TYPE Then Return True
        Next
        Return False
    End Function

Regards,

Vítor Vieira

Former Member
0 Kudos

Hi,

i checked for the existance of my button in my active form, if not exist i added my button in et_FORM_ACTIVATE Event. its working now.

If pVal.EventType = et_FORM_ACTIVATE And pVal.FormTypeEx = "142" And FLAG = False Then

oOrderForm = sbo_application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)

Dim ii As Integer

For ii = 0 To oOrderForm.Items.Count - 1

If oOrderForm.Items.Item(ii).UniqueID = "MyBtnId" Then

FLAG = True

End If

Next ii

If FLAG = False Then

ADDBUTTON()

End If

End If

Thanks For the Suggestions..

regards,

Ganesh K