If you have extended a base table with a new field and want to populate that field during a purchase or sales document import, you'll need to take the following steps:
- Extend the Document Import Buffer table
- Add your field(s) to the appropriate Import Layout(s) (SALESINV, SALESCM, PURCHCM, PURCHINV)
- Subscribe to Import Documents events to populate your fields
1. Extend Document Import Buffer
The Document Import Buffer table is a temporary table used to stage the import of documents (header/line tables). Add your field(s) to the "tctxi Document Import Buffer" table (70274602) using an AL tableextension object.
2. Add your field(s) to the appropriate Import Layout(s)
The Import Layout table defines how fields are processed when importing a particular table.
Use the InsertLayoutField procedure in the "tct App Installation" (70274600) codeunit to add your fields to the appropriate Import Layout(s):
InsertLayoutField(LayoutCode: Code[20]; TableId: Integer; FieldId: Integer; IsRequired: Boolean; IsDimension: Boolean; DimensionNo: Integer; IsValidated: Boolean; IsSystemField: Boolean)
NOTE: use the "tctxi Layout Codes" codeunit to get the standard Import Layout names (e.g., SalesInvoices, SalesOrders).
3. Subscribe to Import Documents events to populate your fields
The "tctxi Import Documents" codeunit raises events during processing to permit you to populate your custom fields in the application.
Key events in for Sales documents:
OnAfterCreateSalesHeader(DocumentImportBuffer: Record "tctxi Document Import Buffer" temporary; var SalesHeader: Record "Sales Header") OnBeforeAssignAmountsSalesLine(DocumentImportBuffer: Record "tctxi Document Import Buffer" temporary; var SalesLine: Record "Sales Line") OnAfterCreateSalesDocument(var SalesHeader: Record "Sales Header")
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article