Public Function AddResourceMaster(ByVal strVisCode As String, ByVal strResName As String, ByVal strResWarehouse As String) As Boolean
Dim oCompanyService As SAPbobsCOM.CompanyService = Nothing
Dim oResourceService As SAPbobsCOM.ResourcesService = Nothing
Dim oResource As SAPbobsCOM.Resource = Nothing
Dim oResWhs As SAPbobsCOM.ResourceWarehouse = Nothing
Dim oResParamters As SAPbobsCOM.ResourceParams = Nothing
Try
oCompanyService = oApplication.SAPCompany.GetCompanyService
oResourceService = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ResourcesService)
oResource = oCompanyService.GetDataInterface(SAPbobsCOM.ResourcesServiceDataInterfaces.rsdiResource)
' Assign values to Resource properties
oResource.VisCode = strVisCode
oResource.Name = strResName
' Add Resource Warehouse
oResWhs = oResource.Warehouses.Add
oResWhs.Warehouse = strResWarehouse
' Add Resource using Service
oResParamters = oResourceService.Add(oResource)
Return True
Catch ex As Exception
' Log or handle the exception accordingly
' Logging or displaying error messages for debugging purposes
Return False
Finally
' Properly dispose of resources
If oResParamters IsNot Nothing Then oResParamters = Nothing
If oResWhs IsNot Nothing Then oResWhs = Nothing
If oResource IsNot Nothing Then oResource = Nothing
If oResourceService IsNot Nothing Then oResourceService = Nothing
If oCompanyService IsNot Nothing Then oCompanyService = Nothing
End Try
End Function
The blog primarily focuses on topics related to SAP Business One, providing detailed information about technical aspects such as types of hyperlinks on page objects, linked analysis in SAP Lumira, and drill paths in SAP Lumira. The content seems to be structured and oriented towards providing in-depth knowledge about the technical features and functionalities of SAP Business One.
Welcome Notes
15 March 2018
Creating a Resource Master in SAP B1 via SDK
Add project through SDK
Today , We will see, How to Add project through SDK.
Public Function AddProjectIntoSAP(ByVal strPrjCode As Object, ByVal strPrjName As Object, ByVal activeMode As SAPbobsCOM.BoYesNoEnum, ByVal dtVaidateFrom As Date, ByVal dtVaidateTo As Date) As Boolean
Dim oCmpSrv As SAPbobsCOM.CompanyService = Nothing
Dim projectService As SAPbobsCOM.IProjectsService = Nothing
Dim project As SAPbobsCOM.IProject = Nothing
Dim projectParams As SAPbobsCOM.IProjectParams = Nothing
oCmpSrv = oApplication.SAPCompany.GetCompanyService
projectService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectsService)
project = projectService.GetDataInterface(SAPbobsCOM.ProjectsServiceDataInterfaces.psProject)
Try
projectParams = projectService.GetProjectList()
project.Code = strPrjCode
project.Name = strPrjName
project.Active = activeMode
project.ValidFrom = dtVaidateFrom
project.ValidTo = dtVaidateTo
projectService.AddProject(project)
Return True
Catch ex As Exception
Return False
Finally
If oCmpSrv IsNot Nothing Then
oCmpSrv = Nothing
End If
If projectService IsNot Nothing Then
projectService = Nothing
End If
If project IsNot Nothing Then
project = Nothing
End If
If projectParams IsNot Nothing Then
projectParams = Nothing
End If
End Try
End Function
14 March 2018
Add Menu through SDK
Today , We will see, How to Add Menu through SDK.
Public Sub AddMenu(ByVal SBO_Application As SAPbouiCOM.Application, ByVal aFormUid As String, ByVal strUniqueID As String, ByVal Str As String)
''********************************************************************
Dim oMenuItem As SAPbouiCOM.MenuItem = Nothing
Dim oMenus As SAPbouiCOM.Menus = Nothing
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams = Nothing
Dim aForm As SAPbouiCOM.Form = Nothing
''********************************************************************
aForm = SBO_Application.Forms.Item(aFormUid)
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
''********************************************************************
Try
oCreationPackage.Checked = False
oCreationPackage.Enabled = True
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = strUniqueID.Trim
oCreationPackage.String = Str.Trim
aForm.Menu.AddEx(oCreationPackage)
Catch ex As Exception
Finally
If oMenuItem IsNot Nothing Then
oMenuItem = Nothing
End If
If oMenus IsNot Nothing Then
oMenus = Nothing
End If
If oCreationPackage IsNot Nothing Then
oCreationPackage = Nothing
End If
If aForm IsNot Nothing Then
aForm = Nothing
End If
End Try
End Sub
13 March 2018
Add Linked Button through SAP Business One SDK- VB.NET
Add Linked Button through SAP Business One SDK- VB.NET
Introduction:
SAP Business One is a powerful enterprise resource planning (ERP) solution that allows businesses to streamline their operations. One of the key strengths of SAP Business One is its extensibility, which enables developers to enhance the user interface (UI) and functionality according to specific business needs.In this blog post, we will focus on a common customization - adding a linked button to a form using the SAP Business One SDK in VB.NET. Linked buttons are a convenient way to integrate custom functionality into the SAP Business One UI, providing users with quick access to specific actions.
Public Sub AddLinkedButton(ByVal objForm As SAPbouiCOM.Form, ByVal ItemUID As String, ByVal SourceID As String, ByVal iLeft As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, ByVal LinkTo As String, ByVal strLinkedObjectType As String, ByVal strLinkedObject As String)
Dim oItem As SAPbouiCOM.Item = Nothing
Try
If objForm IsNot Nothing Then
oItem = objForm.Items.Add(ItemUID, SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
oItem.Top = objForm.Items.Item(SourceID).Top
oItem.Left = iLeft + (objForm.Items.Item(SourceID).Left + objForm.Items.Item(SourceID).Width)
oItem.Width = iWidth
oItem.Height = iHeight
oItem.LinkTo = LinkTo
Dim btn As SAPbouiCOM.LinkedButton = objForm.Items.Item(ItemUID).Specific '' To Assign New Button
btn.LinkedObjectType = strLinkedObjectType
btn.LinkedObject = strLinkedObject
End If
Catch ex As Exception
Finally
If objForm IsNot Nothing Then
objForm = Nothing
End If
If oItem IsNot Nothing Then
oItem = Nothing
End If
End Try
End Sub
UDF -- Setting Fields Screen SAP Business one
We can also set Visible and active for that Field
Short Cut Key
Ctrl +Shift + B .
Note :
It does not work in UDO Screen and User Form.It's only work with System Form and need to open User Defined Field(s).