Skip to Content

This blog will continue where part Commissioning RFID Tags from SAP, Part I of III left off and it will lay out how to output the EPC code values to an RFID enabled printer from an R/3 system. If you have not read part I yet, I would encourage you to do so as it gives more detailed information on how to compose the data referenced in this blog. Additionally, this is an example from a 4.6C system, although it should work in other versions as well.


What you need


There are three essential components necessary to print on the label and encode the RFID tag directly from R/3. The first, and most necessary, component is the “device” that will do the printing. The example I will cover is how to print to an RFID enabled printer; the specific model we use is the Zebra 110XI. That will become more relevant later as I discuss how to tell the printer set it self up for the specific label/tag, and to tell it what to write onto the tag. In this example, that printer will be set up in transaction SPAD to facilitate the output from the SAPScript form.


The second component you will need is the SAPScript form to actually generate the output to the device. The form is extremely simple, it just requires a MAIN window with the text elements properly set up to print any text you want. The form will also contain the commands the printer will use to program the chip on the tag.

The third component is the ABAP program that will convert the GTIN data into an EPC code and call the SAPScript form to send the data to the printer. A sample program and the accompnying function module is included below to demonstrate how this can be done.


SAPScript form


The SAPScript form itself is extremely easy to define, all you need is a form set up with a MAIN window. The text below is an example layout you could use in the text element of the main window. It is set up to simply write a barcode on the label, with the hex value of the EPC code beneath it, and write the data to the chip on the RFID tag. In order for the sample code to work, the form should be named ‘Z_RFID_CASELABEL’. If you choose a different name, you will need to change the variable G_FORM in the program code to match the form name.

FYI: The script is set up to print a 4×6 label. I used a third-party software tool to generate the script, then I added the commands at the bottom which I describe in more detail below.



Breaking down the SAPScript


Let’s take a closer look at the last two command statements, the ^RS and the ^WT command. The ^RS command will tell the printer to try to print the label three times before initiating an error, as indicated by the ‘3’ after the third comma. The type of error it will dispense is specified by the ‘E’. That value will tell the printer to go into its error mode after the three attempts. To summarize, the printer will go into the error mode after three labels in succession have not been programmed correctly.


To expand more on the command structure, the empty fields (indicated by a comma with no value after it) on the command indicate that it will use the defaults for those positions. The three empty values before the ‘3’ are for the tag type (it will default to ‘4’ for 96-bit), the read/write position of the transponder (defaults to the label length – 1mm), and the length of the void printout (default is label length). All of these values are availiable in the R110XI/R170XI User Guide document available from Zebra. Obviously, you should read the reference guide for whatever device you are using to make sure it is set up correctly to write the EPC data.

The ^WT command tells the printer what data to program on the RFID tag. The value of ‘5’ is for the number of re-tries is will use to print a block of data to the tag. The value of ‘1’ in the fourth position indicate that the data will be sent in hexadecimal, and the ‘n’ tells it not to verify that the value of ‘A5A5′ exists in the first two bytes of data before writing the tag. That is set this way because the current tags were are using are set to ’00’ in that position. Earlier tags were set up that way, and you may or may not find them in existence today. If so, you could use the value of ‘y’ in that position to perform the verification.

The image below shows how the text should look when it is created as the text elements of the MAIN window.



Example program code


The text of the sample print program is below. It will call the function module (code shown in the last text area below) to get the EPC value and output it to the RFID printer you specify on the selection screen. Again, you would need to set that printer up in transaction SPAD in order for this to work correctly.

This is the function module that will convert the fields into the EPC code that will be encoded onto the RFID chip.


The last words


If everything is set up correctly, you should get a label that shows the bar-code on it, the hex value below the bar code, and the chip will be programmed with the value of ‘307400C0E41385C000000001’ if you use the defaults from the program selection screen. Enjoy!

To report this post you need to login first.


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

  1. Naren Someneni

    Thanks for such a great weblog on RFID. By reading your weblogs part I and part II, I now have clear idea over RFID and how AII fits in to R/3 landscape. Thanks a lot and waiting for Part III eagerly.

    Naren Somen

  2. Anonymous
    Dear John,
    I am trying to setup the scenario  you have mentioned by connecting Zebra printer to ERP system.
    Can you please share what are the steps to be done in ERP and printer for printing configuration.
    Also,how can we trace whether the data sent to printer is correct.
    Please let me know if you need further info.
    Thanks and Regards,
  3. sankara rao bhatta
    Hi John,

    I need your expertise in transferring the data from ECC to SAP AII system through XI. We are trying to transfer the materail master, customer master, location and delivery docs from ECC to SAP AII thorugh XI.

    For materail master i figured out the std content available in SAp Xi ( AISMATMAS.MATMAS01) but for reamining things i have no clue. Can you tell me how do i achieve the transfer.



Leave a Reply