Skip to Content
0
Former Member
Jun 28, 2016 at 06:07 AM

UDO not Creating

144 Views

Hi All,

I am using below code , But it does not work , why?

Private Function CreateUDOForm() As Boolean

Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD = Nothing

Dim oUDOFind As SAPbobsCOM.UserObjectMD_FindColumns = Nothing

Try

Dim index As Integer = GetSubMenuId("4352") + 1

oUserObjectMD = DirectCast(oApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD), SAPbobsCOM.UserObjectsMD)

oUserObjectMD.Code = "Hex"

oUserObjectMD.Name = "Hex Trip Details"

oUserObjectMD.TableName = "EAMIN_HTRIP1"

oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_Document

oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tNO

oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tNO

oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tNO

oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO

oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO

oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.EnableEnhancedForm = SAPbobsCOM.BoYesNoEnum.tNO

oUserObjectMD.MenuItem = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FatherMenuID = 4352

oUserObjectMD.MenuCaption = "Hex Trip"

oUserObjectMD.MenuUID = "Hex"

oUserObjectMD.Position = index

oUserObjectMD.FindColumns.ColumnAlias = "DocEntry"

oUserObjectMD.FindColumns.ColumnDescription = "DocEntry"

oUserObjectMD.FindColumns.Add()

oUserObjectMD.FindColumns.ColumnAlias = "U_PostingDate"

oUserObjectMD.FindColumns.ColumnDescription = "Posting Date"

oUserObjectMD.FindColumns.Add()

oUserObjectMD.FindColumns.ColumnAlias = "U_PrjCode"

oUserObjectMD.FindColumns.ColumnDescription = "Project Code"

oUserObjectMD.FindColumns.Add()

oUserObjectMD.FindColumns.ColumnAlias = "U_PrjName"

oUserObjectMD.FindColumns.ColumnDescription = "Project Name"

oUserObjectMD.FindColumns.Add()

oUserObjectMD.FindColumns.ColumnAlias = "U_ShfCode"

oUserObjectMD.FindColumns.ColumnDescription = "Shift Code"

oUserObjectMD.FindColumns.Add()

oUserObjectMD.FindColumns.ColumnAlias = "U_MacId"

oUserObjectMD.FindColumns.ColumnDescription = "Machine Code"

oUserObjectMD.FindColumns.Add()

oUserObjectMD.ChildTables.TableName = "EAMIN_HTRIPd1"

oUserObjectMD.FormColumns.SetCurrentLine(0)

oUserObjectMD.FormColumns.FormColumnAlias = "U_StartTime"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "Start Time"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

oUserObjectMD.FormColumns.FormColumnAlias = "U_EndTime"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "End Time"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

oUserObjectMD.FormColumns.FormColumnAlias = "U_ValAdd"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "Value Added"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

oUserObjectMD.FormColumns.FormColumnAlias = "U_TruId"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "truck Id"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

oUserObjectMD.FormColumns.FormColumnAlias = "U_TruNo"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "Trip No"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

oUserObjectMD.FormColumns.FormColumnAlias = "U_Reason"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "Reason"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

oUserObjectMD.FormColumns.FormColumnAlias = "U_Remarks"

'ChildTable ColumnAlias

oUserObjectMD.FormColumns.Editable = SAPbobsCOM.BoYesNoEnum.tYES

oUserObjectMD.FormColumns.FormColumnDescription = "Remarks"

'ChildTable ColumnDescription

oUserObjectMD.FormColumns.SonNumber = 1

' ChildTable SonNumber

oUserObjectMD.FormColumns.Add()

If oUserObjectMD.Add() <> 0 Then

' Throw New Exception(oApplication.Company.GetLastErrorDescription)

End If

Catch ex As Exception

'Throw ex

Finally

System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserObjectMD)

oUserObjectMD = Nothing

GC.WaitForPendingFinalizers()

GC.Collect()

End Try

Return True

End Function