Wednesday, October 22, 2014

Execute DB Queries inside Mapper

Even its not encourage to execute direct SQL queries inside the MEC mapper due to performance issue, but If you don't have any other soluion (from APIs for WebServices) rather than that,  you can call DB queries inside the map.

This is not the "Database" tool available in Mapper toolbar. Inside a Java function you can use below to pull some value from the database.

String sql = "SELECT CFFACI FROM "+schema+".CFACIL WHERE CFCONO="+CONO+" AND CFFANM = "+locationCode;

String FACI = "";

 java.sql.Connection con =   ;
 java.sql.Statement stmt = con.createStatement();
 java.sql.ResultSet rs = stmt.executeQuery(sql);

 if ( 
    FACI = rs.getString("FACI").trim();


Thursday, October 9, 2014

Process Setup of Partner Agreements in Infor Partner Administration Tool (PAT)

In this post, I'll share three different type of process setup in PAT which can be used with a Flat file/Disk-In channel based MEC integration.

1. Read the flat file and push the contained data to M3.
2. Use a trigger file to extract some data from M3 and dump it to a flat file
3. Mixture of both : Read some values from flat file, get some data from M3 and dump it to a flat file.

Note : It's Required to configure the channels and the map should be published prior to get certain process visible in the Process tab.

> Read the flat file and push the contained data to M3.

Use a trigger file to extract some data from M3 and dump it to a flat file and Mixture of Both :

Process setup is same for the 2nd and 3rd scenario, but for the triggered file scenario you must set the input schema as default schema when creating the Map, and it's better if you can create your own flat file definition for the trigger file and map it to first FLAT to XML process.

How to Log and Trace MEC Logs to Verify the Logic

From this post, I'm going to describe two ways that I've used to verify the logic that I have implemented inside of the MEC mapper. This is not the debugging option that is discussed in the "M3 Enterprise Collaborator Mapping Manager User Guide". 

As a best practice you can use the build in logger options as below.

~ M3 Enterprise Collaborator - Best Practices Guide

But, using these loggers unnecessarily will cost some additional I/O cost resulting to drain the performance of the run time server. So it's good to place the logging statements with a boolean flag (initiate a global variable of type boolean) where you can initiate it to true during the development and testing period to enable logging operation.

Ex :
if(debug) {*Some comment*/);

My advice is to always use a specific prefix as the starting of your comment text to make them locate more faster. So initiate a const string variable and assign a unique value that you can use to identify the map uniquely. For this it's recommended to use the Spec Code, Doc Code, Function Code etc. which is given to you.

as an example : MyMapIdentifier + "Some Comment" ); 

Let's see how to check the logged information.

> Using the Infor LifeCycle Manager
1. Logged in to LifeCycle Manager, expand the M3 Enterprise Collaborator x.x.x.x.
2. Right click on MEC and select Manage Application.

3. Click on Events

4. You can view the last 500 events recorded in this window.

   Disadvantage in here is you can use view only the last 500 events (by default), But using the Log search option you can specify a time frame, part of the text message etc. and do an advanced search.

 > Using the MEC Storage Database
You have to have permission to access the database server to use this method. If you are tricky enough, You can locate the login information from the Eclipse (MEC Mapper) preference. Look for the required information inside ION Mapper -> Database Connectivity section.

Then you have to log into the database i.e. if is it Ms-SQL server use SQL Management Studio.  Use the below query to list down the events recorded.

select  LogTime, Message
from dbo.MecLog
where LogTime > 1412853722833
order by LogTime ASC

Before execute this, you have to find the last log time using the same table and set it to the highlighted value. 

Advantage in here is that you can get all the events and you have the power of using the SQL commands.

Tuesday, October 7, 2014

How to Set MEC Outbound File Name Using Code

This article describes how to apply a unique name to the out-bound file that is generated from the MEC.

[Spec Code] + _ [yyyyMMddhhmmss]

