最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

D365FO中的公司间日记账导入(通过自定义)

网络文摘 William 2浏览 0评论

大家好,

跨公司(也称为跨公司)日记导入是多公司环境中常见的要求,但没有标准的数据实体支持此功能。然而,LedgerJournalTrans表中有公司或抵消公司的字段,但这些字段不暴露于LedgerJournalEntity。

幸运的是,D365FO的可扩展性模型使我们能够干净利落地扩展实体和底层数据模型,且开发工作最少。

首先,让我们了解我需要实现这一目标所需的一切,
1. LedgerJournalEntity实体扩展
2. LedgerJournalEntityStaging 表扩展
3. LedgerJournalEntity 的扩展类

步骤1:扩展LedgerJournalEntity,并将实体数据源表(LedgerJournalTrans)中的“Company”和“OffsetCompany”复制到实体字段节点中添加。

步骤2:扩展LedgerJournalEntityStageg表,并将这两个字段添加到该表中(你可以从LedgerJournalTrans表复制字段)。

步骤3:为LedgerJournalEntity创建一个扩展类,并扩展“CopyCustomStagingToTarget”方法,并在下方添加代码,

public static container copyCustomStagingToTarget(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution)
{
container con = next copyCustomStagingToTarget(_dmfDefinitionGroupExecution);
LedgerJournalEntityStaging staging;
LedgerJournalTrans ledgerJournalTrans;
ttsbegin; 
ledgerJournalTrans.skipDataMethods(true);

while select forupdate ledgerJournalTrans
    join staging
    where staging.JournalBatchNumber == LedgerJourna Trans.JournalNum
        && staging.LineNumber == LedgerJournalTrans.LineNum
        && staging.DefinitionGroup == dmfDefinitionGroupExecution.DefinitionGroup
        && staging. ExecutionId == difDefinitionGroupExecution.ExecutionId
{
    ledgerJournalTrans.Company = staging. Company;
    ledgerJournalTrans.OffsetCompany = staging.OffsetCompany:
    ledgerJournalTrans.update();
}

ttscommit;

LedgerJournalEntity: : updateIntegrationStatus(_dmfDefinitionGroupExecution);

return con;
}

<上方为代码>
构建并同步你的解决方案,你就可以导入公司间的日记账了。

希望这些信息对你有帮助。

谢谢,

——Harry
关注我们的Facebook,保持我们的节奏。https:fb.com/theaxapta

转载请注明:ww12345678 的部落格 | AX Helper » D365FO中的公司间日记账导入(通过自定义)

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址