- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在创建一个应用程序以在 SAP 文档中附加扫描的文档,但我在该过程中遇到了一些问题。我正在使用 SAP BO 9 PL8 并发现了下一个问题:
当我尝试使用更新方法在现有附件中添加新附件行(使用 attachments2 对象)时,DI 尝试检查旧行,并且原始源路径中可能不存在该文件。所以,更新方法报错。我使用下面的代码:
Attachments2 oAtt = oCompany.GetBusinessObject(BoObjectTypes.oAttachments2);
if (oAtt.GetByKey(doc.AttachmentEntry))
{
oAtt.Lines.Add();
oAtt.Lines.FileName = oAttNew.Lines.FileName;
oAtt.Lines.FileExtension = oAttNew.Lines.FileExtension;
oAtt.Lines.SourcePath = oAttNew.Lines.SourcePath;
oAtt.Lines.Override = BoYesNoEnum.tYES;
if (oAtt.Update() != 0)
throw new Exception(oCompany.GetLastErrorDescription());
}
SAP 中有些文档有附件选项卡,但无法通过 DI 访问此功能。例如 Material 主数据 (oItems) 或库存转移 (oStockTransfer)。它们有一个与 Documents 对象类似的 AttachmentEntry 字段,但这些对象没有添加附件的属性,因此我必须为此文档创建一个事件。
Documents doc = oCompany.GetBusinessObject(oType);
doc.GetByKey(int.Parse(docEntry));
doc.AttachmentEntry = oAtt.AbsoluteEntry;
StockTransfer oStock = .oCompany.GetBusinessObject(BoObjectTypes.oStockTransfer);
// oStock.AttachmentEntry = oAtt.AbsoluteEntry FAIL
当我修改 LandedCost 对象中的 AttachmentEntry 属性时,该对象在我尝试更新它时失败。如果对象已经有附件(手动添加),则在新行中添加新附件。第一种情况的错误是:No matching records found (ODBC -2028)。当我强制捕获 block 时,我得到了其他信息:“1320000126 - 更新 header 字段不正确”。我使用下面的代码:
LandedCostsService service = oCompany.GetCompanyService().GetBusinessService(ServiceTypes.LandedCostsService);
LandedCostParams oParam = service.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams);
LandedCost oLandedCost = service.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost);
oParam.LandedCostNumber = int.Parse(docEntry);
oLandedCost = service.GetLandedCost(oParam);
if (oAtt.GetByKey(oLandedCost.AttachmentEntry)) {
// Code similar to first code block I posted
}
else
{
if (oAttNew.Add() != 0)
throw new Exception(oCompany.GetLastErrorDescription());
oAtt.GetByKey(int.Parse(oCompany.GetNewObjectKey()));
oLandedCost.AttachmentEntry = oAtt.AbsoluteEntry;
try
{
service.UpdateLandedCost(oLandedCost);
}
catch (Exception ex)
{
throw new Exception(ex.Message + oCompany.GetLastErrorDescription());
}
}
我需要知道我做错了什么,或者我是否需要联系 SAP 以告知这些 DI 问题。我希望你可以帮助我。提前致谢。
问候,佩德罗
最佳答案
我通常这样做而且很管用!
Private Sub test_NonContinue_LandedCost()
'Sample code for the non-continuous inventory system
Dim svrLandedCost As SAPbobsCOM.LandedCostsService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.LandedCostsService)
Dim oLandedCost As SAPbobsCOM.LandedCost = svrLandedCost.GetDataInterface(SAPbobsCOM.LandedCostsServiceDataInterfaces.lcsLandedCost)
Dim oLandedCostEntry As Long = 0
Dim GRPOEntry As Integer = 15
'Landed cost document - item tab line 1
Dim oLandedCost_ItemLine As SAPbobsCOM.LandedCost_ItemLine
oLandedCost_ItemLine = oLandedCost.LandedCost_ItemLines.Add
oLandedCost_ItemLine.BaseDocumentType = SAPbobsCOM.LandedCostBaseDocumentTypeEnum.asGoodsReceiptPO
oLandedCost_ItemLine.BaseEntry = GRPOEntry
oLandedCost_ItemLine.BaseLine = 0
'Landed cost document - item tab line 2
oLandedCost_ItemLine = oLandedCost.LandedCost_ItemLines.Add()
oLandedCost_ItemLine.BaseDocumentType = SAPbobsCOM.LandedCostBaseDocumentTypeEnum.asGoodsReceiptPO
oLandedCost_ItemLine.BaseEntry = GRPOEntry
oLandedCost_ItemLine.BaseLine = 1
'Landed cost document - item tab line 3
'This is a split line –split from second line (BaseEntry = 13, BaseLine = 1)
oLandedCost_ItemLine = oLandedCost.LandedCost_ItemLines.Add()
oLandedCost_ItemLine.BaseDocumentType = SAPbobsCOM.LandedCostBaseDocumentTypeEnum.asGoodsReceiptPO
oLandedCost_ItemLine.BaseEntry = GRPOEntry
oLandedCost_ItemLine.BaseLine = 1
oLandedCost_ItemLine.Quantity = 2
oLandedCost_ItemLine.Warehouse = "02"
'Landed cost document - cost tab line 1
Dim oLandedCost_CostLine As SAPbobsCOM.LandedCost_CostLine
oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add
oLandedCost_CostLine.LandedCostCode = "CB"
'Suppose the vendor currency is Foreign Currency, if in local currency should set 'oLandedCost_CostLine.amount
oLandedCost_CostLine.amount = 100
'oLandedCost_CostLine.AllocationBy = SAPbobsCOM.LandedCostAllocationByEnum.asCashValueAfterCustoms
'Landed cost document - cost tab line 2
oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add
oLandedCost_CostLine.LandedCostCode = "EQ"
oLandedCost_CostLine.amount = 100
'oLandedCost_CostLine.AllocationBy = SAPbobsCOM.LandedCostAllocationByEnum.asCashValueAfterCustoms
'Landed cost document - cost tab line 3
oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add
oLandedCost_CostLine.LandedCostCode = "EQ"
oLandedCost_CostLine.amount = 100
'oLandedCost_CostLine.AllocationBy = SAPbobsCOM.LandedCostAllocationByEnum.asCashValueAfterCustoms
oLandedCost_CostLine.CostType = SAPbobsCOM.LCCostTypeEnum.asVariableCosts
Dim oLandedCostParams As SAPbobsCOM.LandedCostParams = svrLandedCost.GetDataInterface(SAPbobsCOM.LandedCostsServiceDataInterfaces.lcsLandedCostParams)
'Add a landed cost
Try
oLandedCostParams = svrLandedCost.AddLandedCost(oLandedCost)
oLandedCostEntry = oLandedCostParams.LandedCostNumber
Catch ex As Exception
'exception process
MsgBox(ex.Message)
End Try
'Update a landed cost
Dim oLandedCostUpdateParams As SAPbobsCOM.LandedCostParams = svrLandedCost.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams)
Dim oLandedCostUpdate As SAPbobsCOM.LandedCost = svrLandedCost.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost)
'Operate on the landed cost
oLandedCostUpdateParams.LandedCostNumber = oLandedCostEntry
'Get the landed cost
Try
oLandedCostUpdate = svrLandedCost.GetLandedCost(oLandedCostUpdateParams)
Catch ex As Exception
'exception process
MsgBox(ex.Message)
End Try
'Split functionality, split line 1
Dim oLandedCostUpdate_ItemLine As SAPbobsCOM.LandedCost_ItemLine
oLandedCostUpdate_ItemLine = oLandedCostUpdate.LandedCost_ItemLines.Add()
oLandedCostUpdate_ItemLine.OriginLine = 1
oLandedCostUpdate_ItemLine.Quantity = 1
oLandedCostUpdate_ItemLine.Warehouse = "02"
Dim oLandedCostUpdate_CostLine As SAPbobsCOM.LandedCost_CostLine
oLandedCostUpdate_CostLine = oLandedCostUpdate.LandedCost_CostLines.Add()
oLandedCostUpdate_CostLine.LandedCostCode = "QA"
oLandedCostUpdate_CostLine.amount = 50
oLandedCostUpdate_CostLine.CostType = SAPbobsCOM.LCCostTypeEnum.asVariableCosts
oLandedCostUpdate_CostLine.AllocationBy = LandedCostAllocationByEnum.asQuantity
Try
svrLandedCost.UpdateLandedCost(oLandedCostUpdate)
Catch ex As Exception
'exception process
MsgBox(ex.Message)
End Try
End Sub
关于c# - 在 SAP Business One 9 中使用 DI API 附加文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21159010/
在我的 ZF2 应用程序中,我使用 Zend\Di\Di创建我所有的类实例。使用 Zend\Di\Definition\CompilerDefinition 扫描 DI 定义并使用 APC 缓存。这避
为什么人们使用 Spring DI 而不是 JSR330 DI?我看到许多项目仍在高速推进,而 spring DI 却忽视了 JSR330 规范。许多人甚至不知道它的存在。是不是它的营销力度不够,而
我正在使用 spring 制作一个 Web 应用程序,在 web.xml 中我定义了 context-param 来查找 application-context.xml 文件,该文件扫描除 Contr
给定的是 Intel 8086 处理器的汇编程序,它将数组中的数字相加: .model small .stack 100h .data array dw 1,2,3,1,2 sum
.NET 和 Java 都有大量可用的 DI/IoC 容器,并且每个 有许多我发现在不同方面非常有用的模式 与他们合作。我现在正处于我想做等价的地步 JavaScript 中的东西。由于 JavaSc
我有一个使用 Spring 进行 DI 的 Swing 项目,现在我正在尝试迁移到 Eclipse 4 和 OSGi. 使用 Spring 的配置文件,用户可以注释/取消注释 bean,以添加/删除功
Spring 有两种两种类型的 DI:setter DI 和构造 DI。 基于构造函数的 DI 修复了需要注入(inject)依赖项的顺序。基于 Setter 的 DI 不提供此功能。 基于 Sett
TL;博士 在 JCenter 访问 Kodein 核心包是未经授权的。 详情 我们正在使用 Kodein 进行依赖注入(inject),但是当 Gradle 尝试下载任何 org.kodein.*
我已经使用 NInject 一段时间了,现在我将在 Asp.net Core 中开始一个项目。好像NInject cannot be used with Asp.net Core .所以现在我的问题是
目前缺乏有关 DI 主题的文档 - Dependency Injection 。与现有解决方案(Ninject、Autofac、StructureMap)相比,使用内置 DI 有何优点/缺点?默认依赖
我想做的是将两个 Actor (木乃伊 Actor 和爸爸 Actor )传递给小 Actor 。由于使用 actor 引用而不是 actor 是最佳实践,因此我使用 IActorRef 将木乃伊 a
我是 MQL4 的菜鸟,我正在编写我的第一个 EA。 我的目标是获取 ADX 指标的 +DI 和 -DI 的变量。 我使用了 iADX() 函数,如下所示: double a; int OnInit(
我有一个环境,有 4 个相同的设备,我必须连接到这些设备并通过 TCP 连接请求一些参数(每个设备都有其 IP 地址)。 我为需要一些参数的单个设备实现了一个类(如 IP 地址、端口、轮询间隔等...
我正在尝试将 DI(使用 Autofac)引入现有的 Windows 窗体应用程序。 此应用程序有一个基本的插件架构,其中每个插件都显示自己的表单。在启动时,应用程序会扫描已注册的程序集以查找实现 I
我有一个基于 .NET Core API Gateway 的项目。我想引入依赖注入(inject)(di),因为我需要引入的很多包都是基于这种模式的,所以需要使用 IServiceCollection
我正在尝试使用蛋糕模式进行依赖注入(inject),如下所示: trait FooComponent { val foo: Foo trait Foo; } trait AlsoNeedsFo
我即将创建一个桌面应用程序(使用 .NET windows 窗体) 本质上,我想创建一个 n 层应用程序,但我也想要层之间的松散耦合。但是,我不太确定这是否是 Windows 窗体的好方法 现在我只是
我想在我的一个项目中使用依赖注入(inject) (DI)。我写了一个基本的 DI 库,其工作原理如下 let di = new DI(); di.register('screen', Screen)
在: module.directive 'name', -> (scope, element, attr) -> # Whatever implemenation 链接函数的 scope、
我使用这个库https://github.com/smsapi/smsapi-php-client从站点发送短信。但是当我尝试处理服务中的基类时遇到了问题。所以我的问题是有没有办法用参数调用静态方法?
我是一名优秀的程序员,十分优秀!