cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Folder Tab

CRVMANISH
Contributor
0 Kudos

Hello Experts ,

I have design form in screen painter i have added 2 folder(tabs) say Folder1 and Folder2 under Folder1 i have added 2 combo boxes and text boxes, Similarly in Folder2 i have added 2 combo boxes and text boxes..i have also given pane level and f'rom pane ' 'to pane' properly, In Preview mode it works fine , but when i load this form through Vb dot Net it does not show me the items in Folder1 and Folder2

when i click it ,

Plz suggest me

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If pVal.FormUID = "frmid" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = False And pVal.InnerEvent = False Then

Try

oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)

If oForm Is Nothing Then Exit Sub

Select Case pVal.ItemUID

Case "item id 1"

oForm.PaneLevel = "1"

Case "item id 2"

oForm.PaneLevel = "2"

End Select

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

End If

it will work

CRVMANISH
Contributor
0 Kudos

Hello

I have added this code but its not working , i have added it in item event ,

actually i have design form in screen painter i have added the folder and there items ,

i have not done coding for adding folders and there items,

i am loading srf file to B1 thru coding

Plz suggest

Former Member
0 Kudos

it will work ...

pls send me ur coding

CRVMANISH
Contributor
0 Kudos

I have used 6 folder tabs , for time being i have code for only 2 folder tabs with not all items included in folder,

This is my code plz suggest

-


Option Strict Off

Option Explicit On

Friend Class AddingMenuItems

'//**********************************************************

'// This parameter will use us to manipulate the

'// SAP Business One Application

'//**********************************************************

Private oCompany As SAPbobsCOM.Company

Private WithEvents SBO_Application As SAPbouiCOM.Application

Private oForm As SAPbouiCOM.Form

Private Sub AddMenuItems()

'//******************************************************************

'// Let's add a separator, a pop-up menu item and a string menu item

'//******************************************************************

Dim oMenus As SAPbouiCOM.Menus

Dim oMenuItem As SAPbouiCOM.MenuItem

Dim i As Integer '// to be used as counter

Dim lAddAfter As Integer

Dim sXML As String

'// Get the menus collection from the application

oMenus = SBO_Application.Menus

'----


'Save an XML file containing the menus...

'----


'sXML = SBO_Application.Menus.GetAsXML

'Dim xmlD As System.Xml.XmlDocument

'xmlD = New System.Xml.XmlDocument

'xmlD.LoadXml(sXML)

'xmlD.Save("c:
mnu.xml")

'----


Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oMenuItem = SBO_Application.Menus.Item("43520") 'moudles'

Dim sPath As String

sPath = Application.StartupPath

sPath = sPath.Remove(sPath.Length - 3, 3)

'// find the place in wich you want to add your menu item

'// in this example I chose to add my menu item under

'// SAP Business One.

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP

oCreationPackage.UniqueID = "MyMenu01"

oCreationPackage.String = "Patient Management"

oCreationPackage.Enabled = True

oCreationPackage.Image = sPath & "UI.bmp"

oCreationPackage.Position = 15

oMenus = oMenuItem.SubMenus

Try ' If the manu already exists this code will fail

oMenus.AddEx(oCreationPackage)

'// Get the menu collection of the newly added pop-up item

oMenuItem = SBO_Application.Menus.Item("MyMenu01")

oMenus = oMenuItem.SubMenus

'// Create s sub menu

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "MySubMenu"

oCreationPackage.String = "Out Patient Details"

oMenus.AddEx(oCreationPackage)

Catch er As Exception ' Menu already exists

SBO_Application.MessageBox("Menu Already Exists")

End Try

End Sub

Private Sub AddMenuItemsToForm(ByVal oMenuForm As SAPbouiCOM.Form)

Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

Dim sPath As String

sPath = IO.Directory.GetParent(Application.StartupPath).ToString & "\"

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "MyGoToMenu"

oCreationPackage.String = "Form Related Menu"

oCreationPackage.Image = sPath & "UI1.bmp"

Try ' If the manu already exists this code will fail

oMenuForm.Menu.AddEx(oCreationPackage)

Catch ' Menu already exists

SBO_Application.MessageBox("Menu Already Exists")

End Try

oCreationPackage.UniqueID = "MySecondGoToMenu"

oCreationPackage.String = "Second Form Related Menu"

oCreationPackage.Image = sPath & "UI2.bmp"

Try ' If the manu already exists this code will fail

oMenuForm.Menu.AddEx(oCreationPackage)

Catch ' Menu already exists

SBO_Application.MessageBox("Menu Already Exists")

End Try

End Sub

#Region "Single Sign On"

Private Sub SetApplication()

'*******************************************************************

'// Use an SboGuiApi object to establish connection

'// with the SAP Business One application and return an

'// initialized appliction object

'*******************************************************************

Dim SboGuiApi As SAPbouiCOM.SboGuiApi

Dim sConnectionString As String

SboGuiApi = New SAPbouiCOM.SboGuiApi

'// by following the steps specified above, the following

'// statment should be suficient for either development or run mode

sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

'// connect to a running SBO Application

SboGuiApi.Connect(sConnectionString)

'// get an initialized application object

SBO_Application = SboGuiApi.GetApplication()

End Sub

Private Function SetConnectionContext() As Integer

Dim sCookie As String

Dim sConnectionContext As String

Dim lRetCode As Integer

