Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Applies to:

The new bar code conversion is included as standard as of SAP Web Application Server 6.40. You can also use the new bar code conversion as of SAP R/3 4.6C, as long as you have imported the relevant Basis Support Package and the corresponding Kernel Patch. For more information about this, see SAP Note 430887 in the SAP Service Marketplace.

Summary

Use any standard printer to print out barcodes using SAP Smartforms

Author(s): Kris Donald & Siddharth Shah

Company: Larsen & Toubro Infotech Ltd, Mumbai

Created on: 10 June 2008

Authors Bio

Kris Donald is a SAP technical consultant working with L&T Infotech, Mumbai, India. He has worked in SAP since September 2006 and his experience spans various technologies such as ABAP, XI, MDM and Web Dynpro for Java and ABAP Siddharth Shah is a SAP technical consultant working with L&T Infotech, Mumbai, India. He has worked in SAP since August 2007 and his experience spans technologies such as ABAP and Web Dynpro for Java

Table of Contents

Applies to:

Summary.

Author Bio.

Introduction.

1. Maintaining the Font(s)

Creating a new font

2. Creating the Style.

3. Creating the Smartform

4. ABAP Program to call the Smartform

Sample program

5. Sample Output

6. Troubleshooting

Consecutive bar-coded rows overlap

Second field shows MATNR in English and not bar-coded

Preview is proper but printing doesn't take place at all

Preview is proper, text is printed properly but barcode (and pictures) are not proper

Related Content

Disclaimer and Liability Notice


Introduction

With traditional bar code printing, the bar codes are generated at the printer and not in the SAP system. Special hardware, such as SIMM modules, is required to do this. If the bar code is to be formatted or controlled with traditional bar code printing, print controls must be changed in the printer commands. In contrast to traditional bar code printing, the new bar code printing does not require any special software, since the bar code is sent to the printer as a graphic. However, the new bar code printing only works with Smart Forms.

1. Maintaining the Font(s)

  • Go to TCODE SE73 and display the system bar codes*,*
  • A default font (such as C128A shown below) can be used or you can create your own font

Creating a new font

  • Make sure you are in change mode for System bar codes
  • Click on the New button on the toolbar and then choose the 'New Bar Code Technology' and give it a name (eg: BC_NAME) and description
  • Different barcode technologies are available. For this example we shall use 'Code 128'
  • Keep the other settings as default and save the font in a transport request (clicking on cancel at the transport request popup will save it locally)

2. Creating the Style

  • Go to transaction SMARTSTYLES or use the 'Style' radio button of transaction SMARTFORMS
  • Create a new Style (eg: ZBARCODE_STYLE)
  • Create a default Paragraph Format by clicking on 'Create Node' from the Context Menu of 'Paragraph Formats' in the left navigation view
  • Create a new Character Format by clicking on 'Create Node' from the Context Menu of 'Character Formats' in the left navigation view (I have given the Character Format the name 'CH' in this example)
  • From the barcode name dropdown list, choose either a system default value such as C128A or the font that we just created (eg: BC_NAME)
  • Save and activate the Style

    3. Creating the Smartform

Here we will create a Smartform to display Material numbers from the MARA table as well as a barcode which contains that same Material number * Go to transaction SMARTFORMS and create a new Smartform (ZBARCODE_MARA in this example)

  • Create the following entry in the Tables tab of the Form Interface of your Smartform
  • Save the Smartform
  • Create a new Table entry on the Main Window as shown below
  • In the Table tab of %TABLE1,Split the Line type %LTYPE1 into two parts
  • In the Data tab, LOOP AT Internal Table IT_MARA INTO IT_MARA
  • Create a Table Line in the header as well as the Main Area of the table
  • Assign Line type %LTYPE1 to both of them
  • Create a Text value in each of these four cells (you can rename them to make it easier to understand) Your left side navigation display should now look something like this
  • Put appropriate headers into the HEADER_MATNR and HEADER_MATNR_CODE text fields
  • Click on the Field list button to display the field list
  • Drag and drop the MATNR field from the IT_MARA table interface into the General Attributes tab of the DATA_MATNR as well as the DATA_MATNR_CODE cells
  • In the Output Options tab of the DATA_MATNR_CODE cell, choose the style that you created earlier (ZBARCODE_STYLE in this example)
  • Go back to the General Attributes tab, select the text &IT_MARA-MATNR& and then change its character style to 'CH'
  • Save and activate the Smartform

4. ABAP Program to call the Smartform

  • Go to transaction SE38
  • Create a simple program to call the Smartform
  • Save, activate and run the program
  • You can choose to preview or print the Smartform

    Sample program

*&---------------------------------------------------------------------*
*& Report  ZBARCODE_CALLER
*&
*&---------------------------------------------------------------------*
*& call smart form
*&
*&---------------------------------------------------------------------*

REPORT  ZBARCODE_CALLER.

TABLES MARA.

DATA FMNAME TYPE RS38L_FNAM.
DATA ZITAB TYPE STANDARD TABLE OF MARA.

SELECT MATNR FROM MARA INTO CORRESPONDING FIELDS OF TABLE ZITAB
  UP TO 15 ROWS.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    FORMNAME = 'ZBARCODE_MARA'
  IMPORTING
    FM_NAME  = FMNAME.

CALL FUNCTION FMNAME
  TABLES
    IT_MARA = ZITAB.

5. Sample Output


6. Troubleshooting

Consecutive bar-coded rows overlap

Create a new paragraph format and set the Line Spacing to 2 Lines

Use this new format in the non bar-coded cells

Second field shows MATNR in English and not bar-coded

Make sure you select the text before changing the character format in the Smartform

Preview is proper but printing doesn't take place at all

Make sure your printer is configured properly in transaction SPAD. Try printing something else from SAP to verify the settings

The device type used in our system is SAPWIN   : Rel.4.x/SAPlpd 4.09+_Also check the _Print Immediately button, else go to transaction SP01 to immediately print all pending print jobs

Preview is proper, text is printed properly but barcode (and pictures) are not proper

Check that your printer is configured properly in Windows with the proper driver that matches your printer's model

Disclaimer and Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

  • No labels

2 Comments

  1. Hi Kris and Siddharth,

    your wiki is interesting, would you mind posting this wiki in "public" area?

    As the wiki is semi-closed now, only editors and moderators may update wikis. I can add it for you if you authorize me.
    It means of course that it then may be enhanced by someone else without warning.
    Moreover, I should remove any comment about authors, bios, etc. (as for any wiki) but I would give you credit (your name + link to this personal wiki) in wiki version information field.

    I am currently creating several wikis for "print" topics. Yours could be added as child of smart forms wiki for example (home page:[Form Printing - SAPscript, Smart Forms, SAP Interactive Forms by Adobe|http://wiki.sdn.sap.com/wiki/display/ABAP/Form+Printing+-+SAPscript%2C+Smart+Forms%2C+SAP+Interactive+Forms+by+Adobe)

    Thanks
    sandra

  2. Hi Kris,

    Do you know how to align the new type barcodes to center? It is not working in, but I rather think it's just another boring Smartforms bug...