Customizing Examples for Interfaces
Customize an Individual System Check Class (from DB 39.5.7)
Task
- Customize an individual check class
- The class is supposed to check whether there is a file under the path stored in Parameter.
Procedure
- Create a new
check.py
file atpy/customer/ppms/interface/parameter/conditional
- The following code is inserted in the file:
import os
from ppms.interface import BaseConditional
class FileExistsConditional(BaseConditional):
"""Check if the file configured in the parameter exists"""
@property
def is_satisfied(self):
return os.path.isfile(self.parameter)
@property
def value(self):
if self.is_satisfied:
return 'Datei existiert!'
return 'Datei existiert nicht!'
- Restart the PLANTA service.
- The class can now be used.
See also: Systems in PLANTA link |
Stamping During Export Procedure
Task
- Actual hours are to be exported summarized to a file (without pool). The source records in DT472 are to be stamped.
Procedure
- Create individual data items in DT472 Load.
- Create a new module subclass and store it in the customer Python directory.
- Create a new interface configuration.
- To be observed for the source module:
- Assign a new module subclass.
- Data areas must not be set to Never show (DI001587).
Example
- Create new DIs in DT472: Create L100_exported_on and L100_exported_by.
- Create the following source module.
- DT463 Task grouped
- DT463 Task (summarized) with DA Python ID: task_source_records
- DT466 Resource assignment (summarized) with DA Python ID: res_source_records
- DT472 Load with DA Python ID: load_act_source_records
- DT466 Resource assignment (summarized) with DA Python ID: res_source_records
- DT463 Task (summarized) with DA Python ID: task_source_records
- DT463 Task grouped
- Enter the corresponding stamp_mts.py module subclass.
Notes
- When using the Load export interface, the following data fields are stamped from DT472 Load by default: SAP status (DI060750), Exported on (DI003399), Exported by (DI003402).
- The above mentioned customizing example shows how arbitrary data fields can be stamped. This becomes necessary, e.g., if actual data must be exported multiple times (to different targets).
Optimize Performance of Interface Calls (From DB 39.5.8)
Task
- The performance of the PLANTA link has been improved in DB 39.5.8 by drastically lowering the number of required database access.
- Individual code which calls interfaces can also be optimized.
Procedure
- Make the following changes:
- Previous code:
from ppms.interface import Config
config = Config('config-uuid')
# copy/execute the interface ...
- New code:
from ppms.interface import StaticConfig
config = StaticConfig('config-uuid')
# copy/execute the interface ...