A barcode solution consists of the following:
- a barcode printer
- a barcode reader
- a mobile data collection application/program
A barcode label is a special symbology to represent human readable information such as a material number or batch number
in machine readable format.
There are different symbologies for different applications and different industries. Luckily, you need not worry to much about that as the logistics supply chain has mostly standardized on 3 of 9 and 128 barcode symbologies - which all barcode readers support and which SAP support natively in it's printing protocols.
You can print barcodes from SAP by modifying an existing output form.
Behind every output form is a print program that collects all the data and then pass it to the form. The form contains the layout as well as the font, line and paragraph formats. These forms are designed using SAPScript (a very easy but frustratingly simplistic form format language) or SmartForms that is more of a graphical form design tool.
Barcodes are nothing more than a font definition and is part of the style sheet associated with a particular SAPScript form. The most important aspect is to place a parameter in the line of the form that points to the data element that you want to represent as barcode on the form, i.e. material number. Next you need to set the font for that parameter value to one of the supported barcode symbologies.
The next part of the equation can be a bit tricky as you will need to get a printer to print that barcode font. Regular laser printers does not normally print barcode fonts, only specialized industrial printers that is specifically designed to support that protocol and that uses specialized label media and heat transfer (resin) ribbon to create the sharp image required for barcodes.
Not to fear though, there are two ways to get around this:
- You can have your IT department do some research -
most laser printers can accept a font cartridge/dimm chip (similar to computer memory), called a BarDIMM that will allow a laser printer to support the printing of barcodes.
- Secondly, you can buy software that you can upload in your SAP print Server that will convert the barcode symbology as an image that will print on a regular laser printer. I found that this option results in less sharper barcodes. This option is really if you need to convert a large quantity of printers (>10) to support barcodes.
Now you have a barcode printed - what next?
Well there are two options, depending on your business requirements:
- You can use an existing SAP transaction on a regular workstation and get a barcode wedge reader to hook up between the keyboard and the PC. These wedge readers comes in a wand or scanner format. There are even wireless wedge scanners available that allows you to roam a few yards from the workstation to scan a label. This approach is mostly used where you want to prevent human errors in typing in long material, batch or serial numbers in receiving or issuing of material. The problem is that it's just replacing the keyboard input and you are basically locked down in one location and have to bring all the material to that location to process.
- Another solution is to use SAPConsole transactions
or write your own ABAP Dialog programs that will fit onto a barcode enabled wireless handheld terminal and that will follow the business logic as executed on the shop floor.
File - Print to PDF SAP Script
*----------------Database Declaration-----------------------------*
TABLES: LFA1,ADR6.
*-----------------Internal Table Declaration----------------------*
*----------------Work VAriables ----------------------------------*
DATA: S_DOC_CHNG LIKE SODOCCHGI1.
DATA: L_TAB_LINES LIKE SY-TABIX.
DATA: COUNT1 TYPE I.
DATA: COUNT2(4) TYPE N.
DATA: W_ITCPO LIKE ITCPO,W_DIALOG,W_ITCPP LIKE ITCPP.
DATA: W_BIN_FILESIZE(10) TYPE C.
DATA: L_FILENAME LIKE RLGRAP-FILENAME .
DATA: OK_CODE LIKE SY-UCOMM.
DATA: SAV_OK_CODE LIKE SY-UCOMM.
DATA: LINE_COUNT TYPE I.
DATA: FLAG(1) VALUE 'X'.
DATA: WRK_LINES LIKE SY-TABIX.
DATA: WRK_REMNO LIKE ZDUNNING_EMAIL-REMNO.
DATA: T_OTFDATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
DATA: T_ASCII LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: T_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: T_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: T_OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: T_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: T_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: T_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: T_TEXT1 LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: WRK_DAT LIKE SY-DATUM.
CONTROLS: TBCTL_EMAIL TYPE TABLEVIEW USING SCREEN 9000.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'DS'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
DIALOG = W_DIALOG
FORM = 'ZRP_DUNNING1'
LANGUAGE = SY-LANGU
OPTIONS = W_ITCPO
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
RESULT = W_ITCPP
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10.
ENDFORM. " OPEN_SCRIPT
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_IN_TXT_MODE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM DOWNLOAD_IN_TXT_MODE. REFRESH T_PDF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING FORMAT = 'PDF'
MAX_LINEWIDTH = 255
IMPORTING BIN_FILESIZE = W_BIN_FILESIZE
TABLES OTF = T_OTFDATA
LINES = T_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
ENDFORM. " DOWNLOAD_IN_TXT_MODE
*&---------------------------------------------------------------------* *& Form DOWNLOAD_TO_PRES_SERV *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM DOWNLOAD_TO_PRES_SERV.
COUNT2 = IT_REQ1-COUNT.
CONCATENATE 'C:\RFQ_' COUNT2 '.
PDF' INTO L_FILENAME .
CALL FUNCTION 'DOWNLOAD'
EXPORTING BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = L_FILENAME
FILETYPE = 'BIN'
TABLES DATA_TAB = T_PDF
EXCEPTIONS INVALID_FILESIZE = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
CUSTOMER_ERROR = 7
OTHERS = 8.
CLEAR COUNT 2.
ENDFORM. " DOWNLOAD_TO_PRES_SERV
*&---------------------------------------------------------------------* *& Form SEND_MAIL_INSUR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM SEND_MAIL_INSUR. DATA : L_CHRLEN TYPE I, L_FILENAME LIKE RLGRAP-FILENAME , L_LENGTH LIKE T_OBJPACK-DOC_SIZE .
CLEAR : T_OBJPACK,T_OBJTXT,T_OBJBIN,T_OBJHEAD,T_RECLIST,S_DOC_CHNG. REFRESH : T_OBJPACK,T_OBJTXT,T_OBJBIN,T_OBJHEAD,T_RECLIST.
S_DOC_CHNG-OBJ_NAME = 'RFQ Referrals'.
S_DOC_CHNG-OBJ_DESCR = 'RFQ Referrals'.
DESCRIBE TABLE T_OBJTXT LINES L_TAB_LINES.
READ TABLE T_OBJTXT INDEX L_TAB_LINES.
S_DOC_CHNG-DOC_SIZE = ( L_TAB_LINES - 1 ) * 255 + STRLEN( T_OBJTXT ).
CLEAR T_OBJPACK-TRANSF_BIN.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = L_TAB_LINES.
T_OBJPACK-DOC_TYPE = 'RAW'.
APPEND T_OBJPACK.
PERFORM CONVERT_TABLE.
DESCRIBE TABLE T_OBJBIN LINES L_TAB_LINES.
T_OBJHEAD = L_FILENAME.
APPEND T_OBJHEAD.
T_OBJPACK-TRANSF_BIN = 'X'.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 1.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = L_TAB_LINES.
T_OBJPACK-DOC_TYPE = 'PDF'.
T_OBJPACK-OBJ_NAME = 'RFQ REFERRAL'.
T_OBJPACK-OBJ_DESCR = 'RFQ REFERRALS : PDF Format'.
T_OBJPACK-DOC_SIZE = L_TAB_LINES * 255.
W_BIN_FILESIZE = L_TAB_LINES * 255.
MOVE W_BIN_FILESIZE TO L_LENGTH+3(9).
TRANSLATE L_LENGTH USING ' 0'.
T_OBJPACK-DOC_SIZE = L_LENGTH .
APPEND T_OBJPACK.
T_RECLIST-RECEIVER = IT_REQ-EMAIL.
T_RECLIST-REC_TYPE = 'U'.
APPEND T_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = S_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES PACKING_LIST = T_OBJPACK
OBJECT_HEADER = T_OBJHEAD
CONTENTS_BIN = T_OBJBIN
CONTENTS_TXT = T_OBJTXT
RECEIVERS = T_RECLIST
EXCEPTIONS TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC EQ 0.
MESSAGE S501(ZF).
CLEAR IT_REQ2.
REFRESH IT_REQ2.
LOOP AT IT_REQ WHERE SEL = 'X'.
MOVE-CORRESPONDING IT_REQ TO IT_REQ2.
APPEND IT_REQ2.
DELETE IT_REQ WHERE SEL = 'X'.
CLEAR IT_REQ.
ENDLOOP.
FLAG = ' '.
ELSE.
MESSAGE E502(ZF).
ENDIF.
ENDFORM.
" SEND_MAIL_INSUR *&---------------------------------------------------------------------* *& Form CONVERT_TABLE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM CONVERT_TABLE.
DATA: HLTLINES TYPE I.
DATA: FLE1(2) TYPE P.
DATA: FLE2(2) TYPE P.
DATA: HFELD(500) TYPE C.
DATA: OFF1 TYPE P.
DATA: HTABIX LIKE SY-TABIX.
DESCRIBE TABLE T_PDF LINES HLTLINES.
DESCRIBE FIELD T_PDF LENGTH FLE1.
DESCRIBE FIELD T_OBJBIN LENGTH FLE2.
CLEAR T_OBJBIN.
REFRESH T_OBJBIN.
CLEAR OFF1.
CLEAR HFELD.
LOOP AT T_PDF.
HTABIX = SY-TABIX.
MOVE T_PDF TO HFELD+OFF1.
IF HTABIX = HLTLINES.
FLE1 = STRLEN( T_PDF ).
ENDIF. OFF1 = OFF1 + FLE1.
IF OFF1 GE FLE2.
CLEAR T_OBJBIN.
T_OBJBIN = HFELD(FLE2).
APPEND T_OBJBIN.
SHIFT HFELD BY FLE2 PLACES.
OFF1 = OFF1 - FLE2.
ENDIF.
IF HTABIX = HLTLINES.
IF OFF1 GT 0.
CLEAR T_OBJBIN.
T_OBJBIN = HFELD(OFF1).
APPEND T_OBJBIN.
ENDIF.
ENDIF.
ENDLOOP. ENDFORM. " CONVERT_TABLE *&---------------------------------------------------------------------* *& Form OPEN_SCRIPT1 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM OPEN_SCRIPT1.
IF W_ITCPP IS INITIAL.
W_DIALOG = 'X'.
IF SAV_OK_CODE = 'PRNPRV'.
W_ITCPO-TDGETOTF = ' '.
ENDIF.
IF SAV_OK_CODE = 'PDFD' OR SAV_OK_CODE = 'PDFM'.
W_DIALOG = 'X'.
W_ITCPO-TDGETOTF = 'X'.
ENDIF.
ELSE. " if w_itcpp is initial.
CLEAR W_DIALOG.
MOVE-CORRESPONDING W_ITCPP TO W_ITCPO.
ENDIF. " if w_itcpp is initial.
IF SAV_OK_CODE = 'PRNPRV'.
W_DIALOG = 'X'.
ENDIF.
*changed
CALL FUNCTION 'OPEN_FORM'
EXPORTING
* APPLICATION = 'DS'
* DIALOG = W_DIALOG
FORM = 'ZRP_DUNNING1'
LANGUAGE = SY-LANGU
* OPTIONS = W_ITCPO
* IMPORTING
* RESULT = W_ITCPP
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10.
ENDFORM. " OPEN_SCRIPT1
No comments:
Post a Comment