cancel
Showing results for 
Search instead for 
Did you mean: 

Single addon project in VB.net

Former Member
0 Kudos
148

Hi All,

I am facing problem while integrating all formas into one solution. I am using vb.net. Can anyone give me any idea ahow to integrate all form in one solution? I used simple form design in .net , declared oCompany as global variable.How do I open form whenever i click on its menu item. Where Do I create form unique id by creattionpackage( in main file or the form which i want to load)? Please help me ..

thanks in advance

tony

Accepted Solutions (1)

Accepted Solutions (1)

former_member184566
Active Contributor
0 Kudos

Hi Tony

First of all, you must create the form with sbo objects and not vb.there is two ways.

1)Create it through code, buttons,ect can also be created through code. example to create form

Private Sub DrawForm()

Dim cp As SAPbouiCOM.FormCreationParams

Dim oForm As SAPbouiCOM.Form

Try

cp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

cp.UniqueID = "UI"

cp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed

Try

oForm = SBO_Application.Forms.AddEx(cp)

Catch ex As Exception

SBO_Application.MessageBox("Form is open already")

End Try

oForm.ClientWidth = 400

oForm.ClientHeight = 150

oForm.Left = 290

oForm.Top = 210

oForm.AutoManaged = True

oForm.Visible = True

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

End Sub

2)Second method is to use the screen painter (add on) to create your forms with buttons,matrix,ect and then through code you'll load it. It is best to do it this way as the performance is much better.

Then to open your form when clicking on the menu. there is a menuevent. By using this you can see when a click is made on the menu and then you can call the procedure that makes the form.

Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent

Try

If (pVal.MenuUID = "MenuID") And (pVal.BeforeAction = False) Then

Try

Dim f As SAPbouiCOM.Form

f = SBO_Application.Forms.Item("FormUID")

f.Select()

Catch ex As Exception

DrawForm()

End Try

End If

end sub

Hope the above helps.

Former Member
0 Kudos

Hi Louis,

thank you . Hope your answer will help me. Which way is best for making addon, suppose I have 4 different form for different purpose, creating all 4 forms in one files and create form by calling drawform() function or using different code file different forms?If i use second method , how will I create form ( how to call drawform()), where will I catch events of ohter form?

thanks in advance

former_member184566
Active Contributor
0 Kudos

Hi Tony,

The best is for you to create four different forms with the screen painter. The screen painter will save it as an xml file. Just to test make a blank form and give the form a id called "FormID", save it as "New_Form" with the extension "srf". You'll still do the menuevent, but the drawform you call will be different, it will look like

Public Sub DrawForm2()

Dim oItem As SAPbouiCOM.Item

Dim oCombo As SAPbouiCOM.ComboBox

Dim oEdit As SAPbouiCOM.EditText

Dim oMatrix As SAPbouiCOM.Matrix

Dim cp As SAPbouiCOM.FormCreationParams

Try

LoadFromXML("New_Form.srf")

Catch ex As Exception

SBO_Application.MessageBox("Form is open already")

End Try

oForm = SBO_Application.Forms.Item("FormID")

oForm.SupportedModes = "15"

oForm.Visible = True

End Sub

You'll see i have a procedure called LoadFromXML,it will load the xml. well here it is

Private Sub LoadFromXML(ByRef FileName As String)

Try

Dim oXmlDoc As Xml.XmlDocument

oXmlDoc = New Xml.XmlDocument

'// load the content of the XML File

Dim sPath As String

sPath = IO.Directory.GetParent(Application.StartupPath).ToString

#If DEBUG Then

oXmlDoc.Load(sPath & "\MyForm\" & FileName)

#Else

oXmlDoc.Load(sPath & "\Recurring Billing\MyForm\" & FileName)

#End If

'// load the form to the SBO application in one batch

SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

This should do the trick, hope it helps

former_member184566
Active Contributor
0 Kudos

Oh,not sure if you know. But the screen painter is a add on that works from inside sbo. Once you have installed it you go to tools->screen painter and then you'll be in the screen painter. There you have a graphical facility to design your form.

Former Member
0 Kudos

Hi Louis,

thanks for your answer.

Answers (0)