Skip to Content
author's profile photo Former Member
Former Member

creating button in sap standard screen also display in the SAP main form even I closed that screen

Hi experts,

Below is my code to create button but its also created in main form please find the attachment. Help me


Case SAPbouiCOM.BoEventTypes.et_FORM_RESIZE

Dim oItem As SAPbouiCOM.Item

Dim oButton As SAPbouiCOM.Button

frmBatchnumber = oApplication.Forms.ActiveForm


oItem = frmBatchnumber.Items.Add("B_batch2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)

Catch ex As Exception

End Try

oItem = frmBatchnumber.Items.Item("B_batch2")

oItem.Left = frmBatchnumber.Items.Item("2").Left + 70

oItem.Top = frmBatchnumber.Items.Item("2").Top

oItem.Height = frmBatchnumber.Items.Item("1").Height

oItem.Width = frmBatchnumber.Items.Item("1").Width + 10

oItem.Enabled = True

'oItem.LinkTo = "2"

oButton = oItem.Specific

oButton.Caption = "BatchAllocation"

Catch ex As Exception

End Try

screenshot.png (10.1 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Dec 17, 2015 at 10:32 AM

    Hi Robert,

    I doesn't see anything wrong in your piece of code, but I believe that your logic is execute two times, and in each time your ActiveForm was different.

    Try this:

    Put in your form resize rule, an if statement with the following code:

    if( !pVal.BeforeAction)


    //your code


    Hope it helps



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.