SBO_Application_ItemEvent
Hi,
can i have SBO_application_itemEvent seperate to each class.
Because i am having 50 form. If i use the item even as commn then to trace the error in each form will be difference. I need to have the SBO_application_itemEvent seperatly for each form.
When i have the SBO_application_itemEvent seperate for each form then i need to call the connection string in each form. if i call the connection string in each form , than at the time of building ard it is showing the error message as.
"The requested llokup key was not found in any active activation contex".
Please let me know how i can solve this problem.
regards
Suresh S
Hi,
Try to create method or function with pval as argument:
Private Sub MyEvent(ByVal pval As SAPbouiCOM.ItemEvent)
and in iSBO_application_itemEvent just run your function for each form like :
myevent(pval)
regards
Greg.
Similar Messages
-
SBO_Application_ItemEvent not working
hi
i was trying to catch the event SBO_Application_ItemEvent for my UI test button. But when i click on Test button. this even is not beaing executing. SBO_Application is also Declared withevents
my code is as below
oItem = oForm.Items.Add("btnTest", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 160
oItem.Width = 100
oItem.Top = 251
oItem.Height = 19
oButton = oItem.Specific
oButton.Caption = "Test"
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 = "MySimpleDBForm") Then
If ((pVal.ItemUID = "btnTest") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) And (pVal.Before_Action = False)) Then
SBO_Application.MessageBox("Event fired")
End If
End If
End Sub
can any body help me..what is the mistake in it. if this is not the correct way of capturing the events. then plz let me know the correct method
thanks in advance
regardsRegarding the original Problem:
How do you create your form?
Could you post the code?
Regarding EventFilters:
You might wish to check-out the information about event filters - unless you already did:
- e.g. helpfiles here in SDN - still 6.5 here, but event filters did not change; to be found in the Developer Area for SAP Business One (SDK) on this site
https://www.sdn.sap.com/sdn/developerareas/businessone.sdn?node=linkDnode10
- or in your SDK Installation; usually:
C:\Program Files\SAP Manage\SAP Business One SDK\Help
- or on SAP Service Marketplace (you will find the SDK downloads inc. 2004 helpfiles around there):
http://service.sap.com/smb/development/sdk
- or got to "Education" section of the SMB Portal etc. you will find a lot of information there as well!!!
http://service.sap.com/smb/education
- or insist on being given the time to get trained.
The helpfiles contain a section that deals with events and also shows you how to deal with event filters; the general prinicple is just that your Item eventhandler only gets called when an event occurs that you wish to receive...
Please note that the information about a particular event has to cross two boundaries between processes (SAP B1 => UI API => Your Add-On) so that every event that does not have to be passed to your Add-On will improve it's performance!
Just FYI: Breakpoints sometimes cause problems in the item event handler... when using .NET
Regards -
CFL For the edit text using screen painter
Dear All,
I had created CFL for the Edit box to display CardCode
if i press tab button the list for the specified object type is obtained
but the selected value is not binded with the edit box,i have attached the code here,
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = pVal
Dim sCFL_ID As String
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.Item(FormUID)
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
Dim val As String
Try
val = oDataTable.GetValue(1, 0)
Catch ex As Exception
End Try
If (pVal.ItemUID = "23") Then
oForm.DataSources.UserDataSources.Item("CardCode").ValueEx = val
End If
End If
End If
Regards,
VijayIs the event generated ? What is the value of your "val" variable ?
-
Access the selected values from grid
I want to select vendor from the list.For this I have loaded vendor list in grid.How to get the value of selected vendor into variable ? For this I have used following code-
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim dtgGrid As SAPbouiCOM.Grid
Dim strVendorCode As String
Dim strVendorName As String
Dim dtgRows As SAPbouiCOM.GridRows
Dim dtgColumns As SAPbouiCOM.GridColumns
Try
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.Before_Action = True And pVal.ItemUID = "dtgGrid" Then
dtgGrid = SBO_Application.Forms.ActiveForm.Items.Item("dtgGrid").Specific
dtgGrid.Rows.SelectedRows.Add(pVal.Row)
strVendorCode = dtgGrid.Rows.SelectedRows.Item(1, SAPbouiCOM.BoOrderType.ot_RowOrder)
strVendorName = dtgGrid.Rows.SelectedRows.Item(1, SAPbouiCOM.BoOrderType.ot_SelectionOrder)
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End Sub
But I could not get the value in the variable strVendorName .Hi,
i would access value with the datatable
something like:
oForm = SBOApplication.Forms.Item(FormUID)
oGrid = oForm.Items.Item("grid").Specific
oGrid.DataTable.Columns.Item("insertthecolumnname").Cells.Item(i).Value
regards
David -
Problem in AddRow button and Matrix
Hello everybody...
Can anybody tell me...in my UDO Form AddRow button, matrix is not working...dont understand why???
But Add and Cancel buttons are working fine...there is no problem in code still I am not able to update values using Matrix...
See the code below...
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
' Events of the Blanket Agreement form
If (FormUID = "FBLK") Then
If (pVal.Before_Action = False) Then
' Click on Add Row
If (pVal.ItemUID = "AddRow") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
Dim f As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
f = SBO_Application.Forms.Item(FormUID)
oMatrix = f.Items.Item("mat").Specific
f.DataSources.DBDataSources.Item(1).Clear()
oMatrix.AddRow(1)
End If
End If
End If
Catch ex As Exception
MessageBox.Show(u2018not workingu2019)
End Try
End Sub
Please tell me where I am wrong...
Thanks in advanceHi Satish,
Thanks for the reply and yes I am using SetFilters and Item Uid is also correct, i have checked....
See Code below for SetFilters()
Private Sub SetFilters()
'// Create a new EventFilters object
oFilters = New SAPbouiCOM.EventFilters
'// add an event type to the container
'// this method returns an EventFilter object
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_COMBO_SELECT)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_VALIDATE)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_LOST_FOCUS)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_KEY_DOWN)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_CLICK)
'// assign the form type on which the event would be processed
oFilter.AddEx("149") 'Quotation Form
oFilter.AddEx("139") 'Orders Form
oFilter.AddEx("133") 'Invoice Form
oFilter.AddEx("169") 'Main Menu
SBO_Application.SetFilter(oFilters)
End Sub
Now tell me where I am wrong... -
How to create one form for two Udo object
Hy ,
I have two Object Udo (header and line)
How we created a form to manage these two files (UDO)
ThanksThank you janos
it works, I put the code to other developers for information
Shared Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_application.ItemEvent
If ((FormUID = "SIR001_") And (pVal.ItemUID = "add") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) And (pVal.Before_Action = False)) Then
Dim oDS As SAPbouiCOM.DBDataSource
oDS = SBO_application.Forms.Item(FormUID).DataSources.DBDataSources.Item("@SIR_LOTL")
oDS.InsertRecord(oDS.Size)
oDS.Offset = oDS.Size - 1
oform = SBO_application.Forms.Item(FormUID)
oMatrix = oform.Items.Item("mtx_0").Specific
oMatrix.AddRow(1)
End If
If ((FormUID = "SIR001_") And (pVal.ItemUID = "del") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) And (pVal.Before_Action = False)) Then
oform = SBO_application.Forms.Item(FormUID)
oMatrix = oform.Items.Item("mtx_0").Specific
For index As Integer = oMatrix.RowCount To 1 Step -1
If oMatrix.IsRowSelected(index) = True Then
oMatrix.DeleteRow(index)
oform.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
End If
Next
End If
End Sub -
User should only work on created Form
Hi all!
Here is my problem.
A user is working in B1. For example:With a double_klick on a Textfield and a user created Form will be shown.
No the User should only work with this Form until its closed! There should be no possibility to open an other form or so.
Like if you get a MessageBox, there is no other "normal" way to work on until you close this Messagebox.
May it is possible to let the Form act like such a Messagebox.
Thanks for replies..
MatthiasThe Sample you speak of show the hack/workaround (Not true modal functionality).
From the sample:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
' Don't let the user to move to other forms
Dim EventEnum As SAPbouiCOM.BoEventTypes
EventEnum = pVal.EventType
If bModal And FormUID <> "Modal" Then
oForm.Select() ' Select the modal form
BubbleEvent = False
End If
' If the modal from is closed...
If FormUID = "Modal" And (EventEnum = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE) And bModal Then
bModal = False
End If
End Sub
In the sample the bModal bool set to true when opening the form block all events by selecting the modal form on each event and setting bubbleevent to false.. the EventEnum = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE set the bModal to false so events can continue
Biggest problem with this is if you use a eventfilter (which you should do)... here you need to remove the event filter along with setting the BModal (not in the sample), and reapply it after form close.
<i>Kind Regards
Rasmus Wulff Jensen | http://www.b1up.net</i> -
Child value is not updated?
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim i As Integer
Dim sumdepth As Decimal = 0
Dim oForm As SAPbouiCOM.Form
Dim Matrix As SAPbouiCOM.Matrix
oForm = SBO_Application.Forms.Item(FormUID)
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
'// Check if the event was raised by one of the Folder items
'// and change the form's pane level
Case SAPbouiCOM.BoEventTypes.et_CLICK
If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
'If Validation() = False Then
If oForm.Items.Item("OrdrVal").Specific().Value = "" Then
BubbleEvent = False
'SBO_Application.MessageBox(" Please Enter The Order No ")
SBO_Application.StatusBar.SetText("Enter The Order No- 3029 Item Is Not Selectable ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
oForm.Items.Item("OrdrVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
Exit Sub
End If
If oForm.Items.Item("LocVal").Specific().Value = "" Then
BubbleEvent = False
' SBO_Application.MessageBox(" Please Enter The Location ")
SBO_Application.StatusBar.SetText("Enter The Location - 3029 Item Is Not Selectable ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
oForm.Items.Item("LocVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
Exit Sub
End If
If oForm.Items.Item("SupVal").Specific().Value = "" Then
BubbleEvent = False
' SBO_Application.MessageBox(" Please Enter The Location ")
SBO_Application.StatusBar.SetText("Enter The Supervisor - 3029 Item Is Not Selectable ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
oForm.Items.Item("SupVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
Exit Sub
End If
Matrix = oForm.Items.Item("Matrix1").Specific
If Matrix.Columns.Item("Depth").Cells.Item(1).Specific.Value = "" Then
BubbleEvent = False
' SBO_Application.MessageBox(" Please Enter The Location ")
SBO_Application.StatusBar.SetText("Enter The Depth - 3029 Item Is Not Selectable ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
' oForm.Items.Item("Depth").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
Exit Sub
End If
'Dim sSQL As String
'Dim logno As Integer
''sSQL = "SELECT COUNT(DocEntry)AS count FROM [@OOBR]"
'sSQL = "SELECT Max(DocEntry)AS count FROM [@OOBR]"
'oLineRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
'oLineRec.DoQuery(sSQL)
'logno = CInt(oLineRec.Fields.Item(0).Value) + 1
'oForm.Items.Item("LogVal").Specific().Value = logno
End If
End If
End Select
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = pVal
Dim sCFL_ID As String
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
'SBO_Application.MessageBox(oCFL)
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
ShowValue(pVal, oDataTable, oForm)
End If
End If
Matrix = oForm.Items.Item("Matrix1").Specific
If ((pVal.ItemUID = "Matrix1") And (pVal.Row = Matrix.RowCount) And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
Matrix.AddRow(1, -1)
Matrix.Columns.Item("#").Cells.Item(Matrix.RowCount).Specific.Value = Matrix.RowCount
End If
If ((pVal.FormUID = "SM_OBRFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Or (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
For i = 1 To Matrix.RowCount
sumdepth += Matrix.Columns.Item("Depth").Cells.Item(i).Specific.Value
oForm.Items.Item("DepthVal").Specific().value = sumdepth
Dim oDocRec As SAPbobsCOM.Recordset
Dim sSQL As String
If oDocRec.RecordCount > 0 Then
sSQL = ""
Dim UpdateRec As SAPbobsCOM.Recordset
UpdateRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
UpdateRec.DoQuery(sSQL)
End If
Next
End If
If (FormUID = "SM_OBRFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) Then
Windows.Forms.Application.Exit()
End If
End Sub
Private Sub SalesOrdrCFL(ByVal oForm As SAPbouiCOM.Form)
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
'Dim oCons As SAPbouiCOM.Conditions
'Dim oCon As SAPbouiCOM.Condition
oCFLs = oForm.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
' Adding 2 CFL, one for the button and one for the edit text.
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "17"
oCFLCreationParams.UniqueID = "CFL1"
oCFL = oCFLs.Add(oCFLCreationParams)
oCFLCreationParams.UniqueID = "CFL2"
oCFL = oCFLs.Add(oCFLCreationParams)
Catch
MsgBox(Err.Description)
End Try
End Sub
error data already exist in child tableImports System
Imports System.web
Imports System.Windows.Forms.Form
Public Class SM_DPSFM
'// At the begining of every UI API project we should first
'// establish connection with a running SBO application.
Private WithEvents SBO_Application As SAPbouiCOM.Application
Private oForm As SAPbouiCOM.Form
Dim oButton As SAPbouiCOM.Button
Dim oOptionBtn As SAPbouiCOM.OptionBtn
Dim oCheckBox As SAPbouiCOM.CheckBox
Dim oComboBox As SAPbouiCOM.ComboBox
Dim oItem As SAPbouiCOM.Item
Dim oStatic As SAPbouiCOM.StaticText
Dim oEdittext As SAPbouiCOM.EditText
Dim oEditItem As SAPbouiCOM.EditText
Private oMatrix As SAPbouiCOM.Matrix
Private Matrix2 As SAPbouiCOM.Matrix
Private oLink As SAPbouiCOM.LinkedButton
Private oColumns As SAPbouiCOM.Columns
Private oColumn As SAPbouiCOM.Column
Private sPath As String
Private oDBDataSource As SAPbouiCOM.DBDataSource
Private oCompany As SAPbobsCOM.Company
Private rs As SAPbobsCOM.Recordset
Private oLineRec As SAPbobsCOM.Recordset
Private rs1 As SAPbobsCOM.Recordset
'// declaring a User data source for the "Remarks" Column
Private oUserDataSource As SAPbouiCOM.UserDataSource
Public sErrMsg As String
Public lErrCode As Long
Public lRetCode As Long
Private Sub SetApplication()
'// Use an SboGuiApi object to establish the connection
'// with the 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 Sub AddMenuItems()
'// Let's add a pop-up menu item and 2 sub menu items
Dim oMenus As SAPbouiCOM.Menus '// use the following object to add menu
Dim oMenuItem As SAPbouiCOM.MenuItem
'// Get the menus collection from the application
oMenus = SBO_Application.Menus
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oMenuItem = SBO_Application.Menus.Item("43520") 'moudles'
sPath = System.Windows.Forms.Application.StartupPath()
sPath = sPath.Remove(sPath.Length - 3, 3)
'' Creation parameters
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP
oCreationPackage.UniqueID = "SM_DMID"
oCreationPackage.String = "Dealer Mgmt."
'oCreationPackage.Image = sPath & "dealermg.gif"
oCreationPackage.Image = IO.Directory.GetParent(Application.StartupPath).ToString & "\CFL.BMP"
'' we add our menu at the buttom of the list
oCreationPackage.Position = oMenuItem.SubMenus.Count + 1
oMenus = oMenuItem.SubMenus
Try ' If the menu 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("SM_DMID")
oMenus = oMenuItem.SubMenus
'' Add Sub Menu Items
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "SM_DPSMENU" ''Unique ID of 1st Sub Menu item
oCreationPackage.String = "Dumper Performance Sheet"
oMenus.AddEx(oCreationPackage)
Catch er As Exception ' Error Handling
SBO_Application.MessageBox(er.Message)
End Try
End Sub
'Private Sub AddMenuItems()
' '// Let's add a pop-up menu item and 2 sub menu items
' Dim oMenus As SAPbouiCOM.Menus '// use the following object to add menu
' Dim oMenuItem As SAPbouiCOM.MenuItem
' '// Get the menus collection from the application
' oMenus = SBO_Application.Menus
' Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
' oMenuItem = SBO_Application.Menus.Item("SM_DMID")
' sPath = System.Windows.Forms.Application.StartupPath()
' sPath = sPath.Remove(sPath.Length - 3, 3)
' oMenus = oMenuItem.SubMenus
' Try ' If the menu already exists this code will fail
' '' Add Sub Menu Items
' oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
' oCreationPackage.UniqueID = "SM_DPSMENU"
' oCreationPackage.String = "Dumper Performance Sheet"
' oCreationPackage.Position = 1
' oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
' oMenuItem = oMenus.AddEx(oCreationPackage)
' Catch er As Exception ' Error Handling
' SBO_Application.MessageBox(er.Message)
' End Try
'End Sub
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
If pVal.BeforeAction = False Then
Select Case pVal.MenuUID
Case "SM_DPSMENU"
diplay_DPSform() ''Function to display 1st Sub Menu item (D.P.S.) form.
End Select
End If
End Sub
'Function to draw the Dumper Performance Sheet.
Private Sub diplay_DPSform()
Dim oForm As SAPbouiCOM.Form
Dim val1 As String
Try
oForm = SBO_Application.Forms.Item("SM_DPSFM")
SBO_Application.MessageBox("Form Already Open")
Catch ex As Exception
Dim fcp As SAPbouiCOM.FormCreationParams
fcp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
fcp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
fcp.FormType = "SM_DPSFM"
fcp.ObjectType = "SM_DPS"
fcp.UniqueID = "SM_DPSFM"
fcp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
oForm = SBO_Application.Forms.AddEx(fcp)
oForm.AutoManaged = False
SalesOrdrCFL(oForm) ''Function to see the list of Sales Orders.
'OBRCFL(oForm)
itemlist(oForm)
DrawDPSForm(oForm)
''Function to Draw the form for 1st Sub Menu
End Try
oForm.DataBrowser.BrowseBy = "DpsVal"
oForm.Visible = True
End Sub
''Function to Draw the form for Sub Menu
Private Sub DrawDPSForm(ByVal oForm As SAPbouiCOM.Form)
Dim oItem As SAPbouiCOM.Item
Dim oButton As SAPbouiCOM.Button
Dim oEdittext As SAPbouiCOM.EditText
Dim val As String
''Form specifications
oForm.Title = "Dumper Performance Sheet"
oForm.Left = 320 '340
oForm.ClientWidth = 550 '350
oForm.Top = 100
oForm.ClientHeight = 422 '393
'Adding a datasource to the form
oDBDataSource = oForm.DataSources.DBDataSources.Add("@ODPS")
''Order Text
oItem = oForm.Items.Add("OrdrTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 5
oItem.Width = 100
oItem.Top = 10
' oItem.AffectsFormMode = False
oItem.LinkTo = "OrdrVal"
oStatic = oItem.Specific
oStatic.Caption = "Order No."
''Order Date Text
oItem = oForm.Items.Add("OrdrdtTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 5
oItem.Width = 100
oItem.Top = 27
oItem.AffectsFormMode = False
oItem.LinkTo = "OrdrdtVal"
oStatic = oItem.Specific
oStatic.Caption = "Order Date"
''Customer Text Box
oItem = oForm.Items.Add("CustTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 5
oItem.Width = 100
oItem.Top = 44
oItem.AffectsFormMode = False
oItem.LinkTo = "CustVal"
oStatic = oItem.Specific
oStatic.Caption = "Customer Name"
''DPS Text
oItem = oForm.Items.Add("DpsTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290 '271
oItem.Width = 50 '100
oItem.Top = 10
oItem.AffectsFormMode = False
oItem.LinkTo = "DpsVal"
oStatic = oItem.Specific
oStatic.Caption = "DPS No."
''DPS Date
oItem = oForm.Items.Add("DateTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290
oItem.Width = 50 '100
oItem.Top = 27
oItem.AffectsFormMode = False
oItem.LinkTo = "DateVal"
oStatic = oItem.Specific
oStatic.Caption = "DPS Date"
''Log No. Text
oItem = oForm.Items.Add("LogTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 5 '290
oItem.Width = 100 '50 '100
oItem.Top = 61
oItem.AffectsFormMode = False
oItem.LinkTo = "LogVal"
oStatic = oItem.Specific
oStatic.Caption = "Log No."
''SuperVisor Text
oItem = oForm.Items.Add("SupTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 5
oItem.Width = 100
oItem.Top = 300
oItem.AffectsFormMode = False
oItem.LinkTo = "SupVal"
oStatic = oItem.Specific
oStatic.Caption = "Supervisor"
''Total Trip for S/M Text
oItem = oForm.Items.Add("Trip1Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290
oItem.Width = 140 '100
oItem.Top = 300
oItem.AffectsFormMode = False
oItem.LinkTo = "Trip1Val"
oStatic = oItem.Specific
oStatic.Caption = "Total Trips Made For S/M"
''Remarks Text
oItem = oForm.Items.Add("RmksTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 5
oItem.Width = 50 '100
oItem.Top = 320
oItem.AffectsFormMode = False
oItem.LinkTo = "RmksVal"
oStatic = oItem.Specific
oStatic.Caption = "Remarks"
''Total Trip for LATERITE Text
oItem = oForm.Items.Add("Trip2Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290
oItem.Width = 140 '100
oItem.Top = 320
oItem.AffectsFormMode = False
oItem.LinkTo = "Trip2Val"
oStatic = oItem.Specific
oStatic.Caption = "Total Trips Made For LAT"
''Total Trip for BAUXITE Text
oItem = oForm.Items.Add("Trip3Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290
oItem.Width = 140 '100
oItem.Top = 340
oItem.AffectsFormMode = False
oItem.LinkTo = "Trip3Val"
oStatic = oItem.Specific
oStatic.Caption = "Total Trips Made For BAUX "
''Total Trip for Item4 Text
oItem = oForm.Items.Add("Trip4Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290
oItem.Width = 140 '100
oItem.Top = 360
oItem.AffectsFormMode = False
oItem.LinkTo = "Trip4Val"
oStatic = oItem.Specific
oStatic.Caption = "Total Trips Made For Itm4"
''Total Trip for Item5 Text
oItem = oForm.Items.Add("Trip5Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 290
oItem.Width = 140 '100
oItem.Top = 380
oItem.AffectsFormMode = False
oItem.LinkTo = "Trip5Val"
oStatic = oItem.Specific
oStatic.Caption = "Total Trips Made For Itm5"
'oItem = oForm.Items.Add("Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
'oItem.Left = 106
'oItem.Width = 4
'oItem.Top = 10
'' oItem.AffectsFormMode = False
''oItem.LinkTo = "OrdrVal" '"Vndval"
'oStatic = oItem.Specific
''oStatic.Caption = "Order No."
'oLink = oItem.ExtendedObject '// new property
'oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Order
Dim oEditlogdt As SAPbouiCOM.EditText
' Dim oEdittype As SAPbouiCOM.EditText
'Dim oEditloc As SAPbouiCOM.EditText
Dim oEditordr As SAPbouiCOM.EditText
Dim oEditorddt As SAPbouiCOM.EditText
Dim oEditcust As SAPbouiCOM.EditText
Dim oEditdep As SAPbouiCOM.EditText
Dim oEditsup As SAPbouiCOM.EditText
Dim oEditrmrk As SAPbouiCOM.EditText
Dim val1 As String
Dim sSQL As String
Dim logno As Integer
sSQL = "SELECT Max(DocEntry)AS count FROM [@ODPS]"
oLineRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oLineRec.DoQuery(sSQL)
logno = CInt(oLineRec.Fields.Item(0).Value) + 1
''DPS No. Edit Box
oItem = oForm.Items.Add("DpsVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 376
oItem.Width = 160
oItem.Top = 10
oItem.AffectsFormMode = True
oItem.LinkTo = "DpsTxt"
oItem.Enabled = False
oEdittext = oItem.Specific
oEdittext.DataBind.SetBound(True, "@ODPS", "DocEntry")
oEdittext.Value = logno
''Order Edit Text Box
oItem = oForm.Items.Add("OrdrVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 110
oItem.Width = 160
oItem.Top = 10
oItem.LinkTo = "OrdrTxt"
oItem.AffectsFormMode = True
oEditordr = oItem.Specific
'' Adding Choose From List
oEditordr.DataBind.SetBound(True, "@ODPS", "U_ordrno")
' Adding 2 Choose From List Object, ONE FOR EDIT TEXT AND ONE FOR BUTTON.
oEditordr.ChooseFromListUID = "CFL1"
''We set the alias only after the UID is set, the alias is the field in the database
''It compares the value in the edit text and narrows the CFL accrodingly
oEditordr.ChooseFromListAlias = "DocEntry" '"CardCode"
''Order Date Edit Box
oItem = oForm.Items.Add("OrdrdtVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 110
oItem.Width = 160
oItem.Top = 27
oItem.AffectsFormMode = True
oItem.LinkTo = "OrdrdtTxt"
oItem.Enabled = False
oEditorddt = oItem.Specific
oEditorddt.DataBind.SetBound(True, "@ODPS", "U_ordrdt")
' oEditorddt.String = Format(DateTime.Today, "ddMMyy")
''Customer Edit Box
oItem = oForm.Items.Add("CustVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 110
oItem.Width = 160
oItem.Top = 44
oItem.AffectsFormMode = True
oItem.LinkTo = "CustTxt"
oItem.Enabled = False
oEditcust = oItem.Specific
oEditcust.DataBind.SetBound(True, "@ODPS", "U_customer")
''DPS Date Edit Box
oItem = oForm.Items.Add("DateVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 376
oItem.Width = 160
oItem.Top = 27
oItem.AffectsFormMode = True
oItem.LinkTo = "DateTxt"
oEditlogdt = oItem.Specific
oEditlogdt.DataBind.SetBound(True, "@ODPS", "U_dpsdt")
oEditlogdt.String = Format(DateTime.Today, "ddMMyy")
''Log No. Edit
oItem = oForm.Items.Add("LogVal", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
oItem.Left = 110
oItem.Width = 160
oItem.Top = 61
oItem.AffectsFormMode = True
oItem.LinkTo = "LogTxt"
oComboBox = oItem.Specific
AddLogCodeCombo(oForm, val1)
'AddLogCodeCombo(oComboBox)
oComboBox.DataBind.SetBound(True, "@ODPS", "U_logno")
'oComboBox.ValidValues.Add("", "")
'oComboBox.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
''Total Trip for S/M Edit Box
oItem = oForm.Items.Add("Trip1Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 430 '376
oItem.Width = 105 '80
oItem.Top = 300
oItem.AffectsFormMode = True
oItem.LinkTo = "Trip1Txt"
oItem.Enabled = False
oEditdep = oItem.Specific
oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripsm")
''SuperVisor Edit Box
oItem = oForm.Items.Add("SupVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 110
oItem.Width = 160
oItem.Top = 300
oItem.AffectsFormMode = True
oItem.LinkTo = "SupTxt"
oEditsup = oItem.Specific
oEditsup.DataBind.SetBound(True, "@ODPS", "U_suprvsr")
''Remarks Edit Box
oItem = oForm.Items.Add("RmksVal", SAPbouiCOM.BoFormItemTypes.it_EXTEDIT)
oItem.Left = 110
oItem.Width = 160
oItem.Top = 320
oItem.AffectsFormMode = True
oItem.LinkTo = "RmksTxt"
oEditrmrk = oItem.Specific
oEditrmrk.DataBind.SetBound(True, "@ODPS", "U_remark")
''Total Trip for Laterite Edit Box
oItem = oForm.Items.Add("Trip2Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 430 '376
oItem.Width = 105 '80
oItem.Top = 320
oItem.AffectsFormMode = True
oItem.LinkTo = "Trip2Txt"
oItem.Enabled = False
oEditdep = oItem.Specific
oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltriplat")
''Total Trip for Bauxite Edit Box
oItem = oForm.Items.Add("Trip3Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 430 '376
oItem.Width = 105 '80
oItem.Top = 340
oItem.AffectsFormMode = True
oItem.LinkTo = "Trip3Txt"
oItem.Enabled = False
oEditdep = oItem.Specific
oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripbx")
''Total Trip for Item4 Edit Box
oItem = oForm.Items.Add("Trip4Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 430 '376
oItem.Width = 105 '80
oItem.Top = 360
oItem.AffectsFormMode = True
oItem.LinkTo = "Trip4Txt"
oItem.Enabled = False
oEditdep = oItem.Specific
oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripitm4")
''Total Trip for Item 5 Edit Box
oItem = oForm.Items.Add("Trip5Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 430 '376
oItem.Width = 105 '160
oItem.Top = 380
oItem.AffectsFormMode = True
oItem.LinkTo = "Trip5Txt"
oItem.Enabled = False
oEditdep = oItem.Specific
oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripitm5")
'// Adding a OrderCFL button
oItem = oForm.Items.Add("Button1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 269 '271
oItem.Top = 8
oButton = oItem.Specific
oButton.Type = SAPbouiCOM.BoButtonTypes.bt_Image
oItem.Width = 20
oItem.Height = 20
oButton.Image = IO.Directory.GetParent(Application.StartupPath).ToString & "\CFL.BMP"
'SBO_Application.MessageBox(oButton.Image)
'oButton.Image = "C:\Documents and Settings\subratac\My Documents\Visual Studio 2005\Projects\TestAddonApplication\TestAddonApplication\bin\CFL.BMP"
'' Adding Choose From List Object FOR BUTTON.
oButton.ChooseFromListUID = "CFL2"
'Adding a datasource to the form
oDBDataSource = oForm.DataSources.DBDataSources.Add("@DPS1")
'// Adding a Matrix item
oItem = oForm.Items.Add("Matrix1", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
oItem.Left = 5
oItem.Width = 550 '350
oItem.Top = 95
oItem.Height = 200 '150
oMatrix = oItem.Specific
oColumns = oMatrix.Columns
'// Adding Culomn items to the matrix
oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "#"
oColumn.Width = 50
oColumn.Editable = False
'oColumn.DataBind.SetBound(True, "@DPS1", "U_holeno")
'// Add a column for Vehicle no.
'oColumn = oColumns.Add("Vhcleno", SAPbouiCOM.BoFormItemTypes.it_EDIT)
'oColumn.TitleObject.Caption = "Vehicle No."
'oColumn.Width = 80
'oColumn.Editable = True
oColumn = oColumns.Add("Vhcleno", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
oColumn.TitleObject.Caption = "Vehicle No."
oColumn.Width = 80
oColumn.Editable = True
oLink = oColumn.ExtendedObject
oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Items
oColumn.DataBind.SetBound(True, "@DPS1", "U_vehcleno")
oColumn.ChooseFromListUID = "CFL5"
oColumn.ChooseFromListAlias = "ItemCode"
'// Add a column for vehicle name
oColumn = oColumns.Add("Vhclenm", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Vehicle Name"
oColumn.Width = 80
oColumn.Editable = True
oColumn.DataBind.SetBound(True, "@DPS1", "U_vehclenm")
'// Add a column for Trip S/M
oColumn = oColumns.Add("Trpsm", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Trip(S/M)"
oColumn.Width = 80
oColumn.Editable = True
oColumn.DataBind.SetBound(True, "@DPS1", "U_tripsm")
'// Add a column for Trip Laterite
oColumn = oColumns.Add("Trplat", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Trip(Laterite)"
oColumn.Width = 80
oColumn.Editable = True
oColumn.DataBind.SetBound(True, "@DPS1", "U_triplat")
'// Add a column for Trip Bauxite
oColumn = oColumns.Add("Trpbax", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Trip(Bauxite)"
oColumn.Width = 80
oColumn.Editable = True
oColumn.DataBind.SetBound(True, "@DPS1", "U_tripbx")
'// Add a column for Item 4
oColumn = oColumns.Add("Trpitm4", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Trip(Item 4)"
oColumn.Width = 80
oColumn.Editable = True
oColumn.DataBind.SetBound(True, "@DPS1", "U_tripitm4")
'// Add a column for Item 5
oColumn = oColumns.Add("Trpitm5", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Trip(Item 5)"
oColumn.Width = 80
oColumn.Editable = True
oColumn.DataBind.SetBound(True, "@DPS1", "U_tripitm5")
''// Link the column to the Stock Transfer master data system form
'oLink = oColumn.ExtendedObject
'oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_StockTransfers
'// Adding a OK button
oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 5
oItem.Width = 65
oItem.Top = 400 '372
oItem.Height = 20
oButton = oItem.Specific
'// Adding a Cancel button
oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 75
oItem.Width = 65
oItem.Top = 400 '372
oItem.Height = 20
oButton = oItem.Specific
AddLogCodeCombo(oForm, val)
oForm.DataBrowser.BrowseBy = "DpsVal"
End Sub
Public Sub New()
MyBase.New()
Try
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
If Not ConnectToCompany() = 0 Then
SBO_Application.MessageBox("Failed connecting to the company's Data Base")
End ' Terminating the Add-On Application
End If
'SBO_Application.MessageBox("DI Connected To: " & oCompany.CompanyName)
Catch
System.Windows.Forms.MessageBox.Show("SBO application not found")
End Try
AddMenuItems()
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 'Complex Form' Add On...")
'// Take care of terminating your AddOn application
System.Windows.Forms.Application.Exit()
End Select
End Sub
Private Function SetConnectionContext() As Integer
Dim sCookie As String
Dim sConnectionContext As String
' Dim lRetCode As Integer
'// 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)
End Function
Private Function ConnectToCompany() As Integer
'// Make sure you're not already connected.
If oCompany.Connected = True Then
oCompany.Disconnect()
End If
'// Establish the connection to the company database.
ConnectToCompany = oCompany.Connect
End Function
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.Item(FormUID)
Dim oMatrix As SAPbouiCOM.Matrix
Dim count As Integer
Dim oDataSrc As SAPbouiCOM.DataSource
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
'// Check if the event was raised by one of the Folder items
'// and change the form's pane level
Case SAPbouiCOM.BoEventTypes.et_CLICK
' If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
'If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
'If Validation() = False Then
'If oForm.Items.Item("OrdrVal").Specific().Value = "" Then
' BubbleEvent = False
' ' SBO_Application.MessageBox(" Please Enter The Order No ")
' SBO_Application.StatusBar.SetText("Enter The Order No - 3029 Item Is Not Selectable ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
' oForm.Items.Item("OrdrVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
' Exit Sub
'End If
'If oForm.Items.Item("SupVal").Specific().Value = "" Then
' BubbleEvent = False
' ' SBO_Application.MessageBox(" Please Enter The Order No ")
' SBO_Application.StatusBar.SetText("Enter The Supervisor - 3029 Item Is Not Selectable ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
' oForm.Items.Item("SupVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
' Exit Sub
'End If
If pVal.FormMode = 2 And pVal.ItemUID = "1" And pVal.BeforeAction = False Then
'In UPDATE Mode
' strDocNum = oForm.Items.Item("txtCode").Specific.String
' If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE And oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
Dim strdocnum As String
strdocnum = oForm.Items.Item("DpsVal").Specific.String
oMatrix = oForm.Items.Item("Matrix1").Specific
oDataSrc = oForm.DataSources.DBDataSources.Add("@DPS1")
oForm.Freeze(True)
UpdateMatrixRowsDel(oForm)
oMatrix.FlushToDataSource()
For count = 1 To oMatrix.RowCount
oDataSrc.SetValue("LineId", count - 1, oDataSrc.GetValue("DocEntry", count - 1))
Next
oMatrix.LoadFromDataSource()
oForm.Freeze(False)
End If
' End If
'End If
'End If
End Select
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = pVal
Dim sCFL_ID As String
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
''//Function to show values in EditBoxes and Matrix after pressing TAB button.
ShowAllData(pVal, oDataTable, oForm)
End If
End If
Dim Matrix As SAPbouiCOM.Matrix
Matrix = oForm.Items.Item("Matrix1").Specific
'If ((pVal.ItemUID = "Matrix1") And (pVal.Row = Matrix.RowCount) And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
' ' Matrix.AddRow(1, -1)
' Matrix.AddRow(1, -1)
' Matrix.Columns.Item("#").Cells.Item(Matrix.RowCount).Specific.Value = Matrix.RowCount
'End If
If (FormUID = "SM_DPSFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) Then
Windows.Forms.Application.Exit()
End If
'ShowTripTotal(pVal, oForm)
Dim i As Integer
Dim tripsm As Integer = 0
Dim triplat As Integer = 0
Dim tripbax As Integer = 0
Dim tripitm4 As Integer = 0
Dim tripitm5 As Integer = 0
If ((pVal.FormUID = "SM_DPSFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Or (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
For i = 1 To Matrix.RowCount
tripsm += Matrix.Columns.Item(3).Cells.Item(i).Specific.Value
oForm.Items.Item("Trip1Val").Specific().value = tripsm
triplat += Matrix.Columns.Item(4).Cells.Item(i).Specific.Value
oForm.Items.Item("Trip2Val").Specific().value = triplat
tripbax += Matrix.Columns.Item(5).Cells.Item(i).Specific.Value
oForm.Items.Item("Trip3Val").Specific().value = tripbax
tripitm4 += Matrix.Columns.Item(6).Cells.Item(i).Specific.Value
oForm.Items.Item("Trip4Val").Specific().value = tripitm4
tripitm5 += Matrix.Columns.Item(7).Cells.Item(i).Specific.Value
oForm.Items.Item("Trip5Val").Specific().value = tripitm5
Matrix.LoadFromDataSource()
Next
End If
End Sub
Private Sub SalesOrdrCFL(ByVal oForm As SAPbouiCOM.Form)
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
'Dim oCons As SAPbouiCOM.Conditions
'Dim oCon As SAPbouiCOM.Condition
oCFLs = oForm.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
' Adding 2 CFL, one for the button and one for the edit text.
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "17"
oCFLCreationParams.UniqueID = "CFL1"
oCFL = oCFLs.Add(oCFLCreationParams)
oCFLCreationParams.UniqueID = "CFL2"
oCFL = oCFLs.Add(oCFLCreationParams)
Catch
MsgBox(Err.Description)
End Try
End Sub
Private Sub OBRCFL(ByVal oForm As SAPbouiCOM.Form)
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
' Dim oCons As SAPbouiCOM.Conditions
' Dim oCon As SAPbouiCOM.Condition
oCFLs = oForm.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
' Adding 2 CFL, one for the button and one for the edit text.
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "SM_OOBR"
oCFLCreationParams.UniqueID = "CFL3"
oCFL = oCFLs.Add(oCFLCreationParams)
'' Adding Conditions to CFL1
'oCons = oCFL.GetConditions()
'oCon = oCons.Add()
'oCon.Alias = "U_ordrdt" '"Order Date" '"U_ordrdt" '"Balance"
'oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
'oCon.CondVal = oForm.Items.Item("OrdrdtVal").Specific().string '"120000"
'oCFL.SetConditions(oCons)
Catch
MsgBox(Err.Description)
End Try
End Sub
Private Sub itemlist(ByVal oForm As SAPbouiCOM.Form)
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
' Dim oCons As SAPbouiCOM.Conditions
' Dim oCon As SAPbouiCOM.Condition
oCFLs = oForm.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
' Adding 2 CFL, one for the button and one for the edit text.
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "4"
oCFLCreationParams.UniqueID = "CFL5"
oCFL = oCFLs.Add(oCFLCreationParams)
oCFLCreationParams.UniqueID = "CFL5"
oCFL = oCFLs.Add(oCFLCreationParams)
'oCFL = oCFLs.Add(oCFLCreationParams)
'oCons = oCFL.GetConditions()
'oCon = oCons.Add()
'oCon.Alias = "ItemCode"
'oCon.Operation = SAPbouiCOM.BoConditionOperation.co_START
'oCon.CondVal = "V"
'oCFL.SetConditions(oCons)
Catch
Exit Sub
MsgBox(Err.Description)
End Try
End Sub
Private Sub ShowAllData(ByRef pVal As SAPbouiCOM.ItemEvent, ByVal oDatatable As SAPbouiCOM.DataTable, ByVal oForm As SAPbouiCOM.Form)
Dim val, val2, val4 As String
Dim val1 As String
Dim i As Integer
Dim oCombo As SAPbouiCOM.ComboBox
oCombo = oForm.Items.Item("LogVal").Specific
Dim Matrix As SAPbouiCO -
How to increase formUID to a form created with screen painter
Hi,
I've got a problem with my form. I created a form with screen painter but i can't succeed to increase my UID form.
For example, when i open my first form, the UID is always at FP_0.
My script:
private string FormUID = null;
public FP_Form(int NumInstance_)
this.NumInstance = NumInstance_;
this.FormUID = "FP" + NumInstance.ToString();
load();
oDBDataSource = oForm.DataSources.DBDataSources.Add(DBDataSourceTable);
SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
private void SBO_Application_ItemEvent(string _FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
BubbleEvent = true;
try
if (_FormUID == this.FormUID) //here "_FormUID" is increased but "this.FormUID" is still = FP_0
switch (pVal.EventType)// selon le type d'action executée
case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
if (pVal.BeforeAction == true)
SAPbouiCOM.ComboBox List_reseau = (SAPbouiCOM.ComboBox)oForm.Items.Item("5").Specific;
List_reseau.ValidValues.Add("1", "test");
break;
case ...
break;
Please help.
Regards,
Zakia.Hi J.
The answer is yes You just have to give your form a unique id.
1) Give your form in screen painter a name like BTWO_DYNAMIC_UID (just plain text).
2) Make sure your <i>FormType</i> and <i>appformnumber</i> have a unique number (i.e. 2000060001). You can do this in the xml source.
3) By loading your document replace the BTWO_DYNAMIC_UID with an unique id. I have a counter that's a member of my class and increase that number to get a unique id (BTWO_F_1, BTWO_F_2 etc)
I have added a code sample, SBOApplication is my SAP application object and mFormNumber is a member (integer) of my class.
<i>Succes d'r mee, en als 't nie lukt hoor ik het wel... ;)</i>
<b>Code (C#):</b>
// New xml document
XmlDocument oXmlDoc = new XmlDocument();
private Form LoadUniqueForm(string AMyFile)
// Define your path to
sPath = @"Forms" + AMyFile;
// Load the form
oXmlDoc.Load(sPath);
// Replace the string with an unique id
mFormNumber++;
string sXML = oXmlDoc.InnerXml.Replace("BTWO_DYNAMIC_UID", "BTWO_F_" + mFormNumber.ToString());
// load the XML file in SAP
SBOApplication.LoadBatchActions(ref sXML);
// Return the form
return SBOApplication.Forms.Item("BTWO_F_" + mFormNumber.ToString()); -
How to add new columns in predefined matrix in system form
Hi all,
I am new to SAP B1. I am going to add New column to Good Receipt PO matrix. I faced the one error " Matrix Line Exists " While adding new column to good receipt PO matrix".
=========================================================
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
oMat = oForm.Items.Item("38").Specific
oCols = oMat.Columns
oCol = oCols.Item("U_MyCol")
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And pVal.BeforeAction = True And pVal.FormType = "143" Then
Try
oForm = SBO_Application.Forms.Item(pVal.FormUID)
oMat = oForm.Items.Item("38").Specific
oCols = oMat.Columns
'oCol = oCols.Item("U_MyCol1")
oCol = oCols.Add("U_MyCol1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oCol.TitleObject.Caption = "Qty Accepted"
oCol.Width = 40
oCol.Editable = True
oCol = oCols.Item("U_MyCol1")
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
oDBDataSource = oForm.DataSources.DBDataSources.Add("PDN1")
''oEdit.DataBind.SetBound(True, "PDN1", "U_QtyAccepted")
============================================================
And i also added for Datasource to Databind. what there is no result ??i wanted Clear information regarding this to add new columns in matrix in middle of Matrix items. I wanted Clear coding& information for this to add new Columns in Matrix ?help me regarding this asap??
Regards
ANANDAnand,
If you use the "search" feature of this forum and type "add column", you will find many posts that may help you such as this one ...
How to add a column on sales order matrix?
HTH,
Eddy -
Problem in execution of add-on
I have created an application.I have edited the form of item master.I have added a button on this form and on the click event I am adding inspection parameters.
This application runs in debug mode but when I created add-on it gives error as,
The requested lookup key was not found in any active activation context.Dear friends,
Thanks for spending u r valuable time in helping.
The problem was with SBO_Application object.For this application I am using to class files clsDetails and clsEditItem.I had declared the SBO_Application in both the files.clsEditItem is called first and then clsEditItem.SBO_Application works fine in clsEditItem but when it is declared again in clsEditItem it gave above error.So I created a module as
Module CommonFunctions
Public WithEvents SBO_Application As SAPbouiCOM.Application
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
End Sub
End Module
I hadled the events of SBO_Application object in this module -
Hi Experts,
I want to protect my udt using VB.net and SDK code so that the user can update it. The udt can only be updated by a certain super user i.e. manager.
Please help me to provide the code. I will appreciate it so much.
Rgds,
JohnHi
Try this
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(FormUID)
If (FormUID = "yourformuid") Then
If (pVal.Before_Action = False) Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
'Here write your code
'if the user is not a super user then just disable all the controls in the form and set form mode to ok mode
Dim oSQLRS As SAPbobsCOM.Recordset = SBO_Application.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
Dim SQLString As String
SQLString ="SELECT T0.UserID FROM OUSR T0 WHERE T0.SUPERUSER = 'Y' "
if oSQLRS.DoQuery(SQLString) = SBO_Application.Company.UserName then
else
DisableForm(oForm)
oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE
end if
End If
End If
End If
Catch ex As Exception
End Try
End Sub
Public Function DisableForm(ByVal _form As SAPbouiCOM.Form) As Boolean
Try
Dim itemCollection As ArrayList
itemCollection = getItems(_form)
Dim oItem As SAPbouiCOM.Item
_form.Freeze(True)
For Each tempLoopVar_oItem As SAPbouiCOM.Item In itemCollection
If tempLoopVar_oItem.Type = BoFormItemTypes.it_FOLDER Or tempLoopVar_oItem.Type = BoFormItemTypes.it_STATIC Or tempLoopVar_oItem.Type = BoFormItemTypes.it_LINKED_BUTTON Then
oItem = tempLoopVar_oItem
oItem.Enabled = True
Else
oItem = tempLoopVar_oItem
'for excluding button 1, 2 and txtTemp
If oItem.UniqueID = "1" Or oItem.UniqueID = "2" Or oItem.UniqueID = "txtTemp" Then
If oItem.UniqueID <> "txtTemp" Then
oItem.Enabled = True
End If
Else
oItem.Enabled = False
End If
End If
Next
_form.Freeze(False)
Return True
Catch ex As Exception
MessageBox.Show(ex.ToString())
_form.Freeze(False)
Return True
End Try
End Function
Public Function getItems(ByRef _form As SAPbouiCOM.Form) As ArrayList
Try
Dim oItemCollection As New ArrayList()
Dim oItem As SAPbouiCOM.Item
For Each tempLoopVar_oItem As SAPbouiCOM.Item In _form.Items
oItem = tempLoopVar_oItem
oItemCollection.Add(oItem)
Next
Return oItemCollection
Catch ex As Exception
MessageBox.Show(ex.ToString())
Return Nothing
End Try
End Function
for this code to work correctly place an edittext box in to your form with unique id txtTemp and set its width and hieght to 0
Regards
Arun -
Capture DocEntry of purchase order created by Proc. Confirmation Wizard
Dear all,
in SAP B1 2007 I developed a UI DI API addon to read the docentry of all purchase orders created by Procurement Confirmation Wizard.
I used the et_FORM_DATA_ADD event created by the wizard when I confirmed the creation of the purchase order.
In this event, the BusinessObjectInfo.ObjectKey string contained the DocEntry of the new purchase order.
But now, with SAP 8.81 PL 06, this event is not raised anymore.
So... now... how can I know the DocEntry (not DocNum) of the new purchase orders created by Procurement Confirmation Wizard?
Can someone help me, please?
Regards
EmanueleDear all,
I solved the problem analyzing the event raised by SAP B1 8.81 Proc. Confirmation Wizard.
Const CONFIRM_PURCHASE_ORDER_FORM_TYPE As String = "540010007"
Const ERROR_STRING As String = "ERRORE: "
Const WIZARD_MATRIX_PO_DOCNUM_MESSAGE As String = "540010007-36]"
Const WIZARD_MATRIX_FORMID As String = "540000036"
Const WIZARD_LINK_COLUMN_ID As String = "540000005"
Const WIZARD_VALIDATE_COLUMN_ID As String = "540000003"
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, _
ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
If pVal.FormType = CONFIRM_PURCHASE_ORDER_FORM_TYPE Then
' event activated by the matrix element
If pVal.ItemUID = WIZARD_MATRIX_FORMID And pVal.BeforeAction = True Then
' if event is "matrix link pressed" or "form/matrix validate"
If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED And pVal.ColUID = WIZARD_LINK_COLUMN_ID) Or _
(pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ColUID = WIZARD_VALIDATE_COLUMN_ID) Then
Dim recordsetTemp As SAPbobsCOM.Recordset = Nothing
Dim recordsetTemp2 As SAPbobsCOM.Recordset = Nothing
Dim recordsetTemp3 As SAPbobsCOM.Recordset = Nothing
Dim oform As SAPbouiCOM.Form
Try
oform = SBO_Application.Forms.GetForm(CONFIRM_PURCHASE_ORDER_FORM_TYPE, 1)
Dim sQuery As String
Dim oMatrix As SAPbouiCOM.Matrix = oform.Items.Item(WIZARD_MATRIX_FORMID).Specific
Dim ocolumn As SAPbouiCOM.Column = oMatrix.Columns.Item(WIZARD_LINK_COLUMN_ID) ' ("540000005")
If oMatrix.RowCount > 0 Then
For iRow As Integer = 1 To oMatrix.RowCount
Dim oEditText As SAPbouiCOM.EditText
oEditText = ocolumn.Cells.Item(iRow).Specific ' pVal.Row
If Not oEditText.Value.Contains(WIZARD_MATRIX_PO_DOCNUM_MESSAGE) Then
Continue For
End If
Dim DocNum As Integer = 0
Dim stemp As String = oEditText.Value
Dim stemp2 As String = ""
Dim iterRow As Integer = 0
' loop in the string searching for the purchase order docnum
While 1 = 1
If stemp.Contains(" ") Then
stemp2 = stemp.Substring(0, stemp.IndexOf(" "))
Try
DocNum = CInt(stemp2)
Exit While
Catch ex As Exception
stemp = stemp.Substring(stemp.IndexOf(" ") + 1)
DocNum = 0
End Try
Else
Exit While
End If
End While
If DocNum = 0 Then
Continue For
End If
Dim PO_DocEntry As String = ""
recordsetTemp2 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
sQuery = "SELECT MAX(DocEntry) As MaxDocEntry from OPOR where DocNum = " & DocNum
' execute SQL query
recordsetTemp2.DoQuery(sQuery)
If recordsetTemp2 IsNot Nothing Then
If recordsetTemp2.RecordCount = 0 Then
Continue For
End If
recordsetTemp2.MoveFirst()
PO_DocEntry = recordsetTemp2.Fields.Item("MaxDocEntry").Value
End If
If PO_DocEntry <> "" Then
' check if this Purchase Order has already some textlines
' If it already has text lines, then we don't need to add them to it
recordsetTemp3 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
sQuery = "SELECT count(*) As ExistYN from POR10 where DocEntry = " & PO_DocEntry
recordsetTemp3.DoQuery(sQuery)
If recordsetTemp3 IsNot Nothing Then
If recordsetTemp3.RecordCount > 0 Then
recordsetTemp3.MoveFirst()
Dim numOfTextLinesForThis_PO As Integer = CInt(recordsetTemp3.Fields.Item("ExistYN").Value)
If numOfTextLinesForThis_PO > 0 Then
Continue For
End If
End If
End If
End If
' if this PO still hasn't any texlines, then we try to add to it reading the textlines of Sales Order
' reopen the purchase order
Dim oPurchaseOrder As SAPbobsCOM.Documents
oPurchaseOrder = oCompany.GetBusinessObject(BoObjectTypes.oPurchaseOrders)
oPurchaseOrder.GetByKey(CInt(PO_DocEntry))
' loop on every lines
For i As Integer = 0 To oPurchaseOrder.Lines.Count - 1
oPurchaseOrder.Lines.SetCurrentLine(i)
' if purchase order line was generetated from a sales order
If oPurchaseOrder.Lines.BaseType = 17 Then
recordsetTemp = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
' search the text lines in the sales order
sQuery = "SELECT t11.LineText As LineText "
sQuery &= " from RDR10 t11 "
sQuery &= " Where t11.DocEntry = '" & oPurchaseOrder.Lines.BaseEntry & "' "
sQuery &= " AND t11.AftLineNum = " & oPurchaseOrder.Lines.BaseLine
sQuery &= " AND t11.LineType = 'T' and t11.ObjType = " & oPurchaseOrder.Lines.BaseType
sQuery &= " order by t11.LineSeq "
' execute SQL query
recordsetTemp.DoQuery(sQuery)
If recordsetTemp IsNot Nothing Then
If recordsetTemp.RecordCount = 0 Then
Continue For
End If
recordsetTemp.MoveFirst()
' loop on each text lines found
While recordsetTemp.EoF = False
If recordsetTemp.Fields.Item("LineText").Value <> String.Empty Then
oPurchaseOrder.SpecialLines.LineType = BoDocSpecialLineType.dslt_Text
oPurchaseOrder.SpecialLines.LineText = recordsetTemp.Fields.Item("LineText").Value
oPurchaseOrder.SpecialLines.AfterLineNumber = oPurchaseOrder.Lines.LineNum
oPurchaseOrder.SpecialLines.Add()
End If
recordsetTemp.MoveNext()
End While ' recordsetTemp.EoF = False
End If ' recordsetTemp IsNot Nothing
End If ' oPurchaseOrder.Lines.BaseType = 17
Next ' end-loop on every lines
' update the purchase order
oPurchaseOrder.Update()
Next
End If
Catch ex As Exception
Finally
recordsetTemp = Nothing
recordsetTemp2 = Nothing
recordsetTemp3 = Nothing
End Try
End If
End If
End If
Catch ex As Exception
End Try
End Sub
Regards
Emanuele
Edited by: Emanuele Croci on Aug 29, 2011 5:05 PM -
Hi,
I'm trying to remove item from a combobox ... but I can't !!!
The messagge that appear me is like
Run Time error -7006
Item - The item is not a user defined item
Is there anybody who can help me ?
This is what I do (in a Vb program)
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, pVal As SAPbouiCOM.IItemEvent, BubbleEvent As Boolean)
Dim griglia As SAPbouiCOM.Matrix
Dim Marca As SAPbouiCOM.ComboBox
Set griglia = SBO_Application.Forms.Item(FormUID).Items.Item("38").Specific
Set Marca = griglia.Columns.Item("U_MARCA").Cells.Item(pVal.Row).Specific
For i = 1 To Marca.ValidValues.Count
<b>Call Marca.ValidValues.Remove(i)</b>
Next iHy Giorgio!
You cannot remove a value from the system collection. So, you need to use a new column to store value.
After that you can remove items like this:
Jon's code almost good just need that you wanna remove item by list index ('cos default is by Item value):
combo.ValidValues.Remove , psk_Index -
In screen painter I am unable to attach the folder with the respective matrix. Please give the complete method to attach the above mentioned.
Hi Manish,
I am not too sure what you want to know, but if you want a matrix to be displayed only on a specific folder you should do the following. I am going to show you the code, but you can do parts of it in screenpainter as well. In screen painter you cannot display it like you would at runtime.
On your matrix you would set the PaneFrom and PaneTo properties. To only set it visible on the first folder:
Dim oItem As SAPbouiCOM.Item
Dim oForm As SAPbouiCOM.Form
oForm = oApplication.Forms.ActiveForm
oItem = oForm.Items.Item("My_Matrix")
oItem.FromPane = 1
oItem.ToPane = 1
To add the folder you'll have to remember to set the ValOn and ValOff properties:
Dim oFolder As SAPbouiCOM.Folder
oFolder = oForm.Items.Item("My_Folder").Specific
oFolder.Caption = "MyFolder"
oFolder.DataBind.SetBound(True, "", "UDS_1")
oFolder.ValOff = 0
oFolder.ValOn = 1
To invoke the folder's click event you have to code it manually:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles oApplication.ItemEvent
If pVal.FormTypeEx = "My_Form" Then
If pVal.BeforeAction = True Then
If pVal.ItemUID = "My_Folder" Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
Dim oForm As SAPbouiCOM.Form
oForm = oApplication.Forms.ActiveForm
oForm.PaneLevel = 1
End If
End If
End If
End If
End Sub
Hope it helps,
Adele
Maybe you are looking for
-
Problem with Installing Nokia Ovi Store in E51
I am having problem with installing nokia Ovi store in my E51. Whenever I try to download Ovi store from my E51, it shows a error message that the component is built in and cannot be installed. I dont know wat to do now. Can anyone please give me som
-
Mac OS 10.8.4 slows down and freezes
Hi, I am running Mac OS X Mountain Lion with the newest updates. Since 4 Weeks I am receiving error messages like this one: WindowServer[112]: CGXDisableUpdate: UI updates were forcibly disabled by application "Chrome" for over 1.00 seconds. Server h
-
HOW TO CREATE LOCAL USER PROFILE
SIR, OS - WINDOWS SERVER 2008 R2 SYSTEM - IBM MACHINE X3400 SERIES 1. HOW TO CREATE A USER IN WINDOWS SERVER 2008 R2 WITHOUT ACTIVE DIRECTORY 2. AFTER CREATE USER IN WINDOWS SERVER 2008 R2 BUT USER PROFILE NOT CR
-
Looking for Photoshop Plugin Software Developer
Anyone know where I can find a software developer to create a Photoshop Plugin? Not having any luck finding programmers with knowledge of Adobe code. Or, is anyone a developer that can help? Please let me know. Thank you.
-
Workflow error: method of object cannot be executed
HI, I extended mkpf to zmkpf and added a method to it. when ran the workflow.I am getting the following errors. Notification of completion cannot be generated Problems occurred when generating a mail