如何通过SAP B1中的C#代码创建矩阵样式UDO

2020-09-08 06:03发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)专家们, 我想使用C#代码(不...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


专家们,

我想使用C#代码(不是手动)将用户定义的对象(UDO)添加为矩阵样式。

请问有人建议在此提供任何参考代码吗?

注意:不是手动操作,只能通过C#代码抛出。

谢谢

Chenna

(5.5 kb)
4条回答
SKY徐
2020-09-08 06:43 .采纳回答

您好 Chenna Gadicherla

以下代码对我来说很好 。 您可以尝试一下,让我知道:

 SAPbobsCOM.UserObjectsMD oUserObjectMD = null;
             SAPbobsCOM.UserObjectMD_FindColumns oUDOFind = null;
             SAPbobsCOM.UserObjectMD_FormColumns oUDOForm = null;
             SAPbobsCOM.UserObjectMD_EnhancedFormColumns oUDOEnhancedForm = null;
             GC.Collect();
             oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)作为SAPbobsCOM.UserObjectsMD;
             oUDOFind = oUserObjectMD.FindColumns;
             oUDOForm = oUserObjectMD.FormColumns;
             oUDOEnhancedForm = oUserObjectMD.EnhancedFormColumns;
             var retval = oUserObjectMD.GetByKey(" UDOCODE");
             如果(!retval)
             {
                 oUserObjectMD.Code =" UDOCODE";
                 oUserObjectMD.Name =" NAME";
                 oUserObjectMD.TableName =" UDOTABLE";
                 oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData;
                 oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO;
                 oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tNO;
                 oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO;
                 oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUserObjectMD.MenuItem = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUserObjectMD.EnableEnhancedForm = SAPbobsCOM.BoYesNoEnum.tNO;
                 oUserObjectMD.MenuCaption ="菜单标题";
                 oUserObjectMD.FatherMenuID = 48896;
                 oUserObjectMD.MenuUID =" UDOMenuUID";
                 oUserObjectMD.Position = 5;




                //=================================
                 oUDOFind.ColumnAlias ="代码";
                 oUDOFind.ColumnDescription ="代码";
                 oUDOFind.Add();
                 oUDOFind.ColumnAlias ="名称";
                 oUDOFind.ColumnDescription ="名称";
                 oUDOFind.Add();
                //=======================================


                //========================================
                 oUDOForm.FormColumnAlias ="代码";
                 oUDOForm.FormColumnDescription ="代码";
                 oUDOForm.Editable = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOForm.Add();


                 oUDOForm.FormColumnAlias =" U_FirstName";
                 oUDOForm.FormColumnDescription =" U_名字";
                 oUDOForm.Editable = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOForm.Add();


                 oUDOForm.FormColumnAlias =" U_Email";
                 oUDOForm.FormColumnDescription ="电子邮件";
                 oUDOForm.Editable = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOForm.Add();


                //========================================


                 oUDOEnhancedForm.ColumnAlias ="代码";
                 oUDOEnhancedForm.ColumnDescription ="代码";
                 oUDOEnhancedForm.ColumnIsUsed = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOEnhancedForm.ColumnNumber = 1;
                 oUDOEnhancedForm.ChildNumber = 1;
                 oUDOEnhancedForm.Editable = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOEnhancedForm.Add();


                 oUDOEnhancedForm.ColumnAlias =" U_FirstName";
                 oUDOEnhancedForm.ColumnDescription ="名字";
                 oUDOEnhancedForm.ColumnIsUsed = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOEnhancedForm.ColumnNumber = 2;
                 oUDOEnhancedForm.ChildNumber = 1;
                 oUDOEnhancedForm.Add();


                 oUDOEnhancedForm.ColumnAlias =" U_Email";
                 oUDOEnhancedForm.ColumnDescription ="电子邮件";
                 oUDOEnhancedForm.ColumnIsUsed = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOEnhancedForm.Editable = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOEnhancedForm.ColumnNumber = 3;
                 oUDOEnhancedForm.ChildNumber = 1;
                 oUDOEnhancedForm.Editable = SAPbobsCOM.BoYesNoEnum.tYES;
                 oUDOEnhancedForm.Add();


                 如果(!retval)
                 {
                     如果((oUserObjectMD.Add()!= 0))
                     {
                         MessageBox.Show(oCompany.GetLastErrorDescription());
                     }
                     其他
                     {
                     }
                 }
             }
 

亲切的问候,

ANKIT CHAUHAN

SAP Business One支持

一周热门 更多>