Skip to Content
0
Former Member
Mar 20, 2014 at 08:42 AM

Create UDO by using SDK

340 Views

i created UDO by using SDK in SAP Business one,but when i run the project i can't find the default form.

any one help me what is the problem ?

my code is :

 if(!(bl.UDOExist(oCompany,"ConsUDO")))
            {


                SAPbobsCOM.UserObjectsMD UDO = (SAPbobsCOM.UserObjectsMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD);
                UDO.Code = "STCONS";
                UDO.Name = "StConsignment";
                UDO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_Document;
                UDO.TableName = "OCONS";
                UDO.ChildTables.TableName = "CONS1";
                UDO.ChildTables.Add();


                // Set UDO to have a form
                UDO.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES;
                // Set UDO to have a menu 
                UDO.MenuItem = SAPbobsCOM.BoYesNoEnum.tYES;
                UDO.MenuCaption = "st Consignment";
                // Set father and gnment of menu item. 
                UDO.FatherMenuID = 43535; 
                UDO.Position = 1;
                // Set UDO menu UID 
                UDO.MenuUID = "st_Cons";


               




                //Set Services
                UDO.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES;
                UDO.CanClose = SAPbobsCOM.BoYesNoEnum.tYES;
                UDO.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES;
                UDO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES;
                UDO.CanFind = SAPbobsCOM.BoYesNoEnum.tYES;
                UDO.CanLog = SAPbobsCOM.BoYesNoEnum.tNO;
                UDO.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO;
                //UDO.FindColumns.ColumnAlias = "CountDate";
                //UDO.FindColumns.ColumnDescription = "Count Date";
                //UDO.FindColumns.Add();
                //UDO.FindColumns.ColumnAlias = "CardCode";
                //UDO.FindColumns.ColumnDescription = "CardCode";
                //UDO.FindColumns.Add();
                //UDO.FindColumns.ColumnAlias = "WhsCode";
                //UDO.FindColumns.ColumnDescription = "WhsCode";
                //UDO.FindColumns.Add();


                if (UDO.Add() != 0)
                {
                    MessageBox.Show("Failed to add UDO");
                   
                }