AIF is great for application integration and providing external applications required data. Document exports can be generated very easily by providing a query to the AIF document wizard. However, if you want to provide not only table fields but calculated values (e.g. display methods) in an AIF document some work is required. This is an example how to add the CustInvoiceJour.contributionMargin() method to the SalesSalesInvoiceService.
Add the following methods to the AxCustInvoiceJour class. (You may duplicate the parm* and set* method from an existing field e.g. InvoiceAmount and change the name and parameter.)
public AmountMst parmContributionMargin(AmountMst _margin = 0)
protected void setContributionMargin()
Add a macro in the class declaration of the SaleSalesInvoice_CustInvoiceJour class
class SalesSalesInvoice_CustInvoiceJour extends AfStronglyTypedDataContainer
// lot more here ..
Add the following methods to the SaleSalesInvoice_CustInvoiceJour class
public boolean existsContributionMargin()
public AmountMST parmContributionMargin(AmountMST_value = 0)
Refresh the schema definitions
Open the AIFDocumentSchemaTable in the table browser and delete the record for the DocumentName SalesInvoice.
In the AOT navigate to the SalesSalesInvoiceService. From the context menu choose to register the service. This will populate the AIFDocumentSchemaTable with the new XML schema including the new field.
Don’t’ forget to activate the new field in your endpoint. Navigate to Basic > Setup > Application Integration Framework > Endpoints > Action Policies > Data Policies > Data Policies and active the new field.
Now you’re ready to test your work. In this example navigate to Accounts Receivable > Inquiries > Journals > Invoice and click on send electronically. Depending on your AIF configuration, check the output. Your new field should be there. Here is the XML from AIF Queue Manager processing an AIF message to a File System Adapter: