Skip to Content
author's profile photo Former Member
Former Member

UDO registration through COde

Hi

I m unable to do registration of UDO through code.

I m having two tables.1. U_UDOM(Master) and the second one is U_UDOC(Child). As i add my UDO, after assigning all properties it gives me error code(-<b>50002</b>). Can u help me regarding this error???

Also i want to know these properties of SAPbobsCOM.UserObjectsMD(i mean what values we should assign to these properties)

oUserObjectMD.Code = "EMPID";

oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES;

oUserObjectMD.Name = "EMPNAME";

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 03:56 PM

    Hi Pankaj,

    Please let us know what is the error desciption by adding line

    MessageBox.Show(oCompany.GetLastErrorDescription)

    Adele

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 03:55 PM

    Hi

    I use this code in Vb.NET

    '

    ' Definition: UDO

    ' Algoritm :

    ' Notes :

    ' Parameters: p_sFindColumnsList: lista delle colonne del find, separate da ';'

    ' p_sTableNamesList: lista delle tabelle dettaglio, separate da ';'

    ' Return :

    '

    Public Function AddUDO(ByVal p_sUDOCode As String, ByVal p_sUDOName As String, _

    ByVal p_sTableNameTestata As String, ByVal p_enObjType As SAPbobsCOM.BoUDOObjType, _

    ByVal p_sFindColumnsList As String, _

    ByVal p_sTableNamesList As String, _

    Optional ByVal p_CanYearTransfer As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO, _

    Optional ByVal p_CanLog As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO) As Boolean

    Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD

    Try

    oUserObjectMD = sboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)

    If oUserObjectMD.GetByKey(p_sUDOCode) = 0 Then

    oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES

    oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES

    oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO

    'oUserObjectMD.FormColumns

    oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES

    oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES

    Dim l_vList() As String

    Dim l_i As Integer

    l_vList = Split(p_sFindColumnsList, ";")

    For l_i = 0 To l_vList.Length - 1

    If l_vList(l_i).Length > 0 Then

    If l_i = 0 Then

    oUserObjectMD.FindColumns.ColumnAlias = l_vList(l_i)

    Else

    oUserObjectMD.FindColumns.Add()

    oUserObjectMD.FindColumns.SetCurrentLine(l_i)

    oUserObjectMD.FindColumns.ColumnAlias = l_vList(l_i)

    End If

    End If

    Next

    oUserObjectMD.CanLog = p_CanLog ' SAPbobsCOM.BoYesNoEnum.tNO

    If oUserObjectMD.CanLog = tNO Then

    oUserObjectMD.LogTableName = ""

    Else

    oUserObjectMD.LogTableName = "A" & p_sTableNameTestata

    End If

    oUserObjectMD.CanYearTransfer = p_CanYearTransfer

    l_vList = Split(p_sTableNamesList, ";")

    For l_i = 0 To l_vList.Length - 1

    If l_vList(l_i).Length > 0 Then

    If l_i = 0 Then

    oUserObjectMD.ChildTables.TableName = l_vList(l_i)

    Else

    oUserObjectMD.ChildTables.Add()

    oUserObjectMD.ChildTables.SetCurrentLine(l_i)

    oUserObjectMD.ChildTables.TableName = l_vList(l_i)

    End If

    End If

    Next

    oUserObjectMD.ExtensionName = ""

    If p_enObjType = BoUDOObjType.boud_Document Then

    oUserObjectMD.ManageSeries = tYES

    oUserObjectMD.CanLog = tYES

    oUserObjectMD.LogTableName = "A" & p_sTableNameTestata

    Else

    oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO

    End If

    oUserObjectMD.Code = p_sUDOCode

    oUserObjectMD.Name = p_sUDOName

    oUserObjectMD.ObjectType = p_enObjType

    oUserObjectMD.TableName = p_sTableNameTestata

    If oUserObjectMD.Add() <> 0 Then

    Dim ErrMsg As String

    Dim ErrCode As Long

    sboCompany.GetLastError(ErrCode, ErrMsg)

    CSetupError.AddError(CSetupError.enErrorType.enError_CreazioneUDO, "Errore creazione UDO Data - " & p_sUDOName & " Tabella " & p_sTableNameTestata, ErrMsg)

    G_SboApp.SetStatusBarMessage("Errore creazione UDO Data - " & p_sUDOName & " Tabella " & p_sTableNameTestata & " - " & ErrMsg, SAPbouiCOM.BoMessageTime.bmt_Medium, True)

    'MsgBox("Error adding UDO Data" & vbCrLf & ErrMsg)

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

    oUserObjectMD = Nothing

    Return False

    End If

    End If

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

    oUserObjectMD = Nothing

    Return True

    Catch ex As Exception

    CSetupError.AddError(CSetupError.enErrorType.enError_CreazioneUDO, "Errore creazione UDO Data - " & p_sUDOName & " Tabella " & p_sTableNameTestata, ex.Message)

    ShowError(ex)

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

    oUserObjectMD = Nothing

    Return False

    End Try

    End Function

    Andrea

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.