Try

'// First initialize the Company object

oCompany = New SAPbobsCOM.Company

'// Acquire the connection context cookie from the DI API.

sCookie = oCompany.GetContextCookie

'// Retrieve the connection context string from the UI API using the

'// acquired cookie.

sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)

'// before setting the SBO Login Context make sure the company is not

'// connected

If oCompany.Connected = True Then

oCompany.Disconnect()

End If

'// Set the connection context information to the DI API.

SetConnectionContext = oCompany.SetSboLoginContext(sConnectionContext)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End Function

Private Function ConnectToCompany() As Integer

'// Establish the connection to the company database.

ConnectToCompany = oCompany.Connect

End Function

Private Sub Class_Init()

'//*************************************************************

'// set SBO_Application with an initialized application object

'//*************************************************************

SetApplication()

'//*************************************************************

'// Set The Connection Context

'//*************************************************************

If Not SetConnectionContext() = 0 Then

SBO_Application.MessageBox("Failed setting a connection to DI API")

End ' Terminating the Add-On Application

End If

'//*************************************************************

'// Connect To The Company Data Base

'//*************************************************************

If Not ConnectToCompany() = 0 Then

SBO_Application.MessageBox("Failed connecting to the company's Data Base")

End ' Terminating the Add-On Application

End If

'//*************************************************************

'// send an "hello world" message

'//*************************************************************

SBO_Application.MessageBox("DI Connected To: " & oCompany.CompanyName & "Add-on is loaded")

End Sub

#End Region

Public Sub New()

MyBase.New()

Class_Init()

'//*************************************************************

'// set SBO_Application with an initialized application object

'//*************************************************************

'//*************************************************************

'// Check the SBO application lanuage

'//*************************************************************

If Not (SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English Or _

SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English_Cy Or _

SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English_Gb Or _

SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English_Sg) Then

SBO_Application.MessageBox("AddingMenuItems Add On:" & Environment.NewLine & _

"The menu items will be added only for English language settings")

Exit Sub

End If

'//*************************************************************

'// add the menu items

'//*************************************************************

AddMenuItems()

End Sub

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

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

SBO_Application.MessageBox("My sub menu item was clicked")

'//*************************************************************

'// Create a form to be launched in response to a click on the

'// new sub menu item

'//*************************************************************

Try

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

SBO_Application.MessageBox("The Form already exists")

Catch

DrawForm()

End Try

End If

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

' SBO_Application.MessageBox("My GoTo Menu was clicked")

'End If

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

' SBO_Application.MessageBox("My Second GoTo Menu was clicked")

'End If

End Sub

Private Sub SBO_Application_AppEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes) Handles SBO_Application.AppEvent

Select Case EventType

Case SAPbouiCOM.BoAppEventTypes.aet_ShutDown

SBO_Application.MessageBox("A Shut Down Event has been caught" & _

Environment.NewLine() & "Terminating 'Add Menu Item' Add On...")

'// terminating the Add On

End

Case SAPbouiCOM.BoAppEventTypes.aet_LanguageChanged

If SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English Or _

SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English_Cy Or _

SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English_Gb Or _

SBO_Application.Language = SAPbouiCOM.BoLanguages.ln_English_Sg Then

AddMenuItems()

End If

End Select

End Sub

Private Sub DrawForm()

Dim oForm As SAPbouiCOM.Form ' The new form

Dim oItem As SAPbouiCOM.Item

' An item on the new form

Dim oStaticText As SAPbouiCOM.StaticText

Try

LoadFromXML("updateopd.srf")

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

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

End Sub

Private Sub LoadFromXML(ByRef FileName As String)

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

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

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

SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

End Sub

Private Sub SaveAsXML(ByRef Form As SAPbouiCOM.Form)

Dim oXmlDoc As Xml.XmlDocument

Dim sXmlString As String

oXmlDoc = New Xml.XmlDocument

'// get the form as an XML string

sXmlString = Form.GetAsXML

'// load the form's XML string to the

'// XML document object

oXmlDoc.LoadXml(sXmlString)

Dim sPath As String

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

'// save the XML Document

oXmlDoc.Save((sPath & "\MySimpleForm.xml"))

End Sub

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

If pVal.FormUID = "updopd" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = False And pVal.InnerEvent = False Then

Try

oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)

If oForm Is Nothing Then Exit Sub

Select Case pVal.ItemUID

Case "txtreg" 'Edit box

oForm.PaneLevel = "1" ' static box

Case "reg1"

oForm.PaneLevel = "1"

Case "txtdocID"

oForm.PaneLevel = "2"

Case "docid"

oForm.PaneLevel = "2"

End Select

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

End If

End Sub

End Class

-


CRVMANISH
Contributor
0 Kudos

Thanks

AVIJIT DEY

problem is solved i have used uid of items inside tab instead of uid of folder

Thanks a lots

Its working now

CRVMANISH
Contributor
0 Kudos

Hi,AVIJIT

,

I have design the form in screen painter i have taken a edit box and from collection i have added choose from list option with object type 2 and i have given uid of choose from list to edit box ,Choose from list Uid ,Choose from list alias as Card Type , i have also made user defined table and field and added to alias field, every thing is working fine ,but when i click choose from list icon , another window pops up but when i select item under it , it does to not appear in the edit box field..

I have not done any coding for it

Plz suggest

Answers (0)