0

I have developed an addon which adds scanned images to the invoice. If an invoice is added I have no problem, if it's in adding mode I can't allocate it because I don't have a DocEntry value which I need to pass.

Is it possible to add an attachment to a sales document in SDK which is in adding mode?

4

1 回答 1

1

如果您使用的是 DI-API:

在单个事务中包装文档创建并将文件附加到文档(请参阅有关StartTransaction公司对象方法的 SDK 文档)。添加文档后(仍在事务中)通过调用GetNewObjectKey公司对象从第一次更新中获取新的 DocEntry。然后,您可以在附件更新中使用此密钥,最后提交整个事务(使用EndTransaction)。

如果您使用的是服务层:

如果不编写一些服务器端 Javascript 来调用,您将无法在一次事务中完成此操作。见https://blogs.sap.com/2017/09/01/implementing-service-layers-script-engine/

于 2020-10-20T08:34:17.327 回答