Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Bar One and Zebra (Duplicate label issue)

Former Member
0 Kudos

Hello,

Can anyone tell me how to keep the zebra ZM4 from printing a duplicate label when I run my ABAP to print a bar code label it prints two. Thanks.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Post the sapscript code, and the print program code.

We use the same printers here. We didn't use Barone to generate the sapscript, we directly typed the ZPII code into the sapscript form.

Regards,

Rich Heilman

16 REPLIES 16

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Post the sapscript code, and the print program code.

We use the same printers here. We didn't use Barone to generate the sapscript, we directly typed the ZPII code into the sapscript form.

Regards,

Rich Heilman

0 Kudos

Hi Rich here is the SAP Script code.

/: NEW-PAGE

/ ^XA

/ ^XFZ_BARO-1.ZPL

/ FN999FD&V_DATA-LGORT&^FS

/ FN998FD&V_DATA-LGPBE&^FS

/ FN997FD&V_DATA-MATNR&^FS

/ FN996FD&V_MARA-MAKTX&^FS

/ FN995FD&V_MARA-MFRPN&^FS

/ ^PQ1,0,1,N

/ ^XZ

/ ^FX End of job

Here is the ABAP Code

REPORT ZMMSBARC .

************************************************************************

  • REPORT: ZMMSBARC

  • DATE: 08/27/2004

  • DEVELOPER: Rashid K

  • PROGRAM DESCRIPTION: This Program prints Material master

  • information and barcodes on

  • lables using Barone Software for barcoding.

*

*----


  • MODIFICATION LOG

*----


  • DATE DEVELOPER CORRECTION DESCRIPTION

  • 08/27/2004 Rashid K DEVK907935 Program Creation

*

***********************************************************************

*----


  • TABLES DECLARATIONS

*----


TABLES: MBEW,

MARD,

MARA,

MAKT.

  • VARIABLE DECLARATIONS

DATA: V_MATNR(18) TYPE C.

  • INTERNAL TABLE DECLARATIONS

*Table to hold material inventory data

DATA: BEGIN OF V_DATA,

MATNR LIKE MARD-MATNR,

WERKS LIKE MARD-WERKS,

LGORT LIKE MARD-LGORT,

LGPBE LIKE MARD-LGPBE,

MFRPN LIKE MARA-MFRPN,

MAKTX LIKE MAKT-MAKTX,

END OF V_DATA.

DATA: I_DATA LIKE V_DATA OCCURS 0.

*Table to hold material master information

DATA: BEGIN OF V_MARA,

MATNR LIKE MARA-MATNR,

MFRPN LIKE MARA-MFRPN,

MAKTX LIKE MAKT-MAKTX,

END OF V_MARA.

DATA I_MARA LIKE V_MARA OCCURS 0.

*Selection screen.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-000.

SELECT-OPTIONS: S_MATNR FOR MARD-MATNR MATCHCODE OBJECT MAT1

OBLIGATORY,

S_BIN FOR MARD-LGPBE,

S_WERKS FOR MARD-WERKS OBLIGATORY,

S_LGORT FOR MARD-LGORT OBLIGATORY.

PARAMETERS: P_DELETE AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK 1.

*----


  • EVENT: INITIALIZATION

*----


INITIALIZATION.

  • EVENT: START-OF-SELECTION

*----


START-OF-SELECTION.

*Select data from inventory table, sto loc level

SELECT MATNR

WERKS

LGORT

LGPBE

FROM MARD

INTO TABLE I_DATA

WHERE MATNR IN S_MATNR AND

WERKS IN S_WERKS AND

LGORT IN S_LGORT AND

LGPBE IN S_BIN AND

LVORM = P_DELETE.

DESCRIBE TABLE I_DATA LINES SY-DBCNT.

IF SY-DBCNT = 0.

MESSAGE I001(ZV).

EXIT.

ENDIF.

*select material master data

SELECT MARA~MATNR

MARA~MFRPN

MAKT~MAKTX

INTO TABLE I_MARA

FROM MARA INNER JOIN MAKT ON

MARAMATNR = MAKTMATNR

FOR ALL ENTRIES IN I_DATA

WHERE MARA~MATNR = I_DATA-MATNR.

*----


  • EVENT: END-OF-SELECTION

*----


END-OF-SELECTION.

DATA V_PRINTER LIKE ITCPP.

*open form for writing

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'Z_INV_LABEL'

IMPORTING

RESULT = V_PRINTER

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

MORE_PARAMS_NEEDED_IN_BATCH = 7

INVALID_FAX_NUMBER = 8

OTHERS = 9.

IF NOT V_PRINTER-TDPRINTER CS 'ZLB'.

MESSAGE I000(ZV) WITH 'Printer'

V_PRINTER-TDDEST

'is not a label printer.'

'Choose the correct output device to contiune.'.

EXIT.

ENDIF.

  • Loop at data to write.

LOOP AT I_DATA INTO V_DATA.

  • Get material master information

