演练:在AX 2012中通过AIF配置XML /文件数据导出 / Walkthrough: Configure XML/File Data Export via AIF in AX 2012 – ww12345678 的部落格 | AX Helper
最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

演练:在AX 2012中通过AIF配置XML /文件数据导出 / Walkthrough: Configure XML/File Data Export via AIF in AX 2012

网络文摘 William 223浏览 0评论
This is an example how to export the LedgerJournalTable + LedgerJournalTrans records as XML via AIF

Create a Query

  1. Create a new query and name it AxdLedgerJournal.
  2. Place the LedgerJournalTable as main Datasource
  3. Set the Fields Property Dynamic to Yes
  4. Add the LedgerJournalTrans as child data source
  5. Set the Fields property Dynamic of the LedgerJournalTrans data source to Yes
  6. Set the Relation property of the LedgerJournalTrans data source to Yes
  7. Set the Fetch Mode property of the LedgerJournalTrans data source to 1:n
  8. Set the Join Mode property of the LedgerJournalTrans data source to Outer Join
Document Query  

Use the AIF Document Wizard to generate the service classes

  1. In the menu bar go to Tools > Application Integration Framework > Create document service
  2. Provide the AxdLedgerJournal query as source query for the document service
  3. Select  the options to generate the Read and Find methods
  4. Select the option to generate the AxBC classes
  5. Let the wizard generate the software artifacts for you
AIF Wizard

Fine tune the generated code

  1. Go to the private projects and open the newly generated project
  2. Compile the project
  3. If the cache() methods don’t compile delete them
  4. Review the open tasks and provide meaningful labels
Fine tune AIF Code

Configure the Batch Jobs

  1. In AX go to System Administration > Inquires > Batch Jobs > Batch Jobs
  2. Create a new Batch Job and go to “View Task”
  3. Add four task and choose the following classes
  4. AifGatewayReceiveService
  5. AifGatewaySendService
  6. AifInboundProcessingService AifOutboundProcessingService
  7. Close the Task window and set the Recurrence of the Batch Job to run e.g. all 5 minutes
AIF Batch Jobs  

Configure the File System Adapter

  1. In AX go to System Administration > Setup > Services and Application Integration Famework > Outbound Ports
  2. Create a new Outbound Port
  3. Select the FileSystemAdapter as Adapter
  4. Provide a target location where to place the files e.g. a share with write permissions for the AOS account
  5. Open the Service Operation Dialog and add the LedgerJournalService.read method
  6. Activate the Port
AIF Outbound Port with File System Adapter

Add a send method

On the LedgerJournalTable add the following method
server void sendElectronically(XMLDocPurpose _xmlDocPurpose, AifSendMode _aifSendMode = AifSendMode::Async) { AxdSendContext      axdSendContext = AxdSendContext::construct(); AifEntityKey        aifEntityKey   = AifEntityKey::construct(); Map                 keyData; AifConstraint       aifConstraint = new AifConstraint() ; AifConstraintList   aifConstraintList = new AifConstraintList(); ; keyData = SysDictTable::getKeyData(this);     aifEntityKey.parmTableId(this.TableId); aifEntityKey.parmRecId(this.RecId); aifEntityKey.parmKeyDataMap(keyData);     axdSendContext.parmXMLDocPurpose(_xmlDocPurpose); axdSendContext.parmSecurity(false);     aifConstraint.parmType(AifConstraintType::NoConstraint); aifConstraint.parmId(this.JournalNum); aifConstraintList.addConstraint(aifConstraint);     AifSendService::submitDefault( classNum(LedgerJournalService), aifEntityKey, aifConstraintList, _aifSendMode, axdSendContext.pack()); }

Test the export

Create a job and use the following code to test the export
static void JobTestAifExport(Args _args) { LedgerJournalTable journal; ; journal = ledgerJournalTable::find("00001"); journal.sendElectronically(XMLDocPurpose::Original); }
In AX got to System Administration > Periodic > Services and Application Integration > Queue Manager. You will find a record for the LedgerJournal export. The Batch Job will first create an XML Document and in a second step perform the export to the file system. AIF Queue Manager



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