cancel
Showing results for 
Search instead for 
Did you mean: 

User define object

Former Member
0 Kudos

Hi all,

Can anyone advice me on how i can register a user define object with the below scenario:

Table A - a user define table (master data)

Table B - a user define table (master data lines)

Table C - a user define table (master data lines)

How can I join Table A to Table B and join to Table C.

Thanks

Jane

Accepted Solutions (1)

Accepted Solutions (1)

FOA
Advisor
Advisor
0 Kudos

Hi Jane,

You have different possibilites to get info about this topic.

- You can check this thread out:

- In the SDK a code sample is delivered as well:

C:\Program Files\SAP Manage\SAP Business One SDK\Samples\UDO\addUDO

- In the help center (DI API section) you can check object UserObjectsMD.

HTH.

Regards,

Felipe

Former Member
0 Kudos

Hi, thanks for the reply.

What I need was:

In Table A, I got fields(ItemCode(primary key), Item Desc...)

In Table B, I got fields(ItemCode, SerialNo(primary)...)

In Table C, I got fields(SerialNo, Expiry...) this is the details of all the transactions for each SerialNo.

Thanks

Jane

Former Member
0 Kudos

Hi Jane,

I believe what you're trying to do is not possible. Table A and B are master data tables and table B and C is child tables. So table B is both a master data and child table. You cannot register a UDO with a child table as master table.

Sorry to he the bearer of bad news

Adele

Answers (1)

Answers (1)

Former Member
0 Kudos

hi Jane,

Do you want Table A or table B to be the parent of table C? I believe you cannot make table B the parent of C as it is not a master data table.

If you want to make A the parent, with both B and C the children, you do as follows:

  Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
  oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
  If oUserObjectMD.GetByKey("AAA") = 0 Then
      oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
      oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
      oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO
      oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
      oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
      oUserObjectMD.FindColumns.ColumnAlias = "Code"
      oUserObjectMD.FindColumns.Add()
      oUserObjectMD.FindColumns.SetCurrentLine(1)
      oUserObjectMD.FindColumns.ColumnAlias = "Name"
      oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
      oUserObjectMD.LogTableName = ""
      oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO
      <b>oUserObjectMD.ChildTables.TableName = "bbb"
      oUserObjectMD.ChildTables.Add()
      oUserObjectMD.ChildTables.TableName = "ccc"</b>
      oUserObjectMD.ExtensionName = ""
      oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO
      oUserObjectMD.Code = "AAA"
      oUserObjectMD.Name = "AAA TEST"
      oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
      oUserObjectMD.TableName = "aaa"
      If oUserObjectMD.Add() <> 0 Then
        Dim ErrMsg As String
        Dim ErrCode As Long
        oCompany.GetLastError(ErrCode, ErrMsg)
        MsgBox("Errorf adding UDO master Data" & vbCrLf & ErrMsg)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserObjectMD)
        oUserObjectMD = Nothing

      End If
    End If
    System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserObjectMD)
    oUserObjectMD = Nothing

Let me know if this is what you need.

Adele.