Skip to Content

Connecting Barcode Scanners with MII

          This blog is about to explain how to connect Barcode scanners to MII via PCo. This type of process is used to connect devices to MII and ERP without using web pages. In this blog, I am explaining about types of Barcode scanners and their advantages and how to connect with MII.

  • Connecting Barcode scanner to MII via web page
    • Any Serial port / TCP-IP port enabled devices can be connect with MII by using web pages or PCo.
    • In Connection thru web pages, all barcode scanners has pre-defined scripts which send data to web pages.
    • In web pages, the cursor should be positioned on any controls which will capture the incoming data.
    • The controls may be text-box or any input types. Once MII page captures the data, it will proceed it with transaction.
    • For this, we need to create page and disadvantage is by this method each system will connect with single scanner only         

                     Untitled.png

   

  • Currently three types of Barcode scanners are available.
    • Keyboard Wedge Output
    • RS232 (serial) Output
    • USB Output

  • Keyboard Wedge Output
    • The “Keyboard Wedge” output option is the most common option.
    • To interface a keyboard wedge barcode scanner to a PC, we need to connect keyboard along with scanner input cable.
    • The main advantage of the keyboard wedge interface is that it works just like a keyboard. We can set the cursor in text field where we want the barcode data to   go and then scan the barcode and the data pops in just as  if we typed it on the keyboard.
    • The disadvantage of the keyboard wedge interface is that it works just like a keyboard. If the cursor is not in the correct input field in the correct application program, then, when we need to scan a barcode again, the data still gets entered into the PC as if it is being typed in on the keyboard.

                              Untitled.png

  • RS232 Output
    • In RS232 option, we can connect the barcode scanner directly to an available RS232 serial port on the back of PC. In these RS232 output scanner, we can connect barcode scanner to PCo connectors or any other software.
    • If we want to connect multiple scanners to single PC or server, RS 232 is best option and we can use RS232 to USB port to connect multiple scanners.

           

    • We can plug RS 232 cable directly into the system or we can add USB to Serial converter and plug in the system.

                              Untitled.png

  • USB Type output

    • Barcode scanners that have a USB output can work one of two ways.
      The first is that they can work exactly like a Keyboard Wedge scanner and the second is that they can work exactly like a RS232 serial output scanner.
    • A USB Keyboard Wedge barcode scanner works exactly like a “Keyboard Wedge” barcode scanner except that instead of connecting the barcode scanner to the keyboard port on the PC, plug it into a USB port. Then it will be recognized by the PC as a second keyboard device and when we scan a barcode, all barcode data goes into the PC.
    • Just like a standard keyboard wedge scanner, no additional software is needed. Windows will automatically recognize the scanner and treat it as if it were a second keyboard connected to PC.
    • A scanner that has a USB RS232 serial interface will come with a special “Driver” program that we will need to install in the PC that you connect the scanner to. The purpose of the driver is to create a “Virtual RS232 serial port” that works exactly like a physical RS232 port.
    • After we install thedriver that comes with the scanner and connect the scanner to a USB port on PC, Windows will think that it has a new RS232 serial port and PCo will be able to access this port.

  • Connection thru PCo

    • PCo can access multiple barcode scanners thru Socket Agent interface. In these we need to add configuration details for each scanners.
    • A single PCo Socket Agent can define multiple connections, each identified by a unique combination of IP address and Port, and each connection has a unique             name. 
    • WiFi is fine as long as the IP address is routable from PCo Socket Agent to WiFi device, and the WiFi device is a Server, not a client. 
    • If we have multiple barcode scanners connected to a single IP/Port connection, then we will have to place identifying information (i.e., a unique detectable Prefix that is NOT part of the barcode data, like A1, A2, B01, etc.) in the scanner  to be transmitted with the barcode.  Then the PCo Agent Instance Notification can use string logic in the Trigger logic to detect a particular scanner and process  its barcode data.
    • Once data scanned from these devices, data will be received in PCo thru these settings. After receiving the data, it will trigger the MII transaction via PCo – MII connections.


    • MII Transaction will process the received data



  • Structure of Connection Flow:

                    Untitled.png

  • Configuration in MII and PCo.