READ TABLE I_MARA INTO V_MARA WITH KEY

MATNR = V_DATA-MATNR.

CHECK SY-SUBRC = 0. "Ensure material master record exists

*Code to delete leading zeros in material number

IF V_DATA-MATNR(1) CS '0'.

PACK V_DATA-MATNR TO V_MATNR.

ELSE.

MOVE V_DATA-MATNR TO V_MATNR.

ENDIF.

SHIFT V_MATNR LEFT DELETING LEADING SPACE.

WRITE V_MATNR TO V_DATA-MATNR.

*Write to sap script form

CALL FUNCTION 'WRITE_FORM'

EXPORTING

WINDOW = 'MAIN'

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

OTHERS = 8.

ENDLOOP.

*close form from writing

CALL FUNCTION 'CLOSE_FORM'

EXCEPTIONS

OTHERS = 1.

0 Kudos

ok....in the sapscript, can you tell me the Window height of the MAIN window?

Regards,

Rich Heilman

0 Kudos

Set your window height of the main window to 1 LN more than the number of lines in your main window.

Example....

Your sapscript source code has what, 11 lines?

Make the window height of the main window 12 lines.

Regards,

Rich Heilman

0 Kudos

Rich,

Thanks for the suggestion but it did not work for me. Anything else I can try?

0 Kudos

Hmm.....Would have bet money that that would have fixed your problem, what is the window height of you main window.

Regards,

Rich Heilman

0 Kudos

Rich,

The size of the main window does not seem to affect anything. I had it sized very small and the same thing happends, I changed it to over size and the same thing happened. I was told by Bar One that it might be the OS i am working with (XP) Their software was never tested on it. What OS are you work on? I've tried almost everything by now.

0 Kudos

The OS makes no difference. I am use XP professional. The printing is be triggered by SAP using a SAPscript.

Have you tried writing the ZPII code yourself instead of using the BarOne Software. Really not that difficult.

Regards,

Rich Heilman

0 Kudos

Rich,

I am using the software to design the label. I am not sure how I would do it without and send it to the ZEBRA printer. I believe the issue might be on the SAP side but I am not sure. I am on 4.0 and I belive you are on 4.6. I am not sure what eles to try except checking on OSS. Is there a way you can send me you ABAP and ZPII code so that I may try it an see what happens. Let me know if that is not too much trouble.

Thanks again Rich

0 Kudos

Here is the code for the print program....



report zrich_0003.

data: itcpo type itcpo.

data: field1(30) type c,
      field2(30) type c,
      field3(30) type c.

parameters: p_spld type usr01-spld.

start-of-selection.

  itcpo-tddest     = p_spld.
  itcpo-tdimmed    = 'X'.
  itcpo-tddelete   = 'X'.
  itcpo-tdprogram  = sy-repid.

  field1 = 'This is field 1'.
  field2 = 'This is field 2'.
  field3 = 'This is field 3'.


  call function 'OPEN_FORM'
       exporting
            form     = 'ZRICHTEST'
            language = sy-langu
            options  = itcpo
            dialog   = space
       exceptions
            others   = 1.

  call function 'WRITE_FORM'
       exporting
            window = 'MAIN'
       exceptions
            others = 1.

  call function 'CLOSE_FORM'
       exceptions
            others = 1.

Here is the ZPII code which is defined in the main window of the sapscript.



^MNN                                                 
^XA                                                  
^FT100,280^A0N,100,100^FDCST: &FIELD1&^FS            
^FT100,380^A0N,100,100^FDSHP: &FIELD2&^FS            
^FT100,480^A0N,100,100^FDDEL: &FIELD3&^FS            
^XZ                                                  

The main window is defined as follows

Window Width 4.00 IN

Window Height 6.00 LN

This is working good in my system.

Regards,

Rich Heilman

0 Kudos

This is isn't the exact same book that I have, but it will definitly help you in your ZPL II programming.

Regards,

Rich Heilman

0 Kudos

Plus, maybe get rid of that "NEW-PAGE" statement, my printer does not even print the label when that statement is in the sapscript.

Regards,

Rich Heilman

0 Kudos

Hi:

Calling the SAP Script with a element say 'LBL' in the write form and having the code '\E LBL' before your first New-Page in the SAP Script should resolve this issue.Also make sure that you have defined the nextpage for your first page.

Gisk

0 Kudos

Hi,

Your solution of adding a text element in SAP script worked well for me. Thanks a lot.

Regards

Damodhar

Former Member
0 Kudos

Hello -

Two ways to get Duplicate.

If you are using Barone, You can give a command for No. of Labels to be printed.

Other way, before OPEN_FORM fm, Give the Parameter "OPTIONS"

ITCPO-TDCOPIES = 2

Former Member
0 Kudos

Hi Rashid,

I can't locate my ZPL Programming reference but I faced a similar problem and ^PQ command was the reason. Check the syntax of this command or simply try changing this -

from - ^PQ1,0,1,N

to - ^PQ1,0,1,1

Regards,

Sanjeev