<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/da/onlinemanual/000062" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Advanced file handling using common directories</Title>
		<Keyword ContextSensitive="No"><Level1>Advanced file handling using common directories</Level1>
		</Keyword>
	</Header>
	<AimSection><Paragraph class="Default">During regular export and import, Exchange uses a subdirectory for each run. However, functionality is available to automatically copy the files to or from this subdirectory. This functionality can be used by setting the <GUIRef href="" role="manual">Common Directories</GUIRef> in the <GUIRef href="" role="manual">Exchange Schemes (daxch0501m000)</GUIRef> session.</Paragraph>
		<Paragraph class="Default">The functionality and its benefits are discussed in detail next.</Paragraph>
	</AimSection>
	<GeneralSection><SectionTitle>Export functionality</SectionTitle>
		<Paragraph class="Default">In the <GUIRef href="" role="manual">Exchange Schemes (daxch0501m000)</GUIRef> details session, the user can specify a directory to copy files to after a regular export. This field contains a path name. If it is empty, the regular export will work as usual. If a directory is specified, the following is done.</Paragraph>
		<Paragraph class="Default">After running a batch in a regular export, the resulting files will be copied to the directory specified. Existing files in the directory, for example, from the previous regular export run, are overwritten. If one of the batch lines (table relations) did run, but did not create a file successfully, the corresponding file in the specified directory (if any) will be removed. This will avoid the external application importing the same file twice. If files are stored in the specified directory, but the file name does not occur in an active table relation (export), the file will not be overwritten or removed. This enables the external application to combine files created by Exchange with other files if required.</Paragraph>
		<Paragraph class="Default">The files created in the subdirectory of the regular export run will not be removed, so although the files in the directory specified can be overwritten, the files from each regular export run will still be available (until they are deleted by the user explicitly).</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>Import functionality</SectionTitle>
		<Paragraph class="Default">In the Exchange Schemes (daxch0501m000) details session, the user can specify a directory to copy files from before a regular import. This field contains a path name. If it is empty, the regular import will work as usual. If a directory is specified, the following is done.</Paragraph>
		<Paragraph class="Default">Before running a batch in a regular import, the required files will be copied from the directory specified. Only files required by the import are copied, that is: Only files having a file name that is used in one or more active table relations (import) are copied. The files are copied to the subdirectory used by the current import run.</Paragraph>
		<Paragraph class="Default">If one or more files already exist in the subdirectory for the regular import run, they are overwritten, unless files with the same file name do not exist in the directory specified.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>Benefits and alternatives</SectionTitle>
		<Paragraph class="Default">The use of subdirectories in regular export and import has limitations when integrating ERP LN with external applications. The run number is not available to the outside world, so the external application does not know what directory the files must be written to or read from. In practice, programming a session or script to copy the files before each regular import or after each regular export, often solved this. This is no longer required.</Paragraph>
		<Paragraph class="Default">Integration within ERP LN also benefits from the new functionality. The regular export and import of ERP LN Exchange can use common directories to exchange the files. The export and import process will automatically copy the required files. However, using Multisite Control will be more appropriate when both the data source and the data target are ERP LN environments.</Paragraph>
		<Paragraph class="Default">In addition, the automatic file copy guarantees the safety of the regular export and import. Only the files in the common directory are overwritten, but the files, as created by the regular export and used by the regular import, are not overwritten. They can be checked in case of problems, and previous runs can be redone.</Paragraph>
		<Paragraph class="Default">Note that using the <GUIRef href="" role="manual">Regular Export Directory</GUIRef> field or the <GUIRef href="" role="manual">Regular Import Directory</GUIRef> field in the <GUIRef href="" role="manual">Exchange Schemes (daxch0501m000)</GUIRef> session results in overwriting the files from the previous regular export or import run. In that case a previous import run cannot be restarted anymore. This means using common directories is advised, unless you are sure that overwriting files from previous runs is not a problem.</Paragraph>
	</GeneralSection>
</ManualTopic>