We will see how to configure PCo with socket agent. Plug the barcode scanner into corresponding ports depends on the type. Get the port no and address of socket.

     1. In MII create a transaction to receive the Barcode message.

                     Untitled.png

     2. In PCo, Select Source system as Socket Agent

                    Untitled.png

     3. Choose the socket type.

    • It might be Ipv4 or IPv6.
      • IPv4: Internet protocol version 4
      • IPv6: Internet protocol version 6
    • Then give name for this connection and IP address of socket.
    • Enter the port no on which Barcode scanner is going to connect.
    • Then enter terminator to identify the end of message in data stream and give length of message in data stream. This terminator may be any char usually we will use #.
    • We can give either terminator or length of message to identify the messages in data stream.

                     Untitled.png

    • In reliable connection tab, set interval and no of retries if connection fails.

     Untitled.png


     4. Once Source system added, create Destination system.

    • In destination, choose MII Destination and give name for this.

Untitled.png

    • Give server name, port and user information like username and password

Untitled.png

     5. Once destination added, create agent instance.

    • Choose the barcode source system as source and give agent name and description.

Untitled.png

    • In subscription items tab, select browse at bottom and select Bar.Message as selected item. This is the input parameter name for Bar. Scanned barcode value will be retrieved on this parameter.

Untitled.png

    • In Query ports, select SAP MII and give new port no. This port no should not be used in any other agents. Check other agent instances before assign it.

  

                                        Untitled.png

    • Once created, save the agent instance. Now we need to create notification for this.

     6. Create Notification

                

    • Right click on agent instance and select add notification

               Untitled.png

              

    • In trigger tab, set to trigger always.

               Untitled.png

       

    • In output tab, click Generate expressions. Then it will add Bar.Message which we selected in agent as expression. If we want to modify, we can add expressions.

                                    Untitled.png

    • In destination, click add destination and select the destination MII system and browse to the target transaction.


                   

                                        Untitled.png

    • In transaction, select the input parameter to receive this Barcode message.

                                       Untitled.png

    • Once selected, save and start the agent instance. Once barcode is scanned, PCo will get it and send it to MII transaction. In MII transaction, we will process the input data.
To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Paul Radulescu

    Hi Senthil,

    Make sure you filer out unprintable characters from the read stream, as the XML message cannot store or transfer them.


    The PCo Notification output is being set as “forward everything” i.e. Bar.Message in Generate Expressions. Here one should adapt the string being transferred, if unprintable characters are being read from the scanner and transmitted via XML.


    Paul.

    (0) 
  2. Jan Buchmann

    Hi Senthil

    Thank you, very interesting blog indeed. But I seem to be missing something here: one of the options you give is to connect the scanner via RS232, i.e. serial communication. Yet, in PCo you define a Socket Agent, i.e. TCP/IP-based. How did you get that to work? 😕

    Jan

    (0) 
    1. Steve Stubbs

      Hi Jan,

      PCo does not have a Serial device connector. You need to get the serial device to be on a TCP/IP as a server so that PCo Socket Agent can connect as a client. I have used these devices in the past to accomplish this:

      http://www.bb-elec.com/Products/Ethernet-Serial-Servers-Gateways/Ethernet-Serial-Device-Servers.aspx

      In practice, PCo is not usually deployed within reach of direct serial device cabling so the network connection is far more cost effective than running cables.

      Regards, Steve

      (0) 
      1. Jan Buchmann

        Hi Steve

        Thank you for your prompt & profound response. I’ve been following your blogs with great interest!

        You have a very valid point there, but I’ve read that PCo does support serial communication via the Modbus protocol and when researching this option, I came across this blog.

        Regards

        Jan

        (0) 
        1. Kevin Hunter

          Hi Jan,

          Whilst your comment is true regarding PCo supporting serial communication via the Modbus protocol, this doesn’t mean that it will work with serial bar-code readers. Modbus is a protocol that defines how the data is formatted so unless your bar-code reader formats the data in Modbus format (which very few, if any, do) then the Modbus serial agent will not work.

          As Steve mentioned you can use a serial to TCP/IP adapter for serial bar-code scanners.

          Regards, Kevin

          (0) 

Leave a Reply