Example X++ job to call an AIF Document Service create (for easier debugging)
As part of AIF Document Service related examples, here you can find an example X++ code to call AIF Document Service. This is useful for example when you want to debug your AIF Document Service code.
static void JAD_SCOCreateInvoice(Args _args)
{
JADSCOVendInvoiceService invoiceService;
JADSCOInvoice invoice;
JADSCOInvoice_JADVendInvoiceInfoTable infoTable;
JADSCOInvoice_JADVendInvoiceInfoLine infoLine;
AifEntityKeyList entityKeyList;
Num num;
// Create the service instance
invoiceService = JADSCOVendInvoiceService::construct();
// Create the document object
invoice = new JADSCOInvoice();
invoice.createJADVendInvoiceInfoTable(); // Create the JADVendInvoiceInfoTable list
infoTable = invoice.parmJADVendInvoiceInfoTable().addNew(); // Add JADVendInvoiceInfoTable instance to JADVendInvoiceInfoTable list
// Initialize the JADVendInvoiceInfoTable instance
infoTable.parmPurchId(‘PO000001’);
infoTable.parmTransDate(mkDate(23,8,2017));
infoTable.parmInvoiceId(‘InsideAXAugust23_1’);
infoTable.parmDocumentDate(mkDate(23,8,2017));
infoTable.parmInvoiceAccount(‘V001900’);
infoTable.parmPurchaseType(PurchaseType::Purch);
infoTable.parmSCOCaseId(30000);
// Create the infoLines
infoLine = new JADSCOInvoice_JADVendInvoiceInfoLine();
// Initialize the infoLines instance
infoLine.parmItemId(‘ITEM0000001’);
infoLine.parmLineAmount(27.10);
infoLine.parmcurrencyCode(‘GBP’);
infoLine.parmPurchaseLineLineNumber(40);
infoLine.parmReceiveNow(1);
infoLine.parmDimEmployee(‘00000007’);
infoLine.parmDimCostCenter(‘0001’);
infoLine.parmDimPurpose(‘Purpose001’);
infoLine.parmDimSite(‘SITE01’);
infoTable.createJADVendInvoiceInfoLine().add(infoLine);
// Create
entityKeyList = invoiceService.create(invoice);
}