cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating PLC's using SAP XI

Former Member
0 Kudos

Hello everyone,

Please suggest me how to integrate PLC's using SAP XI.

Thanks and Regards

Rahul Nawale

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rahul,

for PLC we have this flow:

SAP ECC -> XI -> PLC

we have developed a custom adapter, based on the jca adapter, to send string through tcp socket and ftp.

This blog might help you to consider the possibility to use a proxy.

/people/thorsten.nordholmsbirk/blog/2006/08/06/use-a-java-proxy-instead-of-a-jca-adapter

Hope this help

Francesco

Former Member
0 Kudos

hi,

An example for Socket programming:

/people/saravanakumar.kuppusamy2/blog/2005/12/15/socket-integration-with-xi

Regards

Vijaya

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rahul,

to communicate with plc we used socket connection.

We used standard java sun API.

The only thing to consider is that PLC (in my case) accept string in this format:

STX YOURSTRING ETX

where STX is the character 'start of string' and ETX is the character 'end of string', see http://www.asciitable.com.

Here my method to send the string to the socket server:


	private boolean postToSocket(String strHostName, int intPort, String strPacket) throws UnknownHostException, IOException
	{

		boolean bolResult = false;
		
		//this character meaning "start of text"
		char ch_start  = ' ';
		//this character meaning "end of text"
		char ch_end  = ' ';
		
		// (1) create a new socket
		Socket sock = new Socket(strHostName, intPort);
		if (!sock.isConnected())
			return bolResult;

		// (2) retrieve an OutputStreamWriter for the socket
		OutputStream os = sock.getOutputStream();
		if (os == null)
			return bolResult;
		PrintWriter opwChannel = new PrintWriter(new OutputStreamWriter(os));

		// (3) send the packet
		//the packet is build using "start of text" + STRING + "end of text"
		strPacket = ch_start + strPacket + ch_end;
		opwChannel.print(strPacket);
		if (opwChannel.checkError())
		{
			bolResult = false;
		}
		else
		{
			bolResult = true;
		}

		// (4) close the socket
		opwChannel.close();
		sock.close();

		return bolResult;

	}// end postToSocket

To build the adapter i followed the sap documentation and the source and the api present in the sample adapter.

You can get the sap sample adapter from the adapter engine of you xi box (sample_ra.sda)

Here some usefull documents:

Example Adapter and Example Module

Adapter and Module Development

<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/development%20of%20adapters%20for%20the%20sap%20xi%20adapter%20framework.pdf">Session ID: XI301 - Development of Adapters for the SAP XI Adapter Framework</a>

Hope this help

Francesco