使用UDO一般服务添加数据

2020-08-20 01:50发布

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

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


此代码不起作用。代码运行无错误,但数据未插入数据库

 SAPbobsCOM.GeneralService oGeneralService;
             SAPbobsCOM.GeneralData oGeneralData;
             SAPbobsCOM.GeneralDataParams oGeneralParams;
             SAPbobsCOM.GeneralServiceDataInterfaces genserdataint;
             SAPbobsCOM.CompanyService oCompService = oCompany.GetCompanyService();
             oCompany.StartTransaction();

             oGeneralService =(SAPbobsCOM.GeneralService)oCompany.GetCompanyService()。GetGeneralService(" test");

             oGeneralData =(SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData);


             oGeneralData.SetProperty(" Code"," 1");
             oGeneralData.SetProperty(" Name"," test");
             oGeneralData.SetProperty(" U_Year",2020);
             SAPbobsCOM.GeneralData oChild;
             SAPbobsCOM.GeneralDataCollection oChildren = oGeneralData.Child(" TROW");
             oChild = oChildren.Add();
          
             oChild.SetProperty(" U_Day",10);
             oGeneralService.Add(oGeneralData);
 

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

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


此代码不起作用。代码运行无错误,但数据未插入数据库

 SAPbobsCOM.GeneralService oGeneralService;
             SAPbobsCOM.GeneralData oGeneralData;
             SAPbobsCOM.GeneralDataParams oGeneralParams;
             SAPbobsCOM.GeneralServiceDataInterfaces genserdataint;
             SAPbobsCOM.CompanyService oCompService = oCompany.GetCompanyService();
             oCompany.StartTransaction();

             oGeneralService =(SAPbobsCOM.GeneralService)oCompany.GetCompanyService()。GetGeneralService(" test");

             oGeneralData =(SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData);


             oGeneralData.SetProperty(" Code"," 1");
             oGeneralData.SetProperty(" Name"," test");
             oGeneralData.SetProperty(" U_Year",2020);
             SAPbobsCOM.GeneralData oChild;
             SAPbobsCOM.GeneralDataCollection oChildren = oGeneralData.Child(" TROW");
             oChild = oChildren.Add();
          
             oChild.SetProperty(" U_Day",10);
             oGeneralService.Add(oGeneralData);
 
付费偷看设置
发送
1条回答
me_for_i
1楼-- · 2020-08-20 02:19

嗨,Yomal,

您正在开始交易,但是没有代码可提交更改:

 oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit); 

注意:服务不会返回错误消息,它们会引发您必须捕获的异常。 您还应该知道,异常正在触发事务回滚。

最诚挚的问候,

Maik

一周热门 更多>