Tutorial: Interface - Import
Information
- The following workflow provides basic knowledge of interface creation in PLANTA project by means of the functions delivered.
- In this example, an interface is customized for the import of cost centers.
Requirements
- Basic customizing knowledge (creating modules)
Create CSV File
Objective
- To create a CSV file
Procedure
- Create a CSV file to be imported and store it in the required directory.
- A file from which you can, e.g., import the cost center name and the person responsible can, e.g., be structured as follows:
ou_cctr_name;ou_cctr_respons
New cost center;R41
Other cost center;R41
Third cost center;R43
Create Source Module
Objective
- To create a module that can read a CSV file
Procedure
- Create a new module
- Assign the
ppms.interface.CSVModule
Python module subclassto the module. - Create a dummy data area.
Tip
- Alternatively, the 009C7H standard module can be used as a source module.
Create Target Module
Objective
- To create a module which contains the data fields of DT808 Cost center that are to be imported.
Procedure
- Login as customizer.
- Open Customizer → Module Customizer → Modules in the user menu
- Create a new module.
- Assign the
ppms.interface.CSVModule
Python module subclass to the module. - Create a data area and fill it with fields from DT808. In this example, the following fields are used:
- DI007039 Cost center name
- DI007041 Person responsible
- Enter a DA Python ID for the data area.
Caution
- For interfaces which import into a table which contains a primary key with auto number, e.g. (DT463), the primary key must always be at the first position in the target data area of the target module. This is relevant for later updates.
Create Configuration
Objective
- To create an interface configuration
Procedure
- Open the Configuration module.
- Create a new configuration.
- Enter an appropriate title, e.g. Cost center import.
- Enter the ID of the created source module in the Source module field.
- Enter the ID of the created target module in Target module field.
- Click on the Edit parameters button.
- The Interface Parameters module will be opened.
- The da_name source module parameter takes the Python ID of the previously created data area of the target module as a value.
- The parameters of the target module are preset with reasonable values. The file name of the CSV file to be imported must be entered under filepath. If there are headings in the CSV file, you have to set readheader = 1 in addition.
- The Interface Parameters module will be opened.
Create Mapping
Objective
- To create a mapping for the current configuration
Procedure
- Click on the Generate mapping button in the record of the current configuration.
- The Generate Mapping module will be opened.
- Select the Import option from the listbox.
- Click on the Generate button.
- An import mapping is automatically created and the dialog module will be closed.
- If the headings in the CSV file do not match the Python IDs of the corresponding fields in the target module, you have to adopt the values accordingly.
- Examples:
- Change the name in the Object field in the mapping element of the SOURCE type,
- e.g. Project instead of pr_id
- Examples:
Carry Out Transfer
Objective
- To carry out the import
Procedure
- Right-click on the record of the current configuration and select the Execute entry from the context menu.
- The Execution module is opened with the current record.
- Select the Reload data from source to target value from the Transaction type listbox.
- Click on the Execute button.
- A dialog message is displayed which informs you that templates could not be run and offers to run a copy instead. Confirm the message.
- A copy of the configuration is created and the data is imported accordingly.
- After successful import run, the Done checkbox is activated.
Note
- After a file has been imported successfully, the UUID of the interface configuration is written in the file name and the file is moved to the directory configured via
archive_dir
.