Product Lifecycle Management Blogs by Members
Get insider knowledge about product lifecycle management software from SAP. Tap into insights and real-world experiences with community member blog posts.
Showing results for 
Search instead for 
Did you mean: 

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         



  • 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.


  • 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.


  • 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:


  • 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.


     2. In PCo, Select Source system as Socket Agent


     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.


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


     4. Once Source system added, create Destination system.

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

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

     5. Once destination added, create agent instance.

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

    • 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.

    • 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.



    • 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



    • In trigger tab, set to trigger always.



    • 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.


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



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


    • 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.