cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PCO Socket Connection VS HyperTerminal

former_member202228
Active Participant
0 Kudos

Hi All,

We're trying to process an IP Barcode Scanner message using PCo notifications. How should I configure the subscription item / notification so that the received message is captured as using the HyperTerminal software?  Is there any documentation we should be aware of?

Many Thanks,

Paul Radulescu

Accepted Solutions (1)

Accepted Solutions (1)

former_member196557
Active Contributor
0 Kudos

Hi Paul,

The PCo Socket Agent connects to a TCP/IP Host as a client. When configuring Communication Ports, you can define either a stream of a fixed length, or a terminated stream of data.  There are no other options for data stream input processing within the Source Agent. For example, a  terminator for a stream of characters is a carriage return (CR or 0xD hex) following by a Line Feed (LF, or 0xA hex).  To specify these terminating characters, usef \0D\0A (hex for CR LF) for the Terminator value.  The terminator can be any number of ASCII characters, just use the \XX notation for the hex value of any control characters.

After the fixed length or terminated stream is detected for the port, that character stream is passed to the PCo Agent Instance notification via the subscribed Connection Port Name tag.

Here is a screen shot of a Socket Source Agent with each type of Communication Port defined:

Please reference the PCo help at help.sap.com/pco for the details of the Socket Source Agent configuration.

Regards, Steve

former_member202228
Active Participant
0 Kudos

Hi Steve, thanks for the answer!

What we were using for string terminators were definitely not HEX values of line feed (\n) and carriage return (\r). What HyperTerminal thinks its the end of the message is actually "\r\n"  and this is what we had in PCo.  What we ended up with was a series of streams, as in the screen capture below:

The connection was stable, but we could not understand the contents. I was also trying to use a fixed length of 255, but the streams were different in length. What you see in the above picture s a series of streams is displayed in HyperTerminal as one row.

We have another test scheduled tomorrow (the scanner is used in production currently) and we'll try to use "\0D\0A" instead. I'll keep you posted!

former_member196557
Active Contributor
0 Kudos

Please provide a screen shot of the PCo Socket Source Agent connection ports.  From the logs, it is clear to me that you do not have the correct termination characters defined in the settings. Make sure that you do not define both a Length and Terminator values, only Terminator in your case.

it also appears that the scanner is emitting the data in small packets instead of a single stream.  This is usually because of either network traffic congestion or the scanner is set up to send a character at a time.

In order to capture the data, you will need to set up a Notification and send the received data (for now) to a defined Simulation destination so you can examine what was sent in the notification payload.

Regards, Steve

former_member202228
Active Participant
0 Kudos

Hi Steve,

We did our tests this morning. The source socket connection settings are below:

I also attached a small log (FScan_Gi.txt) around one scan, where the alert is being raised, and the message is being sent to the destination system dummy transaction which only writes the file in the MII Web space (i.e. FS_msg_03.xml)

My take on the multiple streams is that the scanner we used is a fixed industrial type one. The label being scanned contains multiple barcodes and the scanner scans all of them at once, delimiting the message with some CONTROL CHARACTERS, giving some headaches going forward.

If I define an XML query and read the message saves "as is" by the dummy transaction above, I get a nice, but firm message :

which comes from the control characters inserted by the scanner between the barcodes. PCo transmits the message as is, MII saves it as is, but when I try to open and process it .. I can't. Opening it in a transaction in workbench using the text-loader gives me a "prolog" error

Funny. I feel like I get the best out of it sometimes

Definitely I have to get rid of those control characters .. even by truncating the message. There are three barcodes being scanned, I presently need only the last one .. so my question is .. Can I use the expression editor and look for the message content after the "~" sign in the string over there (see FS_msg_03.xml) with something like stringpart('Fscan_GI', ~-location, length-of-the-string-after-~) I code below ?

I have to wait again for the scanner to be available next Tue and test this without copy-pasting the content in the Value box above, but are you envisioning any possible "prolog" errors in the PCo log this time?

Cheers,

Paul.

former_member202228
Active Participant
0 Kudos

Hi Steve,

Do you have any thoughts in filtering the control characters (Unicode 0x1d) which are NOT allowed in an XML type communication on the PCo side (i.e. before the message is created) ?

Many thanks,

Paul Radulescu

former_member185280
Active Contributor
0 Kudos

Hi Paul,


Maybe you can try encoding the message with the base 64 function in PCo and then decode it on the MII side? MII might still complain but its worth a shot.

Regards,
Christian

former_member202228
Active Participant
0 Kudos

Hi Christian,

If I try to encode it is OK for the transfer, but MII is giving me the "prolog" errors while trying to process the message. Writing it to a file does not parse the contents, and saves it as is.

I was trying to cut the whole part of the control characters out of the equation while parsing.

paul.

former_member196557
Active Contributor
0 Kudos

Hi Paul,

Try this:  Pass the entire received contents from the Socket Agent notification to MII, and then use the MII Advanced Flat File Parser to split the string on the '~' character.  This should give you an MII Rowset output, with one Row and two columns; used the 2nd column value for the barcode you need. Advanced Flat File parser is standard with MII14 and later and is available as a custom action block for MII12.2 and earlier.

Regards, Steve

former_member202228
Active Participant
0 Kudos

Hi Steve,

It worked by removing the control characters on the PCo side using Expression Editor.

Luckily, we know how many characters long these barcodes are and when scanning them, they're correctly formatted with a barcode ID [i.e. the particle "(00)"], so now I can parse the notification content before it gets sent, compile the message in what format I need (removing any control characters) and sending it to MII for further processing as SAP Goods Issue updates and verification.

Many, many, thanks!

Paul.

Answers (0)