cancel
Showing results for 
Search instead for 
Did you mean: 

Error after creating Child tables in UDO

Former Member
0 Kudos

Hi All,

I am using UDO(UserObjectsMD), which is bound with three tables

1. MK_OCRD (Master Table)

2. MK_OCPR (Master Data Rows)

3. MK_CRD1 (Master Data Rows)

in my application done in SAP 2007.

In this project I am implementing the same functionality of the 'Contact Person' Tab in 'Business Partner Master Data'. for which i am using child table MK_OCPR.

How can i insert the contact person details(MK_OCPR) using UDO?

Pradeep.

Thirdwave Business Systems

Edited by: pradeep k on Dec 16, 2008 11:12 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi..

ur form load matrix initialization after that

give omatrix.addrow()

Regards.

Billa 2007

Former Member
0 Kudos

Hi,

I think the way i made the UDo is not correct. I have created the UDO as follows. Please point out the errors in it, if any (Especially when I create child tables)

private void CreateUDO()

{

SAPbobsCOM.UserObjectsMD oUDOMarketing = (SAPbobsCOM.UserObjectsMD)oCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD);

try

{

oUDOMarketing.Code = "Marketing";

oUDOMarketing.Name = "Customers";

oUDOMarketing.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData;

oUDOMarketing.TableName = "MK_OCRD";

oUDOMarketing.ChildTables.TableName = "MK_OCPR";

oUDOMarketing.ChildTables.Add();

oUDOMarketing.ChildTables.TableName = "MK_CRD1";

oUDOMarketing.ChildTables.Add();

SAPbobsCOM.BoYesNoEnum tNo = SAPbobsCOM.BoYesNoEnum.tNO;

oUDOMarketing.CanCancel = tNo;

oUDOMarketing.CanClose = tNo;

oUDOMarketing.CanCreateDefaultForm = tNo;

oUDOMarketing.CanDelete = tNo;

oUDOMarketing.CanFind = SAPbobsCOM.BoYesNoEnum.tYES;

oUDOMarketing.CanLog = SAPbobsCOM.BoYesNoEnum.tYES;

oUDOMarketing.LogTableName = "AMK_OCRD";

oUDOMarketing.CanYearTransfer = tNo;

oUDOMarketing.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES;

oUDOMarketing.FindColumns.ColumnAlias = "Code";

oUDOMarketing.FindColumns.ColumnDescription = "Customer";

oUDOMarketing.FindColumns.Add();

oUDOMarketing.FindColumns.ColumnAlias = "Name";

oUDOMarketing.FindColumns.ColumnDescription = "Name";

oUDOMarketing.FindColumns.Add();

oUDOMarketing.FormColumns.FormColumnAlias = "Code";

oUDOMarketing.FormColumns.FormColumnDescription = "Code";

oUDOMarketing.FormColumns.Add();

oUDOMarketing.FormColumns.FormColumnAlias = "U_CardCode";

oUDOMarketing.FormColumns.FormColumnDescription = "Card Code";

oUDOMarketing.FormColumns.Add();

oUDOMarketing.FormColumns.FormColumnAlias = "U_Phone1";

oUDOMarketing.FormColumns.FormColumnDescription = "Phone1";

oUDOMarketing.FormColumns.Add();

int iRet = oUDOMarketing.Add();

if (iRet != 0)

{

string sMsg = oCmp.GetLastErrorDescription();

//throw new Exception(sMsg);

}

int gh = oUDOMarketing.ChildTables.Count;

}

catch (Exception ex)

{

throw ex;

}

finally

{

System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDOMarketing);

oUDOMarketing = null;

GC.Collect();

}

}

Edited by: pradeep k on Dec 18, 2008 10:40 AM

Former Member
0 Kudos

hi

I am not sure but maybe when you add smth (like child tables), you should call SetCurrentLine()

former_member191896
Active Participant
0 Kudos

Hi Pradeep,

- Create a custom UI Form for your Tables/UDO (you can use 'UDO Form Genrator' tool for this or Screen Painter)

- Connect the form to UDO by setting FormCreationParams.ObjectType property

- Use data binding to bind the form fields to Data Sources.

- Your Form should have a button with Unique ID "1" which acts a Add/Update/Find/OK button (part of UDO services)

- Use this button to add data to UDO (also into child table)

Refer to SDK Help -> Customization Tools -> User-Defined Objects -> Using Custom UI Form

Here is a thread that might help you

Regards

Aravind

Former Member
0 Kudos

Hi Aravid,

Thanks for your response. I have created the UI form and bound the fields already.

I want to know how to add multiple rows in a matrix to a child table of the UDO.

Please suggst me the steps.

Pradeep