on 09-22-2008 7:25 AM
Hi All
I'm facing problem on creating default form while registering UDO using some VB.Net code.
the SAP shows object registed successfully.but
it doesn't create the default form.
sample code is
Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tNO
oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.Code = "ABC"
oUserObjectMD.Name = "ABC" oUserObjectMD.ObjectType =SAPbobsCOM.BoUDOObjType.boud_MasterData
oUserObjectMD.TableName ="ABC"
lRetCode = oUserObjectMD.Add()
If lRetCode <> 0 Then
oCompany.GetLastError(ErrCode, ErrMsg)
MessageBox.Show(ErrMsg)
Else
MessageBox.Show("Table " + TableName + " has been registered.")
End If
Regards,
Alpesh
Hi,
What do u mean by creating default form. Did u desig the form in Screen painter.? and assign the object to the form.?
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vasu,
I have created one Master type Table(UDO) and registering that table with SAP.and while registering that UDO we have facality for making that as DefaultForm.
i'm registering UDO through DI API(VB.NET code)
sap successfully registed the table but didn't create default form for that.
i hope this will give idea about the problem we facing.
Regards,
Alpesh
Edited by: Alpesh Dhori on Sep 22, 2008 12:22 PM
Well, there is DI API functionality for Creating default form while registering the UDO.using this feature we can directly create the form. there is no need for creating form in screen painter.
Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
Regards,
Alpesh
Hi,
Please check this from the SDK Help
CanCreateDefaultForm Sets or returns a valid value of BoYesNoEnum type that specifies whether or not the user defined object can use the Default Form service. The default form is an ordinary table with selected default fields.
(field name: CanDefForm).
Hope it helps,
Vasu Natari.
Hi Vasu -
here is the sample code for generating default form
Public Sub RegisterUDO(ByVal TableName As String, ByVal ChildTableName() As String, ByVal TableType As SAPbobsCOM.BoUDOObjType, ByVal FindColoums() As String, ByVal DefaultForm As SAPbobsCOM.BoYesNoEnum, ByVal DefaultFormColumn() As String, ByVal Code As String, ByVal Name As String, ByRef oCompany As SAPbobsCOM.Company)
GC.Collect()
Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
Dim i As Integer
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
If oUserObjectMD.CanFind Then
If Not FindColoums Is Nothing Then
For i = 0 To FindColoums.Length - 1
If Not FindColoums(i) Is Nothing Then
If FindColoums(i).Trim() <> String.Empty Then
oUserObjectMD.FindColumns.ColumnAlias = FindColoums(i)
oUserObjectMD.FindColumns.Add()
End If
End If
Next
End If
End If
oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
If Not ChildTableName Is Nothing Then
For i = 0 To ChildTableName.Length - 1
If Not ChildTableName(i) Is Nothing Then
If ChildTableName(i).Trim() <> String.Empty Then
oUserObjectMD.ChildTables.TableName = ChildTableName(i)
oUserObjectMD.ChildTables.Add()
End If
End If
Next
End If
oUserObjectMD.Code = Code
oUserObjectMD.Name = Name
oUserObjectMD.TableName = TableName
oUserObjectMD.ObjectType = TableType
oUserObjectMD.CanCreateDefaultForm = DefaultForm
If DefaultForm = SAPbobsCOM.BoYesNoEnum.tYES Then
If Not DefaultFormColumn Is Nothing Then
For i = 0 To DefaultFormColumn.Length - 1
If Not DefaultFormColumn(i) Is Nothing Then
If DefaultFormColumn(i).Trim() <> String.Empty Then
oUserObjectMD.FormColumns.FormColumnAlias = DefaultFormColumn(i)
oUserObjectMD.FormColumns.FormColumnDescription = DefaultFormColumn(i)
oUserObjectMD.FormColumns.Add()
End If
End If
Next
End If
End If
lRetCode = oUserObjectMD.Add()
If lRetCode <> 0 Then
oCompany.GetLastError(ErrCode, ErrMsg)
MessageBox.Show(ErrMsg)
Else
MessageBox.Show("Table " + TableName + " has been registered.")
End If
End Sub
Regards,
Alpesh
Team Lead
SilverTouch Technologies
User | Count |
---|---|
96 | |
10 | |
9 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.