First the system date and time has to be generated and assign in to a string variable ( as described in this post ). Then call the below built in method inside a user defined function ( make sure that it's not inside a block which is controlled by a logic). 

setManifestInfo("map:M3_MEC_001", fileName);

then go to Partner Admin -> Manage -> Communication -> Send Tab and select your channel configuration and click on edit.

Now set the File name equally to what you have mentioned inside of setManifestInfo method of your code, but with brackets. Set file extension to " - " (no spaces or quotation marks). Set the value of "Class to make file name unique" to MEC_InfixManifest.

Now trigger your inbound channel and check the output.

Wednesday, October 1, 2014

Get the Date and Time inside MEC mapper

While doing some MEC developments my team has encountered with a requirement where we have to send the result to an outbound as a flat file, and the name of the file should be <specificationCode>.yyyyddmmhhmmss.xml.

I found this class and methods which can cater the above file name generation requirement.

com.infor.ecutil.util.DateTimeConverter c = new DateTimeConverter();
String fileName =  "MyFileName." + c.getEDIDateTime()+""+c.getEDIDateTime("TS")+".xml";

"TS" => the Format Qualifier

I've found the Format Qualifies in Phillip Kuo's web site.

Tuesday, September 23, 2014

How to verify the Basic Environment Setup for MEC Development

In this post, I thought of describing how to make sure that the basic environment is setup for the MEC development.

You should have the following installed and properly configured.

1. M3 Enterprise Collaborator (Should contain Flat File Repository Manager, Partner Administrator)
2. LifeCycle Manager
3. Infor Smart Office (in a case if you need to verify what you have done)

Check for the Infor installation folder in one of your disk partition, most probably it should be in your system partition. Inside of that there should be a folder called MEC.  Inside of that check for the below files and folders.

1. CentralFiles : is the pre-configured folder where Inbound channels are configured to drop the files.
2. Mapper :  Eclips pre installed folder, Inside plugins folder, check whether for com.lawson.xxxx like folders.
3. Workspaces : Eclips work-spaces,

If you have these

1. Flat File Repository Manager
2. Partner Administrator
3. Eclips (from the Mapper folder, you might be prompted to enter ION password if you have configured the ION Mapper)
3. LifeCycle Manager (Provide the your user name/password)

From the next article I'll take a sample scenario and explain how the Flat File Definition tool is used.

Sunday, September 21, 2014

Infor - M3 Enterprise Collaborator (MEC)

MEC is an Infor M3 software component that can be used to integrate M3 with different systems by enabling Infor M3 to create, send, and receive electronic documents in XML and flat file formats.

In simple words, Infor MEC is a Lawson M3 specific application connector like Microsoft BizTalk Server.  

The M3 Enterprise Collaborator (MEC) product and ION Connect provide the interface between Lawson M3 applications and other Infor applications.

So, What is Infor ION?

Infor ION is Infor’s business middleware. Infor ION is a tool that allows customers to connect business applications, organize business processes and empowers users to be more effective. Infor ION is the gateway to share business object documents (BODs) with Infor applications.

MEC can be used in three different ways:

1. Messaging connector via XML or Flat messages :

MEC exposes M3 business logic as XML or Flat interface documents and interacts via request / reply scenarios.

2. As an EDI solution : 

Full EDI infrastructure with supplementary, ready-made message interfaces based on industry standards like EANCOM, ODETTE, VDA, TRADACOMS, and ANSI X.12.

3. Light Weight Message Broker

Easy and straightforward to integrate M3 applications with the messaging interfaces of other

MEC can use Lawson Web Services (LWS), MI-programs, External Program Connector (EPC), and M3 Output Management (MOM) to retrieve data from M3 or write data to M3. Requests to MEC and replies from MEG are sent in XML or Flat File format.

Sources ::
1. MEC Fundamentals Training Workbook
2. Infor10 Lawson Process Automation Frequently Asked Questions