cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with creating default form while registeting UDO

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Generaly how i deal with UDO is that i create the UDO tables Design the form in Screen painter and assign the Form to the object directly in Screen painter.

Vasu Natari.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Issue has been fixed.

we did it with same propery "CanCreateDefaultForm" with passing FormCoulmn.

Regards,

Alpesh

Former Member
0 Kudos

Can u please post the line of code that fixed it, and what do u mean by form column...??

Vasu Natari.

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks,

I guess now we dont need to design a form in screen painter.

Vasu Natari.

Former Member
0 Kudos

Yes,Exactly

i hope this will become helpfull to you.

Regards,

Alpesh

Team Lead

SilverTouch Technologies.