To enable import/export of data in XML files through the data exchange framework in Business Central , you can use XML schemas to define which data elements you want to exchange with Business Central . You perform this work on the XML Schema Viewer page by loading the XML schema file, selecting the relevant data elements, and then initializing either a data exchange definition or an XMLport.
When you have defined which data elements to include based on the XML schema, you can use the Generate XMLport action to create the XMLport object.
Alternatively, you can use the Generate Data Exchange Definition action to initialize a data exchange definition based on the selected data elements, which you then complete in the Data Exchange Framework. This creates a record on the Posting Exchange Definition page where you continue by defining which elements in the file map to which fields in Business Central . For more information, see Set Up Data Exchange Definitions.
This topic contains the following procedures:
To load an XML schema file
To select or clear nodes in an XML schema
To generate a data exchange definition that is based on an XML schema
To generate an XMLport for the file that is based on an XML schema
To import an XMLport into the Object Designer
Make sure that the relevant XML schema file is available. The file extension is .xsd.
In the Search box, enter XML Schemas, and then choose the related link.
On the Home tab, in the New group, choose New.
Fill the fields as described in the following table.
Field | Description |
---|---|
Code | Specify a code to identify the XML schema. |
Description | Specify a description of the XML schema. |
The Target Namespace field specifies any namespace in the XML schema file that has been loaded for the line.
On the Home tab, in the Process group, choose Load Schema, and then select the XML schema file.
When the file is loaded, the rest of the fields on the line are filled with information from the file, and the Schema is Loaded check box is selected.
The tree of the loaded XML schema is collapsed by default. You expand each node by choosing the + button on the node. To expand all nodes, choose Expand All on the ribbon.
In the Search box, enter XML Schema Viewer, and then choose the related link.
Fill the fields on the header as described in the following table.
Field | Description |
---|---|
XML Schema Code | Specify the XML schema file that you loaded in step 5 in the “To load an XML schema file” section. |
New XMLport No. | Specify the number of the XMLport that is created from this XML schema when you choose the Generate XMLport action. |
The lines are now filled with nodes representing all elements in the XML schema. Nodes for elements that are mandatory according to the XML schema are selected by default.
On the first line, in the Node Name column, expand the Document node, and then gradually expand underlying nodes that you want to review.
Alternatively, right-click on a node and then choose Expand All.
On the Home tab, in the View group, choose either of the following actions to change which nodes are displayed.
Action | Description |
---|---|
Show All | All nodes are shown. |
Hide Non-Mandatory | Only nodes representing elements that are required according to the XML schema are shown. These nodes are typically indicated by a 1 in the MinOccurs field. Choose Show All to reverse the view. |
Hide Non-Selected | Only nodes where the Selected check box is selected are shown. Choose Show All to reverse the view. |
On the Home tab, in the Manage group, choose Edit.
In the Selected check box, specify for each node if you want the element to be supported in the data exchange definition for the related SEPA bank file.
When you select a mandatory child node, all parent nodes above it are also selected.
Choose the Select All Mandatory Elements action to reselect all nodes that represent elements that are mandatory according to the XML schema.
Choose the Deselect All action to clear all selections.
The Choice field specifies that the node has two or more sibling nodes that function as options.
In the Search box, enter XML Schemas, and then choose the related link.
Select the relevant XML schema, and then on the on the Home tab, in the Process group, choose Open XML Schema Viewer.
Make sure the relevant nodes are selected. For more information, see the “To select or clear nodes in an XML schema” section.
On the XML Schema Viewer page, on the Home tab, in the Process group, choose Generate Data Exchange Definition.
A data exchange definition is created on the Posting Exchange Definition page, which you can complete by specifying which elements in the file map to which fields in Business Central . For more information, see Set Up Data Exchange Definitions.
You can also use the Get File Structure function from the Posting Exchange Definition page, which uses the functionality of the XML Schema Viewer page to prefill the Column Definitions TastTab.
In the Search box, enter XML Schemas, and then choose the related link.
Select the relevant XML schema, and then on the on the Home tab, in the Process group, choose Open XML Schema Viewer.
In the New XMLport No. field, specify the number that the new XMLport object will be given when it is generated.
Make sure the relevant nodes are selected. For more information, see the “To select or clear nodes in an XML schema” section.
On the Home tab, in the Process group, choose Generate XMLport, and then save the object as a .txt file in an appropriate location.
Import the new XMLport into the Business Central development environment and compile it.
Set Up Data Exchange Definitions
Export Payments to a Bank File
Collect Payments with SEPA Direct Debit
About the Data Exchange Framework
© 2019 Microsoft. All rights reserved.