Creating a global MECDataTranslator variable
This variable is accessible within all Java functions in the mapping.
The Java code is scanned when you publish or republish a mapping. MECDataTranslator
restrictions apply.
This pattern illustrates how to use MECDataTranslator
in Java user functions:
Important
Java code for translations must use this pattern to avoid errors when you generate and publish the mapping. Hard coded strings must be hard coded strings in the parameter list.
// Instantiate a MECDataTranslator object, used in the whole mapping
String logicalId = "Generic";
String tenantId = null;
String accountingEntityId = null;
String locationId = null;
dt = new MECDataTranslator(MyMapping, logicalId, tenantId, accountingEntityId, locationId, "EDIFACT", "D01B", "ORDERS", 'O');
// Perform the actual translation (from the variable iCustPartyID to the variable e01_3039)
e01_3039 = dt.translate("g002/NAD", "3039", iCustPartyID, "3035", "BY", "Customer party ID");
For ION, where the application context is not used and logical ID is always "Generic", use this example.
For IEC, you can use any application context given the hard coded four levels logical ID, tenant ID, accounting entity ID, and location ID. In IEC you can, for example, get tenant ID and accounting entity ID from an incoming BOD.