You are on page 1of 63

SAP

®

SAP Enterprise POS Fiscal Printer User Exit Technical Reference
Version 1.0

© 2010 SAP AG Dietmar-Hopp-Allee 16 D-69190 Walldorf

Page 1 of 63

SAP

®

Copyright
© Copyright 2010 SAP AG. All rights reserved SAP Library document classification: PUBLIC are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, Clear Enterprise, SAP BusinessObjects Explorer, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP France in the United States and in other countries. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin

© 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010

Page 2 of 63

SAP

®

Icons
Icon Meaning Caution Example Note Recommendation Syntax Tip

History
Version 1.0 Date 11/24/2010 Status (Comments) Initial

© 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010

Page 3 of 63

......................0 D-69190 Walldorf Date: 11/24/2010 Page 4 of 63 .............2 7...... 39 Main Building Blocks and Entities ..............1 5............................................ 14 4 4......................................................5 6..SAP ® Contents 1 1...................................................................2 3..................................... 43 Implementation of the Java BAdI for the Bitmap Printing ..................... 42 Implementation of the Java BAdI for Barcode Printing ................. 5 General Guidelines................................................................................................. 28 Setting The Classpath ....................................................6 Java BAdI Implementation For Fiscal Printer ..............1 4........................................................... 13 IPosPrinterService. 25 Configuring the Client ............ 7 Overview ............................................................3 6..................................................................... 39 Introduction ..................................................................................... 33 LineBuffer .............................. 9 IPosPrinterServiceV2 ........................ 28 Fiscal Printer User Exit Classname .................... 61 Distribution and Deployment ............ 30 Saving the Fiscal Document Number into TLog ..................... 30 Paragraph Class..1 1..................................................... 5 Business Context .................................................................................................................................................................................. 29 ~FISCAL Function ............... 29 6 6................................6 Using The Fiscal Printer ................2 Configuration .................................................................................................................................................................... 31 ReceiptDescriptors .............................. 63 © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.......2 Requirements For Fiscal Printers In Synchronous Mode ............................................................................1 7.............3 3.............................................5 7....................................................... 7 IFiscalPrinterService ...................................1 3....................................... 29 Configurator Settings ................................................................................................ 39 How to implement a BAdI for an Enhancement Spot ...... 25 Error Handling .....................................2 Introduction .4 6..........3 7.......2 6.............................................................................. 27 5 5...........................4 Development Environment Setup ....... 6 2 3 3........................................................................................................................................................................................................... 7 Fiscal Printer User Exit API ................................1 6................. 35 7 7............4 7.....

1 Business Context Fiscal printers are used by retailers in countries where the government performs audits of financial transactions and therefore requires that fiscal information is logged and monitored at each Point-Of-Sale (POS). as applicable). The key advantages of using the Fiscal Printer User Exit are:   Provides options to develop/implement specific fiscal printer requirements outside the CORE code. which you can modify as necessary to create a customized fiscal printer user exit. for a sales transaction with multiple items. Fiscal rules vary depending on country/region. or SAP partner.0 D-69190 Walldorf Date: 11/24/2010 Page 5 of 63 .SAP ® 1 Introduction This document describes the interface that a Java programmer has to develop to establish communication between the SAP Enterprise POS and a fiscal printer to produce fiscal receipts and comply with the regulations of countries where fiscal audits are performed. the fiscal printer must return to the same state it was in before the power loss. but is not be limited to. Fiscal printer integration can be done by SAP. tax table information and number of cancelled receipts. discounts. After a power loss. The totals are stored in fiscal printer memory and are not accessible for modification. This Fiscal Printer User Exit interface described in this guide addressed the following general fiscal printer requirements:   Fiscal receipts must be printed and given to the customer. Upon application restart. discounts/surcharges and cancelled receipts and store these items with a correct date and time stamp. Fiscal printers are equipped with memory to store daily totals. transaction totals.   © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. SAP customer. SAP provides two default Fiscal Printer User Exit implementations. These two types of information may be combined within a single receipt. 1. Fiscal information includes. Each fiscal receipt line item is printed both on the receipt and in the SAP Enterprise POS electronic journal. SAP Enterprise POS uses specialized functions to send commands to fiscal printers for the purposes of printing both fiscal and non-fiscal information. For example. SAP Enterprise POS must ensure that the fiscal printer is in the correct state prior to restarting the printing of a fiscal document. taxation (for multiple taxation levels. Each receipt line item will increment totals such as sales. the printer prints (and stores) the price and tax amount for each item (fiscal information) as well as the store’s return policy (non-fiscal information) on a single receipt.

For more information.0 D-69190 Walldorf Date: 11/24/2010 Page 6 of 63 . Implement the Fiscal Printer User Exit class as described in this guide. see the Setting The Classpath section. 6. 5. see the Configurator Settings section. see the Fiscal Printer User Exit Classname section. Make adjustments for fiscal printers working in synchronous mode. 8. Make changes to the required SAP Enterprise POS Configurator settings.2 General Guidelines To connect a fiscal printer to a cash register running the SAP Enterprise POS application and to print using this printer. see the Technical Product Reference section of the SAP Library documentation under User Exits. For more information. use BAdIs to enable printing of barcodes and bitmaps on the fiscal printer. You can adapt either of these default implementations to your particular requirements.java – default implementation for landscapes equipped with fiscal printers that only support the synchronous mode of operation. For more information. Create documents (using the Document Editor) that use the ~FISCAL() function to print fiscal receipts and reports on the fiscal printer. see the Requirements For Fiscal Printers In Synchronous Mode section. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. 2. 1. Modify the POS Client startup file to include the new Fiscal Printer User Exit. See the Development Environment Setup section for more information. See the ~FISCAL Function section for more information. Optionally. 7. For general information on implementing user exits for SAP Enterprise POS.SAP ® 1.  StandardSyncFiscalPrinterService. see Fiscal Printer User Exit API. Modify the POS Client configuration to include the new Fiscal Printer User Exit. For a list of methods that must be included in the class. 4. See the Java BAdI Implementation For Fiscal Printer section for more information. you need to do the following: Set up your development environment. 3. The SAP Enterprise POS application includes two sample implementations of the Fiscal Printer User Exit:  StandardFiscalPrinterService.java – default implementation. For more information.

1 Overview The Fiscal Printer User Exit API is a collection of classes and interfaces that can be implemented to develop a Fiscal Printer User Exit.jar Description This is the main JAR file that contains all the Fiscal Printer User Exit related classes and the only JAR file that is required for Fiscal Printer User Exit development. te_clientsrvr.deviceservices This package contains the classes and interfaces that are used to implement the Fiscal Printer User Exit.5.SAP ® 2 Development Environment Setup Prior to beginning the implementation of your Fiscal Printer User Exit. Use the sample implementations of the Fiscal Printer User Exit provided with the SAP Enterprise POS application source code as a reference when developing your custom Fiscal Printer User Exit. If you are using any SAP Enterprise POS constants classes. this was Java 1.      FiscalPrinterStatusUpdateEvent IDslFiscalPrinterConst IPosPrinterService IPosPrinterServiceV2 IFiscalPrinterService com. This JAR file contains all POS related files.jar 3 Fiscal Printer User Exit API 3. All others are optional.triversity. At the time of the publishing of this guide.framework.0 D-69190 Walldorf Date: 11/24/2010 Page 7 of 63 .jpos This package contains the standard implementation of the Fiscal Printer User Exit as well as other classes and interfaces used by the user exit.jar tef_logging.jar tef. they are available in this JAR file.     AbstractFiscalPrinterControl16Monitor FiscalPrinterErrorMessage PosFiscalPrinterPendingRequest StandardFiscalPrinterService © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.framework. This JAR file contains all core TEF framework-related classes.transactionware. The development environment can be set up with a reference to the following JAR files: File Name dsl. verify that you are using the most recent version of Java.deviceservices.triversity.transactionware. This JAR file is used for SAP Enterprise POS logging. com.

String) int getJournalWidth() void removeStatusUpdateListener(IStatusUpdateListener) void print(int. int. int) IPosPrinterServiceV2 Operations void print(int.Object>) Object getProperty(String) void reset() boolean isDayOpened() boolean isFiscalReceipt() void printPeriodicTotalsReport(String. List<Paragragh>. int. int) int getJournalWidthDots() int getReceiptWidth() int getReceiptWidthDots() int getSlipWidth() int getSlipWidthDots() boolean getSlpEmpty() boolean isReceiptEmpty() boolean isReceiptNearEnd() void setFlagWhenIdle(boolean) void setAsyncMode(boolean) void deleteTransactionBitmaps() void printBarCode(int. int. ReceiptDescriptors) boolean isCoverOpen() JPOS «interface» OutputCompleteListener IFiscalPrinterService ErrorListener Operations void initialize(Map<String. int) void beginInsertion(int) void setBitmap(int. int. int. String. int) void printStoredBitmap(int. String. int.SAP ® Fiscal Printer User Exit «interface» IPosPrinterService «interface» Operations void addErrorListener(IError Listener) void removeErrorListener(IErrorListener) void addStatusUpdateListener(IStatusUpdateListener) void beginRemoval(int) int checkHealth() void cutPaper(int) void endInsertion() void endRemoval() boolean getCapability(int. int) void printXReport() void printZReport() StatusUpdateListener DirectIOListener StandardFiscalPrinterService JPosFiscalPrinterListener Fiscal Printer User Exit Implementation © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. int. int.0 D-69190 Walldorf Date: 11/24/2010 Page 8 of 63 . String) void printBitmap(int. String) void printPowerLossReport() void printPeriodicTotalsReport(int. String.

INIT_CURRENCY IDslFiscalPrinterConst.INIT_STORE_FISCAL_ID IDslFiscalPrinterConst.2. therefore the methods of both these interfaces must also be implemented even if they do not necessarily relate to the fiscal printer.INIT_TAX_INFO IDslFiscalPrinterConst. The Map parameter can possibly contain the following data: Key IDslFiscalPrinterConst.SAP ® 3. IFiscalPrinterService must be implemented for the POS Client to load the fiscal printer implementation. The fiscal printer is initialized by the data passed by the Map parameter. Preconditions Result Exceptions Parameter Name The fiscal printer is initialized with data from SAP Enterprise POS. The key for header lines will have a prefix of IDslFiscalPrinterConst.2 IFiscalPrinterService This interface is the basis for the Fiscal Printer User Exit.INIT_TENDER_INFO IDslFiscalPrinterConst.INIT_DATE_TIME IDslFiscalPrinterConst. are connected The accumulated tax group rates The tenders configured in SAP Enterprise POS The client ID and cashier ID. Object> Description The SAP Enterprise POS parameter used to initialize the internal settings of the fiscal printer. which are contained in an instance of FiscalPrinterTillAccountability The store information parameters are also possibly contained in the parameters map in order to have access to the header and trailer lines. The trailer lines © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. Fiscal printer initialization is dependent on the particular printer model.0 D-69190 Walldorf Date: 11/24/2010 Page 9 of 63 . and subsequently the fiscal printer.INIT_POS_ID Value The primary currency configured in SAP Enterprise POS The current system time parameters The Store ID to which the register. DeviceServiceException Parameter Type Map<String. IFiscalPrinterService extends IPosPrinterServiceV2 which in turn extends IPosPrinterService. The POS Client can make calls to the following methods of IFiscalPrinterService:           initialize isDayOpened isFiscalReceipt printPeriodicTotalsReport printReport printPowerLossReport printXReport printZReport getProperty reset 3.INIT_HEADER_LINE followed by a number.1 Initialize Method Name Event class/Event Description initialize None Visibility Public Method to initialize the fiscal printer with data from SAP Enterprise POS.

false otherwise. DeviceServiceException Parameter Type String String Description The initial date for the report. The ending date for the report. DeviceServiceException 3. false otherwise. A fiscal day is open when at least one transaction has been completed but the Z-report has not been printed. (Ref: jPOS printPeriodicTotalsReport) Preconditions Result Exceptions Parameter Name aStartDate anEndDate Periodic Totals Report is printed.3 Is Fiscal Receipt Method Name Event class/Event Description isFiscalReceipt None Visibility Public Method to determine whether the current receipt is a fiscal receipt or not.0 D-69190 Walldorf Date: 11/24/2010 Page 10 of 63 . Preconditions Result Exceptions True if the current receipt is a fiscal receipt. 3. Preconditions Result Exceptions True if the fiscal day is open on the printer.4 Print Periodic Totals Report Method Name Event class/Event Description printPeriodicTotalsReport None Visibility Public Method to print the Periodic Totals Report on the fiscal printer.2. The parameters passed to this method are two dates in String format.INIT_TRAILER_LINE followed by a number.2 Is Day Opened Method Name Event class/Event Description isDayOpened None Visibility Public Method to determine whether the fiscal day is open on the fiscal printer.2.SAP ® will have a prefix of IDslFiscalPrinterConst.2. which set the time period for the report. 3. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.

SAP ® 3. String indicating the final transaction record or the ending date.0 D-69190 Walldorf Date: 11/24/2010 Page 11 of 63 . DeviceServiceException Parameter Type int Description The type of report to print: Value IDslFiscalPrinterConst.2. (Ref: jPOS printXReport) Preconditions © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. DeviceServiceException Parameter Type Description 3. (Ref: jPOS printPowerLossReport) Preconditions Result Exceptions Parameter Name The power loss report is printed.7 Print X Report Method Name Event class/Event Description printXReport None Visibility Public Method to print the X report.DSL_FPTR_RT_ORDINAL Description Prints report between two record numbers selected from fiscal memory Prints report between two selected dates IDslFiscalPrinterConst. 3. (Ref: jPOS printRecord) Preconditions Result Exceptions Parameter Name aReportType Selected fiscal report is printed.DSL_FPTR_RT_DATE aStartNum anEndNum String String String indicating the starting transaction record or the initial date.6 Print Power Loss Report Method Name Event class/Event Description printPowerLossReport None Visibility Public Method to print the power loss report.2.5 Print Report Method Name Event class/Event Description printReport None Visibility Public Method to print a fiscal report.2.

2. Preconditions Result Exceptions Parameter Name property An object containing the requested property is returned.2.SAP ® Result Exceptions Parameter Name The X report is printed. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. DeviceServiceException Parameter Type String Description The name of the property to retrieve.9 Get Property Method Name Event class/Event Description getProperty None Visibility Public Method to return the requested property based on the String parameter. DeviceServiceException Parameter Type Description 3.0 D-69190 Walldorf Date: 11/24/2010 Page 12 of 63 . (Ref: jPOS printZReport) Preconditions Result Exceptions Parameter Name The Z report is printed and the fiscal day is closed.8 Print Z Report Method Name Event class/Event Description printZReport None Visibility Public Method to print the Z report. DeviceServiceException Parameter Type Description 3.

May be null.3. The receipt information as a list of Paragraphs. Preconditions Result Exceptions Parameter Name aStationId aReceipt aDescriptor DeviceServiceException Parameter Type int List<Paragraph> ReceiptDescriptors Description The ID for the station to which the printer is connected. Preconditions Result Exceptions Parameter Name All tasks are cleared.1 Print Method Name Event class/Event Description print None Visibility Public Method to print one or more paragraphs of formatted text on the selected printer. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. DeviceServiceException Parameter Type Description 3. if applicable. so implementing classes must take note of this.0 D-69190 Walldorf Date: 11/24/2010 Page 13 of 63 . This interface consists of two methods relating to printing:   print isCoverOpen 3. describes the page layout.SAP ® 3.3 IPosPrinterServiceV2 As IFiscalPrinterService extends IPosPrinterServiceV2. ReceiptDescriptors class details are described in the ReceiptDescriptors section. where each paragraph is a list of LineBuffers. The receipt descriptor which.2.10 Reset Method Name Event class/Event Description reset None Visibility Public Method to reset or clear the fiscal printer and other related tasks. any Fiscal Printer User Exit implementation will must also include the IPosPrinterServiceV2 interface. Paragraph class details are described in the Paragraph Class section.

SAP ® 3. DeviceServiceException Parameter Type Description 3.3. Visibility Public Preconditions Result Exceptions Parameter Name anErrorListener The error listener is passed as a parameter to the list of error listeners.0 D-69190 Walldorf Date: 11/24/2010 Page 14 of 63 .2 Is Cover Open Method Name Event class/Event Description isCoverOpen None Visibility Public Method to determine whether the cover of the printer is open or not. nevertheless. false otherwise.4 IPosPrinterService The interface IPosPrinterServiceV2 extends IPosPrinterService. Note: Although most methods defined in this interface are not used by the fiscal printer.1 Add Error Listener Method Name Event class/Event Description addErrorListener None Method to add an error listener. these methods need to be included in the Fiscal Printer User Exit implementation. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. 3.4. DeviceServiceException Parameter Type IErrorListener Description The error listener to add to the list. (Ref: jPOS isCoverOpen) Preconditions Result Exceptions Parameter Name True if the printer cover is opened. therefore any implementation of the Fiscal Printer User Exit should implement the methods of IPosPrinterService.

Visibility Public Preconditions Result Exceptions Parameter Name statusListener The status update listener is passed as a parameter to the list of status update listeners.4.4 Begin Removal Method Name Event class/Event Description beginRemoval None Visibility Public Method to start the form removal process on the printer. The form removal process is started.3 Begin Insertion Method Name Event class/Event Description beginInsertion None Visibility Public Method to set the printer into insertion mode.4. DeviceServiceException Parameter Type int Description The length of time in milliseconds that the method should be tried before issuing a timeout. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.4.0 D-69190 Walldorf Date: 11/24/2010 Page 15 of 63 . Preconditions Result Exceptions Parameter Name aTimeout The printer mode is set to insertion. 3. 3. DeviceServiceException Parameter Type IStatusUpdateListener Description The status update listener to be added to the list.2 Add Status Update Listener Method Name Event class/Event Description addStatusUpdateListener None Method to add a status update listener. (Ref: jPOS beginRemoval) Preconditions Result Exceptions Parameter Name aTimeout Parameter Type int Description The length of time in milliseconds that the method should be tried before issuing a timeout. (Ref: jPOS beginInsertion).SAP ® 3.

otherwise a success code is returned.7 Delete Transaction Bitmaps Method Name Event class/Event Description deleteTransactionBitmaps None Visibility Public Method to delete all stored transaction bitmaps. Preconditions Result Exceptions Parameter Name stationId Parameter Type int Description The ID for the station to which the printer is connected. (Ref: jPOS checkHealth) Preconditions Result Exceptions Parameter Name Parameter Type Description If a problem is found.5 Check Health Method Name Event class/Event Description checkHealth None Visibility Public Method to check the health of the printer.6 Cut Paper Method Name Event class/Event Description cutPaper None Visibility Public Method to issue the command to cut the paper in the receipt printer. Not applicable for fiscal printer as cutting of receipts is done implicitly through other commands. Preconditions Result Exceptions Parameter Name Parameter Type Description © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.SAP ® 3.4. 3. the appropriate error code is returned. Not applicable for fiscal printer.4. 3.4.0 D-69190 Walldorf Date: 11/24/2010 Page 16 of 63 .

4.9 End Removal Method Name Event class/Event Description endRemoval None Visibility Public Method to take the printer out of form removal mode.10 Get Capability Method Name Event class/Event Description getCapability None Visibility Public Method to retrieve whether the selected printer has the requested capability. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.8 End Insertion Method Name Event class/Event Description endInsertion None Visibility Public Method to take the printer out of form insertion mode. Preconditions Result Exceptions Parameter Name aStationId aCapabilityId Parameter Type Int String Description The ID for the station to which the printer is connected.4. (Ref: jPOS endRemoval) Preconditions Result Exceptions Parameter Name The printer exits form removal mode. True if the printer has the requested capability.SAP ® 3. (Ref: jPOS endInsertion) Preconditions Result Exceptions Parameter Name The printer exits form insertion mode.4. DeviceServiceException Parameter Type Description 3.0 D-69190 Walldorf Date: 11/24/2010 Page 17 of 63 . false otherwise. The ID of the capability to verify. DeviceServiceException Parameter Type Description 3.

Preconditions Result Exceptions Parameter Name The maximum width of a receipt line is returned.0 D-69190 Walldorf Date: 11/24/2010 Page 18 of 63 . Preconditions Result Exceptions Parameter Name DeviceServiceException Parameter Type Description 3.4.11 Get Journal Width Method Name Event class/Event Description getJournalWidth None Visibility Public Method to retrieve the defined journal width. Preconditions Result Exceptions Parameter Name DeviceServiceException Parameter Type Description 3.4.12 Get Journal Width Dots Method Name Event class/Event Description getJournalWidthDots None Visibility Public Method to retrieve the defined journal dot width.4.SAP ® 3.13 Get Receipt Width Method Name Event class/Event Description getReceiptWidth None Visibility Public Method to retrieve the maximum possible width for a line on a receipt. DeviceServiceException Parameter Type Description © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. Not applicable for fiscal printer. Not applicable for fiscal printer.

Preconditions Result Exceptions Parameter Name DeviceServiceException Parameter Type Description 3.4.4. Not applicable for fiscal printer.4. Not applicable for fiscal printer. Preconditions Result Exceptions Parameter Name DeviceServiceException Parameter Type Description © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. Not applicable for fiscal printer.0 D-69190 Walldorf Date: 11/24/2010 Page 19 of 63 .15 Get Slip Width Method Name Event class/Event Description getSlipWidth None Visibility Public Method to return the slip receipt width.SAP ® 3.14 Get Receipt Width Dots Method Name Event class/Event Description getReceiptWidthDots None Visibility Public Method to return receipt dot width. Preconditions Result Exceptions Parameter Name DeviceServiceException Parameter Type Description 3.16 Get Slip Width Dots Method Name Event class/Event Description getSlipWidthDots None Visibility Public Method to return the slip receipt dot width.

19 Is Receipt Near End Method Name Event class/Event Description isReceiptNearEnd None Visibility Public Method to determine whether the receipt printer is nearly out of paper.18 Is Receipt Empty Method Name Event class/Event Description getReceiptEmpty None Visibility Public Method to return whether the receipt printer is out of paper.4. false otherwise.4.0 D-69190 Walldorf Date: 11/24/2010 Page 20 of 63 . Preconditions Result Exceptions Parameter Name Parameter Type Description True if the receipt printer is empty. 3. DeviceServiceException Parameter Type Description 3.4. Preconditions Result Exceptions Parameter Name Parameter Type Description True if the receipt is nearly out of paper.17 Get Slip Empty Method Name Event class/Event Description getSlpEmpty None Visibility Public Method to return whether the slip printer is out of paper. Preconditions Result Exceptions Parameter Name True if the slip printer is empty. false otherwise. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. Not applicable for fiscal printer. false otherwise.SAP ® 3.

0 D-69190 Walldorf Date: 11/24/2010 Page 21 of 63 . Set this parameter to one of the DSL_PTR_S_xxx found in IDslPosPrinterConst. If the string contains multiple lines. 3. Height of barcode. Width of barcode.4. The index of the entry in the ConfigPOSConstants. Preconditions Result Exceptions Parameter Name aStationId aData aSymbology aHeight aWidth anAlignment aTextPosition The barcode is printed. The specified strings are printed on the selected printer. DeviceServiceException Parameter Type int String int int int int int Description Identifies the print station or stations (one of IDeviceSet. Sets the lines of text to be printed.4. Alignment of the barcode. this method is used with standard receipt printers.21 Print Bar Code Method Name Event class/Event Description printBarCode None Visibility Public Method to print the barcode on the receipt as per the specified parameters. DEVICE_SLIP. each line should be terminated with a combination of a carriage return and a line feed character. Preconditions Result Exceptions Parameter Name aStationId aStringToPrint Parameter Type int String Description Identifies the print station or stations where the text is to be printed. DEVICE_JOURNAL). © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.20 Print Method Name Event class/Event Description print None Visibility Public Method to print one or more lines of formatted text on one or more print stations. Text position of the barcode. The actual barcode data. Typically.DEVICE_RECEIPT. you would not use this method with a fiscal printer.symbologies table.SAP ® 3.

Preconditions Result Exceptions Parameter Name aStationId aFileName aWidth anAlignment The bitmap is printed. DEVICE_JOURNAL) Index of the stored bitmap.4. DeviceServiceException Parameter Type int String int int Description Identifies the print station or stations DEVICE_SLIP. Preconditions Result Exceptions Parameter Name aStationId aStoredBitmap DeviceServiceException Parameter Type int int Description Identifies the print station or stations DEVICE_SLIP. Alignment of the bitmap. (one of IDeviceSet. Not applicable for fiscal printer.0 D-69190 Walldorf Date: 11/24/2010 Page 22 of 63 . 3.DEVICE_RECEIPT.DEVICE_RECEIPT.4. (one of IDeviceSet. DEVICE_JOURNAL) Filename of the bitmap to be printed. The width of the bitmap. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.22 Print Bitmap Method Name Event class/Event Description printBitmap None Visibility Public Method to print the bitmap as per the specified parameters.23 Print Stored Bitmap Method Name Event class/Event Description printStoredBitmap None Visibility Public Method to print a stored bitmap.SAP ® 3.

DeviceServiceException Parameter Type boolean Description Set flag to true to operate the printer in asynchronous mode.24 Remove Error Listener Method Name Event class/Event Description removeErrorListener None Method to remove an error listener. 3. Visibility Public Preconditions Result Exceptions Parameter Name anErrorListener Parameter Type IErrorListener Description The error listener to remove from the list.26 Set Async Mode Method Name Event class/Event Description setAsyncMode None Visibility Public Method to set the printer in asynchronous mode of operation. or false to operate in synchronous mode.4. Visibility Public Preconditions Result Exceptions Parameter Name aStatusListener Parameter Type IStatusUpdateListener Description The status update listener to remove from the list. The specified error listener is removed from the list of Error Listeners. The specified status update listener is removed from the list of Status Update Listeners.SAP ® 3.4.0 D-69190 Walldorf Date: 11/24/2010 Page 23 of 63 . © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. Preconditions Result Exceptions Parameter Name aFlag The printer is set to the selected mode of operation.4. 3.25 Remove Status Update Listener Method Name Event class/Event Description removeStatusUpdateListener None Method to remove a status update listener.

Preconditions Result Exceptions Parameter Name aBitmapNumber aStationId aFileName aWidth anAlignment DeviceServiceException Parameter Type int int String int int Description The index of the stored bitmap.SAP ® 3. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.4.28 Set Flag When Idle Method Name Event class/Event Description setFlagWhenIdle None Visibility Public Method to set flag when idle. Alignment of the bitmap. Not applicable for fiscal printer. The ID for the station to which the printer is connected. Filename of the bitmap.0 D-69190 Walldorf Date: 11/24/2010 Page 24 of 63 .27 Set Bitmap Method Name Event class/Event Description setBitmap None Visibility Public Method to configure a bitmap. relevant for slip printing. Not applicable for fiscal printer.4. 3. Preconditions Result Exceptions Parameter Name flag DeviceServiceException Parameter Type boolean Description True or false. Width of the bitmap.

0 D-69190 Walldorf Date: 11/24/2010 .triversity.1 Configuring the Client The SAP Enterprise POS SP06. To support communication with fiscal printers that only operate in synchronous mode.properties file and only need to be set if you are connecting a fiscal printer that only supports the synchronous mode of communication.transacti onware. the SAP Enterprise POS communication capabilities have been enhanced. Specifies the user exit service class that will be used by SAP Enterprise POS to communicate to the fiscal printer. whether a fiscal printer can operate in asynchronous. is configurable so that fiscal printers operating in either the asynchronous or the synchronous mode are supported. rExit=com. Both properties are commented out in the device.properties file. two new properties have been introduced to the device. Property FiscalPrinter1. By default. deviceservices.asyncMode Description Specifies whether the fiscal printer connected to the particular POS Client can communicate in asynchronous mode.framework. The StandardSyncFiscalPrinterService class provided by SAP is the default synchronous implementation of IFiscalPrinterService. However. To achieve this. which includes the new fiscal printer support.jpos. synchronous or both modes depends on the capabilities of a particular printer.SAP ® 4 Requirements For Fiscal Printers In Synchronous Mode The JavaPOS interface allows devices to communicate with applications in two modes: asynchronous and synchronous. This class will be referred to as the default or standard implementation in this section. Settings   true false (default) FiscalPrinterUserExit Name of the class. The following diagram is a high level representation of the enhancements to support both modes of communication between SAP Enterprise POS and the fiscal printer: ePOS Standard Code User Exit Default Async Implmentation of IFiscalPrinterService Default Sync Implmentation of IFiscalPrinterService JavaPOS/ UPOS JavaPOS JavaPOS Device Custom Async Implmentation of IFiscalPrinterService Fiscal Printer (Sync/Async) Custom Sync Implmentation of IFiscalPrinterService 4. Page 25 of 63 © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. SAP Enterprise POS was originally designed to support asynchronous communication with connected devices.

The FiscalPrinter1.0 D-69190 Walldorf Date: 11/24/2010 Page 26 of 63 .properties Service Class = Default Service Class In summary. Use the standard default implementation.SAP ® StandardSyncFiscalPrinterService In SAP Enterprise POS.properties.properties Yes No Class Exists? No Yes Service Class = value in FiscalPrinterUserExit in device.properties false Default Service Class: StandardSyncFiscalPrinterService.properties file to activate the custom implementation. Make the necessary changes in the device. StandardSyncFiscalPrinterService.java true Value of FiscalPrinter1.asyncMode and the FiscalPrinterUserExit settings are used by SAP Enterprise POS to determine the user exit implementation class as follows: Determine Fiscal Printer Service Class Default Service Class: StandardFiscalPrinterService. 2. Therefore. the PrintManager must determine the printer’s mode of operation by checking the configuration in device. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. the printer mode setting (synchronous or asynchronous) found in PrintManager is not modifiable through a user exit.asyncMode in devices.java FiscalPrinterUserExit defined in devices. to implement a Fiscal Printer User Exit for fiscal printers that only operate in synchronous mode: 1. prior to sending the print call to the implementation of IFiscalPrinterService. as a reference to create a custom implementation.

With the standard implementation provided by SAP in StandardSyncFiscalPrinterService. Error handling is specific to each particular fiscal printer model. printer out of paper) ePOS event is: IDslConst. error handling had to be enhanced to support the synchronous printing mode. some fiscal printers are able to recuperate from errors without application intervention to rectify the issue.e. all fiscal commands are sent in synchronous manner. Other fiscal printers may require the application to intervene.2 Error Handling For fiscal printers that operate in synchronous mode. no subsequent commands are sent down to the printer once an error event is produced by the device.0 D-69190 Walldorf Date: 11/24/2010 Page 27 of 63 .SAP ® 4. the Fiscal Printer User Exit determines the state in which the client should be upon the receipt of an error issued by a connected device. With the introduction of the synchronous printing mode for fiscal printers. common error events.DSL_FISCAL _ABORT_TRX End of Document Printing © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. such as printer lid open or printer out of paper. The following diagram summarizes the flow: Start Printing of Document Yes More Lines available to print? Execute Next available line No Error Event? Yes Map Error Event to ePOS event Invalid fiscal command. do not get sent to the implementation until a fiscal command is sent to the printer. This could include the canceling of the current document being printed and placing the printer in a monitoring state. which dictates that the error events are sent back to the user exit implementation immediately after each fiscal command is executed.DSL_FISCAL _PROMPT_FOR_REP RINT Yes No Reprint can be prompted for Notify FiscalPrinter Listener of error event ePOS event is: IDslConst. Critical error. which results in a reset of the printer and the actual cancelling of the transaction. As the registering of listeners to the fiscal printer is only needed for asynchronous communications. cancelled printout Operational issue (i. As a result. For instance.

saptrv. starting with one (1).triversity. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.properties file is located in the EPOS_HOME/custom/client/ folder.transactionware. The device.triversity device.framework.framework.controls. two specific error scenarios have been determined for the Hungarian fiscal printer:  An incorrect configuration of documents or master data.te.3=com.eftuserexit FiscalPrinterUserExit1=com.triversity.SAP ® Currently.FPDevice class should be replaced with the fully qualified class name of the Fiscal Printer User Exit implementation class. The SAP Enterprise POS application displays a notification message of a cancelled transaction and aborts the transaction appropriately.DSL_FISCAL_ABORT_TRX event in SAP Enterprise POS. Example: device.userexit. The fiscal printer re-attempts to print the document.transactionware.fiscalprinter.deviceservices.ingenico device.userexit.properties file to the fully qualified class name of the Fiscal Printer User Exit implementation class.deviceservices.1 Fiscal Printer User Exit Classname To use your Fiscal Printer User Exit you must set the FiscalPrinterUserExit property in the device.fiscalprinter.2=com. This is mapped to an IDslConst. for each identified fiscal printer error. com.deviceservices. This is mapped to an IDslConstant. Consequently. The FiscalPrinterUserExit property name is suffixed with a number.transactionware. which cannot be resolved by the user exit.controls.triversity.saptrv.DSL_FICAL_PROMPT_FOR_REPRINT event in SAP Enterprise POS. 5 Configuration 5.framework.FPDevice In the above example.0 D-69190 Walldorf Date: 11/24/2010 Page 28 of 63 . it must be determined if the error falls into one the two SAP Enterprise POS ErrorEvents or if a new ErrorEvent needs to be created/requested. An ErrorEvent issued by the fiscal printer due to an operational issue. The fiscal printer automatically cancels the document and sets the printer in a monitoring state. Incrementing this number allows you to load multiple Fiscal Printer User Exits in the POS Clients.te.controls.  Note: As all fiscal printer errors are mapped/generalized in the user exit to one of the two SAP Enterprise POS ErrorEvents listed above. which can be corrected by the operator.1=com. other ErrorEvents may need to be introduced.

jar CP=%CP%.\lib\loaderutil..jar CP=%CP%. The example below highlights where the FiscPrinter.. they are supplied by the fiscal printer provider..1 Configurator Settings Once the SAP Enterprise POS application.jar CP=%CP%. For more information on SAP Enterprise POS Configurator settings.\lib\FiscPrinter.jar CP=%CP%.\lib\dsl.\lib\editor.  Tenders: Some fiscal printers have predefined indices for the different types of tenders.. 6 Using The Fiscal Printer 6.\security CP=%CP%.\lib\ext\jpos17.jar CP=%CP%.sh must be updated to include the location of the Fiscal Printer User Exit implementation JAR file in the POS Client classpath.\lib\tw-security.jar file.\lib\tef.cmd and startpos.jar file provides an implementation of Fiscal Printer User Exit. which includes your Fiscal Printer User Exit.SAP ® 5.jar CP=%CP%. When such indices exist.jar CP=%CP%.2 Setting The Classpath The startpos.jar CP=%CP%.jar CP=%CP%. refer to the SAP Enterprise POS Application Help.\lib\tef_logging.\lib\te_clientsrvr. has been installed..jar CP=%CP%...\lib\dsllocal.\lib\was-stubs...\lib\ext\j2ee..jar CP=%CP%.\lib\ext\ib6core.jar CP=%CP%..jar CP=%CP%. If the fiscal printer being used has these indices.. adjust the following SAP Enterprise POS Configurator settings:  Tax Group: Select the Send Tax Data to Fiscal Printer checkbox for each tax group whose accumulated tax rates should be used on the fiscal printer..0 D-69190 Walldorf Date: 11/24/2010 Page 29 of 63 . The FiscPrinter. and should be entered in the Fiscal Predefined Payment Index text box..\lib\client-updates.. they should be entered in the Tenders configuration.jar Ensure that all of the classes required for your implementation are present in the classpath by either adding a JAR file name or a fully qualified directory name containing all of your required classes to the POS Client classpath.\lib\EFTUserExit.jar CP=%CP%. The default sample implementation of the user exit (StandardFiscalPrinterService) is included in the dsllocal.\lib\client... : REM SET SET SET SET SET SET SET SET SET SET SET SET SET SET SET SET SET : Add Triversity Jars to classpath CP=%CP%.jar CP=%CP%.jar file is added to the POS Client path. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.

6. the five parameters used by the printRecItem jPOS method should be used as the last five parameters of the ~FISCAL() function. param1. In your implementation of the Fiscal Printer User Exit. The rest of the parameters of the ~FISCAL() function are the parameters used by the selected jPOS method.DSL_SUE_SEND_QUEUE_EMPTY. get the fiscal document number. %quantity%.  Implement the return scenario. ~value(%price%).0 D-69190 Walldorf Date: 11/24/2010 Page 30 of 63 . Allow the return to proceed if the document numbers match.%department%) ~FISCAL(printRecItem. prompt the register operator for the fiscal document number. In the default StandardFiscalPrinterService implementation. ~value(%unitprice%). param2.recycle(IdslConst. For example. …. paramN). if printRecItem is used as the first parameter in the ~FISCAL() function. o Check that the entered fiscal document number matches the one stored in the retrieved transaction. printRecItem. The way to obtain the fiscal document number varies depending on your particular fiscal printer model and implementation of JavaPOS. You can then use the document number during the return scenario. o When the fiscal receipt is generated. o During a return. ~FISCAL(setPostLine. %taxcode%. The most common use of the fiscal function is to send and execute jPOS commands on the fiscal printer. %description%. The example below illustrates this communication: Synchronized (statusUpdateListeners) { Object[] info = new Object[2].3. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. printerStatusUpdateEvent. %unitOfMeasure%) 6. o Put the fiscal document number into the TLog.2 ~FISCAL Function A new function has been introduced into the Document language: ~FISCAL(command. => info[1] = getFiscalDocumentNumber(anEvent).1 Saving the Fiscal Document Number The fiscal document number can be retrieved from the class used to implement the IFiscalPrinterService interface. This function allows commands to be sent to the fiscal printer and it can be used anywhere throughout the SAP Enterprise POS documents. Using the fiscal commands requires additional implementation in the Fiscal Printer User Exit. for example. info). the retrieval of the fiscal document number is simulated by calling the getFiscalDocumentNumber() method of the outputCompleteOccurred() method of the JposFiscalPrinterListener private class.3 Saving the Fiscal Document Number into TLog It is possible to fetch the fiscal document number generated by the fiscal printer and store it in the TLog. The first parameter of the ~FISCAL() function is the jPOS method name.SAP ® 6.DSL_SUE_SEND_QUEUE_EMPTY). ||%code% . the fiscal document number is communicated to the FiscalPrinterListener via a statusUpdateEvent(IdslConst. The object array that is sent with the status update event is used for this purpose. The functionality can be broken down as follows:  Fetch and store the fiscal document number.

the application ensures that the recalled transaction has a matching fiscal document number. List<LineBuffer>) void add(LineBuffer) void addAll(Paragraph) void clear() List<LineBuffer> getLines() String getName() int size() © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.3.4 Paragraph Class The Paragraph class is used to wrap the lines of the configuration documents. the register operator enters the fiscal document number. the journal object is sent to the server. A paragraph contains a list of line buffers for each line of the document to be processed. FISCAL_DOC_ID. SAP Enterprise POS application uses the transaction number to recall the transaction in the PriorTransactionSRQ. This also propagates the fiscal document number and saves it in the TLog. as a piece of required data.  The register operator enters the transaction number.  On invocation.2 Return Scenario During a return. In turn. It must be used in the Fiscal Printer User Exit implementation of the Print method.0 D-69190 Walldorf Date: 11/24/2010 Page 31 of 63 .getName(). } } SAP Enterprise POS application then uses the FiscalPrinterListener class to access the current electronic journal of the POS Client and stores the fiscal document number in that object. statusUpdateOccurred(printerStatusUpdateEvent). nListener++) { statusUpdateListeners. FISCAL_DOC_ID. Once the register operator enters the number (which they obtain from the printed receipt). update the data form to include the new IDataType. 6. The POS Client configuration required for the return scenario is:  Create a new IDataType: FISCAL_DOC_ID.SAP ® // deliver the event to all registered listeners int statusUpdateListenersSize = statusUpdateListeners. nListener < statusUpdateListenersSize. journal. the POS Client can prompt the register operator for the fiscal document number. the application attempts to match it to the fiscal document number saved when the transaction was recorded before allowing the return. Paragraph String formName List<LineBuffer> paragraph Paragraph() Paragraph(List<LineBuffer>) Paragraph(String) Paragraph(String.get(nListener). for (int nListener = 0. 6.getFiscalDocId()) in the supplemental data property to store the fiscal document number.size(). If the request data includes the FISCAL_DOC_ID value. the JournalACO has a new property (TlogProperty.  In the UDF that executes the ‘return with receipt’ functionality.

endingEvent = IDslFiscalPrinterConst. } break.getText(). } else if (lb.getText().getText().getText().FISCAL) { if (lb.equals("printReport")) { isFiscalReceipt = true.get(0).getText(). } else if (lb.equals("printXReport") || lb.equals("printPowerLossReport") || lb.getText(). The code loops through all the LineBuffers contained in the paragraph and determines the type of line that should be printed. Paragraph firstForm = receipt. isFiscalReceipt = true.getText().getType() == LineBuffer.equals("printZReport") || lb.SAP ® The following example from the StandardSyncFiscalPrinterService implementation illustrates the usage of the Paragraph class.equals("beginTraining") || lb.getText().0 D-69190 Walldorf Date: 11/24/2010 Page 32 of 63 .DSL_FPTR_SUE_IDLE.equals("printPeriodicTotalsReport") || lb.DSL_FPTR_SUE_IDLE.startsWith("beginFiscal") || lb.equals("endTraining")) { // Need to generate IDLE event at the end because beginTraining/ // endTraining triggers receipt printing but without output complete // event. for (LineBuffer lb: firstForm. } } © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.startsWith("setFiscalReceiptType")){ // New fiscal receipt isFiscalReceipt = true.getText(). endingEvent = IDslFiscalPrinterConst.getLines()) { if (lb.

5 ReceiptDescriptors The ReceiptDescriptors class is used to contain the receipt formatting information.0 D-69190 Walldorf Date: 11/24/2010 Page 33 of 63 . and whether or not the receipt contains sensitive data. It can include receipt margins. ReceiptDescriptors int topMargin int leftMargin int linesPerPage boolean noPaperCut boolean sensitiveData ReceiptDescriptors() int getLeftMargin() int getLeftMargin() int getTopMargin() boolean isNoPaperCut() boolean isSensitiveData() void setLeftMargin(int) void setLinesPerPage(int) void setNoPaperCut(boolean) void setSensitiveData(boolean) void setTopMargin(int) String toString() © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. It must be used in the Fiscal Printer User Exit implementation of the Print method.SAP ® 6. lines per page. whether or not there should be a paper cut.

adjustAlignments(line. descriptor. The DocumentUtil method adjusts the alignments of the receipt to be printed. . normalText. receiptWidth). DocumentUtil. line. substitutionsPrinter).append(line. DocumentUtil. case LineBuffer.replaceAttributes(line.append("\n"). so ignore this. In this example. ..append(lb.getText()).getLeftMargin().SAP ® The following example from the StandardSyncFiscalPrinterService implementation illustrates the usage of the ReceiptDescriptors class. receiptWidth). .0 D-69190 Walldorf Date: 11/24/2010 Page 34 of 63 . . © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. continue.toString()).setLength(0).. DocumentUtil. } line. the value returned by the getLeftMargin method is passed as a parameter to the adjustAlignments method of the DocumentUtil method. ReceiptDescriptors descriptor = aDescriptor..TEXT: if (isFiscalReceipt) { // we have fiscal lines.expandCaretCharacter(line..

The following line types are permitted:  TEXT  BARCODE  BITMAP  MARKER  REMOTE_FORM  IMAGE  PAUSE  REPEAT  TEXTAT  FISCAL All lines sent to the fiscal printer should be of type FISCAL. A List of LineBuffers is an attribute of the Paragraph class that stores all the lines to be printed. which sets the type of line to send to the printer. One of the attributes of LineBuffer is Type. The line is based on the line definitions in the Configuration documents.6 LineBuffer The LineBuffer class is used to send a line to the printer. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.SAP ® 6.0 D-69190 Walldorf Date: 11/24/2010 Page 35 of 63 .

Object)>) setWidth(double) toString() toXML(() writeExternal(ObjectOutput) getAlignment() © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.SAP ® LineBuffer Attributes ABOVE AS_IS_WIDTH BARCODE BELOW BITMAP CENTER FISCAL IMAGE LEFT MARKER NO_ATTRIBUTE_SUBSTITUTION NONE PAUSE POSITION_TAG REMOTE_FORM REPEAT RIGHT ALIGNMENT_TAG TEXT TEXTAT TYPE_TAG_TEXT SERIAL_VERSION serialVersionUID STORE TEMPORARY alignment height multiUseVar1 multiUseVar2 multiUseVar3 multiUseVar4 parameters text type variables Operations decrementRepeatCount() getColumnt() getFormat() getHeight() getParameters() getPause() getRepeatCount() getRepeatOutputForm() getRow() getSymbology() getText() getTextPosition() getType() getVariables() getWidth() isNoAttributeSubstitution() isStoredOnly() isTemporary() readExternal(ObjectInput) setAlignment(int) setColumn(int) setFormat(String) setHeight(double) setNoAttributeSubstitution(boolean) setParameters(String[]) setPause(double) setRepeatCount(int) setPause(double) setRepeatOutputFrom(int) setRow(int) setStore(string) setSymbology(int) setText(String) setTextPosition(int) setType(int) setVariables(Map<String.0 D-69190 Walldorf Date: 11/24/2010 Page 36 of 63 .

getText(). The code loops through all the LineBuffers contained in the paragraph and determines how the lines should be processed. } } break.0 . i++) { toParams.0).getText().TEXT: if (isFiscalReceipt) { // we have fiscal lines. } © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. if (!executed) { errorOccurred = true. } break. String[] fromParams = lb. for (LineBuffer lb: form.getType()) { case LineBuffer.length. getSymbology(lb. if (fromParams != null && fromParams. break.getSymbology()). case LineBuffer. } else { printBarCode(aStationId.0 D-69190 Walldorf Date: 11/24/2010 Page 37 of 63 . 0 . i < fromParams.getParameters(). } } boolean executed = executeFiscalFunction(lb. continue. lb.length > 0) { for (int i = 0.BARCODE: if (!isFiscalReceipt) { // Non-fiscal receipt: Delay barcode printing to the end endRequestList. toParams).SAP ® The following example from the StandardSyncFiscalPrinterService implementation illustrates the usage of the LineBuffer class. case LineBuffer.FISCAL: if (isFiscalReceipt) { List<String> toParams = new ArrayList<String>(). so ignore this.add(lb).add(fromParams[i]).getLines()) { switch (lb.

SAP ® line. receiptWidth).0 D-69190 Walldorf Date: 11/24/2010 Page 38 of 63 .\ normalText.setLength(0).append("\n").append(lb.getLeftMargin().replaceAttributes(line. line.adjustAlignments(line.getType()) { } // for (LineBuffer lb: form) { © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.append(line. DocumentUtil. substitutionsPrinter). } // switch (lb. DocumentUtil. receiptWidth). DocumentUtil.getText()).toString()).expandCaretCharacter(line. descriptor.

7. to decorate or to extend existing SAP functionality with customer enhancements without modifying the original source code. which are executed at runtime. Java Enhancement Spots and Java BAdIs allow modification-free enhancements of the SAP Enterprise POS core application.2. There are two types of Enhancement Spots:  Enhancement Spots that allow a single implementation.SAP ® 7 Java BAdI Implementation For Fiscal Printer 7. BAdIs are customer implementations for the Enhancement Spots. 1 The Enhancement Concept for SAP Enterprise POS is not a one-to-one re-implementation of the ABAP BAdI concept.2 Main Building Blocks and Entities 7. can then provide implementations for the developed Enhancement Spots.2. which exceptions may be thrown at runtime. so that the EHC Framework will execute the custom implementation at runtime. The type of the input parameter. which belongs to the SAP Enterprise POS core application. that is. Enhancement Spots are defined and provided by SAP development within the SAP applications. 7. the BAdI. 1 7. The BAdI interface defines the following:    The execute method.2. altered or decorated. where existing (business) functionality can be enriched. The implementation of a BAdI interface is referred to as a (Java) BAdI interface implementation.3 BAdI Interfaces SAP core development provides a default Java interface for each Enhancement Spot. Additionally. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. The Enhancement Concept (EHC) for SAP Enterprise POS realizes a similar concept.  Enhancement Spots that allow multiple implementations. Non-SAP development. where multiple BAdI implementations may be provided for the Enhancement Spot. The type of the output parameter. which must be implemented and which is invoked by the EHC Framework at runtime. developers must configure the Enhancement Spot. for example customers or SAP Custom Development Projects (CDP).1 Enhancement Concept Framework The EHC Framework is embedded in the SAP Enterprise POS core application and allows SAP development to define and provide Enhancement Spots within the SAP Enterprise POS core application.1 Introduction Enhancement Spots and BAdIs (Business Add-Ins) are well-known and proven concepts in the ABAP framework to alter.2 Enhancement Spots Enhancement Spots are dedicated locations within the core application. which is passed to the implementation. which may be returned as a result. A detailed description of the ABAP based Enhancement Spots and BAdIs can be found in the NetWeaver online documentation. SAP core development may provide an Enhancement Spot by defining and publishing a Java Interface. Aside from providing the Java Interface. the signature of the execute method specifies.0 D-69190 Walldorf Date: 11/24/2010 Page 39 of 63 . only a single BAdI implementation may be provided for the Enhancement Spot. it is an adaptation of core BAdI concepts for a Java framework. or simply. All BAdI interfaces are located in a separate Development Component (DC). The BAdI is the contract between the SAP Enterprise POS core application and the implementer of the enhancement. The BAdI describes the semantics (the expected behavior as well as the boundary conditions for the implementation) and defines the signature (the input and the output parameters).

© 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. For Enhancement Spots that allow multiple implementations. the configuration contains the name of the class that implements the BAdI interface. The Enhancement Spot Configuration is owned by the customer (or SAP non-core development) exclusively. the BAdI provider has to configure the Enhancement Spot. The creation of Enhancement Spot Configuration is currently a manual process. Future upgrades of the original business function can be applied without losing the customer-specific enhancements or the need to merge the changes. all BAdI implementations to be executed at runtime have to be explicitly configured by the customer.5 Enhancement Spot Configuration In order for the EHC Framework to execute the BAdI. multiple BAdI interface implementations may be provided for the Enhancement Spot. For Enhancement Spots that allow a single implementation.4 BAdI Interface Implementations A BAdI does not belong to the SAP Enterprise POS core application and has its own software lifecycle. The configuration contains the name(s) of the BAdI for the particular Enhancement Spot. The runtime is responsible for:    Passing the input parameters (as defined and provided by SAP Enterprise Core Development) to the BAdI interface implementation Executing the configured BAdI interface implementations Retrieving the result from the BAdI interface implementation The Enhancement Concept Runtime executes the BAdI interface implementations synchronously and in sequence (in case of an Enhancement Spot with multiple implementations).2.2.0 D-69190 Walldorf Date: 11/24/2010 Page 40 of 63 .2. 7. The EHC Framework determines the Enhancement Spot Configuration at runtime. 7. the default BAdI implementations provided by SAP core development are executed by the framework. Except for the default BAdI implementations.6 Enhancement Concept Runtime The Enhancement Concept Runtime is part of the EHC Framework. the configuration contains a list of class names. which implement the BAdI interface in execution sequence.SAP ® If a BAdI interface extends the interface IBAdIMulti. which is part of the SAP Enterprise POS core application. BAdI implementations are provided by customers and SAP non-core development (like CDP). 7. If no BAdIs have been provided by customers or SAP non-core development.

SAP ® The following diagram shows the behavior of the EHC Framework at runtime: SAP Core Development (SAP Enterprise POS) Start of core application Execute core application Retrieve Configuration no Configuration available EnhancementSpot callBAdI() Configuration available Enhancement Spot Configuration default BAdI Implementation available Execute configured BAdI Implementation more configured BAdIs available Execute default BAdI Implementation no default BAdI Implementation available Enhancement Spot Framework Error occured Error occured no Error occured no Error occured all configured BAdIs processed Throw Exception Continue execution of core application © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010 Page 41 of 63 .

1 Prerequisites The following table lists the requirements.html. Download and install the JAVA IDE. This file is also part of the SAP Enterprise POS 3.eclipse.com~is~isr~epos~badi_interfaces~assembly. Download and install the Java JDK. The SAP EPOS proprietary logging API is contained in the jar file sap. 2.com~is~isr~epos~tef_logging~assembly.jar. Provide the optional logging JAR files. The interfaces are bundled in the jar file sap.com/technetwork/java/index.1 SP06. 3.3 How to implement a BAdI for an Enhancement Spot This chapter describes the process of creating an implementation for an Enhancement Spot in SAP Enterprise POS 3. The SCA file is part of the SAP Enterprise POS 3.2 Procedure The following steps have to be performed: 1.org. Eclipse or IDEs with comparable functionality SAP Enterprise POS 3.1 BAdI interfaces 7.1.SAP ® 7.3.jar.3.oracle. The JDK can be downloaded at http://www. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010 Page 42 of 63 . SAP NetWeaver Development Studio. 7.1 software delivery. 4.1. Provide the JAR file containing the BAdI interfaces. The jar file is part of the SAP Enterprise POS 3. Eclipse can be downloaded at http://www. Note: The appropriate version of a j2ee. Requirement Type Hardware Requirement Software Requirements Requirement Developer PC Java SE Development Kit JDK 5 Java IDE For example.jar is also required if using the SAP logging API. NWDS is part of the SAP NetWeaver delivery. Software Component Archive (SCA) file. Software Component Archive (SCA) file.

sap. IBAdIPackageBarcodeOutput>{ /** * Enhancement Spot executed while performing a POS Client Print barcode.interfaces.sap.sap. descriptors. SAP NetWeaver Development Studio or Eclipse Ganymede). import com. * The Enhancement Spot is invoked when calling the print barcode method for a * fiscal printer. import com.IBAdIContext. import com. The sample implementation of the barcode printing BAdI interface is: package com. and possibly a directory hierarchy with further JAR and SDA files. Some steps may have to be adjusted for other IDEs.". which contain development artifacts such as resources. Software Component Archive (SCA) file  DEPLOYARCHIVES is~isr~epos~te_deliver.interfaces. public static final String BADI_DESCRIPTION = "Enhancement spot invoked when attempting to print a barcode on a Fiscal Printer.SAP ® Tip: Software Component Archives (SCA) files and Software Deployment Archives (SDA) files are zip files.epos.0 D-69190 Walldorf Date: 11/24/2010 Page 43 of 63 . Caution: The sample implementation described in this and the following subsections has been implemented in an Eclipsebased development environment (for example.sca to MySoftwareArchive.sap.zip. } © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.1. IBAdIPackageBarcodeOutput> context).interfaces.badi.interfaces.badi.sda  build  lib or in one of the subdirectories. All jar files mentioned above can be found in: SAP Enterprise POS 3.deviceservices. public interface IBAdIPackageBarcode extends IBAdI<IBAdIPackageBarcodeInput.epos.4 Implementation of the Java BAdI for Barcode Printing The following sections describe the process of implementing a Java BAdI for Barcode printing on the Epson FP90 fiscal printer model by providing a sample implementation for the POS Client Print Barcode Enhancement Spot. * The implementation has the ability to build the barcode format for the * target fiscal printer * @param IBAdILogOnInput input object available to the Enhancement Spot * implementation * @param IBAdILogOnOutput output object implementation uses to relay * information back to the core application */ public void execute(IBAdIContext<IBAdIPackageBarcodeInput.epos.epos. Further information can be found in the Javadoc of the corresponding BAdI interface.  7.badi.IBAdI.IBAdIMulti.badi. you may need to rename the source file from MySoftwareArchive. In order to extract the required resources from an SCA file or an SDA file.

* @return the expected width of the barcode. /** * Retrieve the bar code symbology. * @return a symbology type.SAP ® Additionally. This value may be ignored by * the implementor.0 D-69190 Walldorf Date: 11/24/2010 Page 44 of 63 .below< © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. */ public int getWidth(). * @return some Text */ public String getBarcodeData(). two interfaces are provided: one for the input and one for the output parameter. /** * The positioning of the text of the barcode. This value may be ignored by the * implementor.right aligned * The implementation may ignore this value.epos. * The implementation can perform further processing for the barcode printing */ public interface IBAdIPackageBarcodeInput { /** * Data to convert to a bar code.don't display the text * 1 . /** * The input object interface to the BAdI Enhancement spot invoked when a POS * Client print barcode is performed. /** * The width of the barcode in printer dots. */ public int getAlignment(). relative to the barcode.none . /** * The positioning of the barcode relative to the paper. * possible values.interfaces.sap.deviceservices. The interface for the input parameter is: package com. * @return the expected height of the barcode.left aligned * 1 . * @return the expected alignment of the barcode. * 0 .badi. */ public int getHeight(). */ public int getSymbology(). * 0 .centered * 2 . See <code>ScanDataType</code> for /** * The height of the barcode in printer dots.

right-click on the Java project and select Properties  Java Build Path  Libraries  Add External Jars. c.4.com~is~isr~epos~badi_interfaces~assembly. The implementation can perform * further processing to build the barcode pertaining to the target fiscal * printer */ public interface IBAdIPackageBarcodeOutput { /** * Get the command to send as the first parameter of the directIO call. Browse to select sap.interfaces. 1. /** * The output object interface from the BAdI Enhancement spot invoked when a * POS Client print barcode is performed. Click OK. */ public Object getObject().com~is~isr~epos~badi_interfaces~assembly. * @return a packaged Object suitable to send via a directIO call. which will be used for the creation of a new implementation for a BAdI interface. Browse to select sap. or null if * it can't convert to a barcode. */ public int[] getCommandArray().SAP ® * 2 . In the Package Explorer. /** * Get the packaged Object that could be sent to the printer via a * directIO call to print a barcode of the given data. e. Go to File  New  Java Project to create a new Java Project. enter the project name and press Next. /** * Get the data to send as the second parameter of the directIO call. Add the BAdI interfaces to the build path of the Java Project: a. 2. 3.epos. */ public int getCommand().jar.badi.sap.deviceservices. Start the IDE. * @return an integer command.1 Create a new Java Project You must first create a new Java Project.jar. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. b. * @return the integer command array data.above * @return */ public int getTextPosition(). d. } 7. Browse to select sap.0 D-69190 Walldorf Date: 11/24/2010 Page 45 of 63 .com~is~isr~epos~te_framework~assembly.jar. The interface for the output parameter is: package com.

3. select File  New  Class.BarcodeSampleImpl has been created in your Java project.jpos.epos.deviceservices. you need to create the Java class for the BAdI interface implementation of the Enhancement Spot: 1.sap (or any other prefixes used by SAP core Java objects) as a prefix for the package name of your BAdI implementation.epos.sap.framework. Provide the package name.deviceservices.2 Create the BAdI Interface Implementation Class Once you have created a Java project.4. Recommendation: To avoid name clashes with existing or future SAP development objects. b.FiscalPrinterControl17.framework. Optionally.interfaces. you may want to use a prefix that reflects the purpose of the BAdI or that reflects your organization. 4. In the Package Explorer. Provide the class name for your BAdI interface implementation.com~is~isr~epos~tef_logging~assembly. add further interfaces. Browse to select sap. 6. Add the BAdI interface to be implemented.epos. add the SAP EPOS logging API JAR to the build path of the Java Project.epos. It is also recommended to use the prefix BAdI for the class name of the BAdI implementation.deviceservices.yourcompanyname.yourprinter. Instead.packageBar code.jar. import jpos. The class implements the BAdI interface: com.IBAdIPackageBarcode Chose com. the following result will be available: A new class: com. 7.packageBar code as package name Chose BarcodeSampleImpl as class name for the BAdI implementation   Having performed the above steps. 5.deviceservices. do not use com.SAP ® 4.badi.IBAdIPackageBarcode  The result should look like this: package com.framework.jpos. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.jar as the SAP logging API has dependencies on j2ee.sap. 2.jpos.yourcompanyname.jar classes. Browse to select j2ee. a. Click Finish. Click OK. In the Project Explorer. d.yourprinter.framework. Example: If you want to implement a BAdI for the POS Client Print Barcode Enhancement Spot:   The sample BAdI interface name is com.yourprinter.0 D-69190 Walldorf Date: 11/24/2010 Page 46 of 63 .epos.yourcompanyname. c.deviceservices. import jpos.packageBarcode. right-click on the Java project and select Properties  Java Build Path  Libraries  Add External Jars.jpos.FiscalPrinter. Optionally.

com. com.interfaces.badi.IBAdIPackageBarcodeOutput.badi.badi. /** * An example implementation of the IBAdIPackageBarcodeOutput interface */ import com.interfaces.epos.sap. In the sample implementation. } public int getCommand() { return this.deviceservices. The interface for the import parameter is provided by SAP and the import parameter is passed to the EHC Framework.epos.0 D-69190 Walldorf Date: 11/24/2010 Page 47 of 63 .yourprinter.sap.packageBarcode.sap. * * @return an integer command.SAP import import import import ® com.interfaces. public class PackageBarcodeBitmapOutput implements IBAdIPackageBarcodeOutput { /** * Get the command to send as the first parameter of the directIO call. } /** © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. IBAdIPackageBarcodeOutput can be implemented as follows: package com. implement a concrete output object interface.IBAdIContext.IBAdIPackageBarcode. public int[] commArray = { 1075 }.// Apply for the EPSON FP90 Fiscal Printer Model // public int[] commArray = 0 // Apply for the IBM 4610 Fiscal printer model public int command.interfaces.interfaces.command = 0.badi.sap.framework.3 Implement the Output interface If the output object of your BAdI consists of an interface.jpos.epos.buf = new StringBuffer(). The BAdI business logic populates the output object interface to relay information back to the core SAP Enterprise POS application.deviceservices.sap.IBAdIPackageBarcodeInput. */ public StringBuffer buf.deviceservices.IBAdIPackageBarcodeOutput.epos. IBAdILogOnOutput> context){ // TODO Auto-generated method stub } } 7. public class BarcodeSampleImpl implements IBAdIPackageBarcode { public void execute(IBAdIContext<IBAdILogOnInput.command.deviceservices.yourcompanyname.epos. public PackageBarcodeBitmapOutput() { this.badi.4.deviceservices. this. com.epos. The interface IBAdIPackageBarcodeOutput defines the data type of the output parameter of the BAdI interface IBAdILogon.

SAP

®

* Get the data to send as the second parameter of the directIO call. * * @return the integer command array data. */ public int[] getCommandArray() { return this.commArray; } /** * Get the packaged Object that could be sent to the printer via a directIO * call to print a barcode of the given data. * * @return a packaged Object suitable to send via a directIO call, or null * if it can't convert to a barcode. */ public Object getObject() { return this.buf; } public int setCommand() { return 1; } public int setCommandArray(int[] aCommand) { if (aCommand != null) { this.commArray = aCommand; } return 1; } public StringBuffer setBuffer(StringBuffer aBuf) { return this.buf = aBuf; } }

© 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010

Page 48 of 63

SAP
7.4.4

®

Implement the Business Logic of the BAdI implementation

You must provide the business logic for your BAdI implementation within the execute method of your BAdI. At runtime, an instance of an IBAdIContext object is passed to the execute method by the EHC framework. This context object allows you to access the input parameter and to set an output parameter as a result.

The IBAdIContext interface provides the following methods: package com.sap.epos.badi.interfaces; /** * Interface definition representing the context of the BAdI execution. * This type shall be the only parameter of any BAdI interface method. * The BAdI implementer classes access the context functionality by the * methods of this interface. * @param <BAdIInput> data type of the input parameter of the BAdI * @param <BAdIOutput> data type of the output parameter of the BAdI */ public interface IBAdIContext<BAdIInput, BAdIOutput> { /** * Retrieves the input of the BAdI. It contains the current input value of * the BAdI execution, that can be the original value given by the standard * code, or the modified one if there were any preceding BAdI implementer * which modified it. * @return input */ public BAdIInput getInput(); /** * Stores the input of the BAdI into the context. It can be used when one * implementor wishes to modify the input. * @param input */ public void setInput(BAdIInput input); /** * Retrieves the output of the BAdI. This is null when no implementer have * set it yet, or contains the current value of the output. * @return output */ public BAdIOutput getOutput(); /** * Stores the output of the BAdI in the context. * @param output */ public void setOutput(BAdIOutput output); /** * Makes a proposal to terminate the BAdI execution. * @param terminationProposal */ public void setTerminationProposal(boolean terminationProposal); © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010 Page 49 of 63

SAP

®

/** * Retrieves proposal to terminate the BAdI execution * @return termination proposal */ public boolean getTerminationProposal(); /** * Retrieves the BAdI Interface class * @return BAdI Interface class */ public Class<? extends IBAdI<BAdIInput, BAdIOutput>> getBAdIInterface(); }

The following boxes show the sample BAdI implementation of the IBAdIBarcode interface for the Epson FP90 fiscal printer. The BarcodeSampleImpl implementation returns a barcode string which is built for the target fiscal printer. package com.yourcompanyname.epos.framework.deviceservices.jpos.yourprinter.packageBarcode; import jpos.FiscalPrinter; import jpos.FiscalPrinterControl17; import com.sap.epos.badi.interfaces.IBAdIContext; import com.sap.epos.badi.interfaces.deviceservices.IBAdIPackageBarcode; import com.sap.epos.badi.interfaces.deviceservices.IBAdIPackageBarcodeInput; import com.sap.epos.badi.interfaces.deviceservices.IBAdIPackageBarcodeOutput; import com.triversity.tef.util.logging.Log; import com.triversity.transactionware.framework.deviceservices.DeviceServiceException; import com.triversity.transactionware.framework.deviceservices.ScanDataType; import com.triversity.transactionware.framework.deviceservices.jpos.StandardFiscalPrinterS ervice; /** * Sample BAdI Implementation for the IBAdIBarcode interface, This * implementation will provide a sample implementation for the Fiscal Printer * Barcode printing. * */ public class BarcodeSampleImpl implements IBAdIPackageBarcode { protected static FiscalPrinterControl17 printer = new FiscalPrinter(); protected static StandardFiscalPrinterService printerService = new StandardFiscalPrinterService(); package com.saptest.epos.framework.deviceservices.jpos.epsonFP90.packageBarcode; import jpos.FiscalPrinter; © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.0 D-69190 Walldorf Date: 11/24/2010 Page 50 of 63

This * implementation will provide a sample implementation for the Fiscal Printer * Barcode printing. int code = -1.symbologies table */ public static PackageBarcodeBitmapOutput buildBarcode(String data.interfaces. * */ public class BarcodeSampleImpl implements IBAdIPackageBarcode { protected static FiscalPrinterControl17 printer = new FiscalPrinter().badi.sap. /** * Method will provide access to the default implementation for the * IBAdIBarcode as a result of the BAdIOutput.sap. int wmax = 0. int ignoredWidth. context. DEVICE_JOURNAL * @param aSymbology * an index into the ConfigPOSConstants. int ignoredTextPosition) throws Exception { PackageBarcodeBitmapOutput out = new PackageBarcodeBitmapOutput(). com. // 2 wmax = 5. case 103: // ScanDataType.badi. int ignoredHeight.DSL_BCS_EAN13: code = 67.getInput(). DEVICE_SLIP.deviceservices.IBAdIContext. output = buildBarcode(input).badi.badi. IBAdIPackageBarcodeOutput> context) { IBAdIPackageBarcodeOutput output = new PackageBarcodeBitmapOutput().epos.sap. } // end execute /** * @param ignoredStationId * one of IDeviceSet.interfaces.FiscalPrinterControl17.DEVICE_RECEIPT. /** * Sample BAdI Implementation for the IBAdIBarcode interface.sap.interfaces.IBAdIPackageBarcodeOutput. int aSymbology.DSL_BCS_EAN8: code = 68. int ignoredAlignment.epos.SAP ® import jpos. int[] command = { 1075 }. */ public void execute( IBAdIContext<IBAdIPackageBarcodeInput.epos. com. IBAdIPackageBarcodeInput input = context. import import import import com.interfaces.IBAdIPackageBarcode.deviceservices. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. break.IBAdIPackageBarcodeInput. switch (aSymbology) { case 104: // ScanDataType. com.deviceservices. // 3 wmax = 8.epos.setOutput(output).0 D-69190 Walldorf Date: 11/24/2010 Page 51 of 63 .

substring(0.length() >= 10) wmax = 4. case 101: // ScanDataType.length() >= 5) wmax = 4. case 102: // ScanDataType.length() >= 12) wmax = 4. break. // 4 // Max length is 30 data = data. else if (data. // 5 // Max length is 54 data = data. else if (data.0 D-69190 Walldorf Date: 11/24/2010 Page 52 of 63 . // 1 wmax = 8. break.length() >= 16) wmax = 3.length(). 54)).length() >= 10) wmax = 2. else if (data.length() >= 24) wmax = 1. else wmax = 8. Math.length().length() >= 8) wmax = 5.length() >= 32) wmax = 1. else if (data. else if (data. if (data. else if (data.DSL_BCS_ITF: // Interleaved 2 of 5 code = 70. else wmax = 8. Math. 43)). else © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.SAP ® break. 30)).length() >= 20) wmax = 2.substring(0. break.length() >= 16) wmax = 1.length() >= 12) wmax = 3. if (data.length().min(data. else if (data. case 107: // ScanDataType.DSL_BCS_UPCE: code = 66.substring(0.DSL_BCS_CODABAR: code = 71. Math. else if (data. // 6 // Max length is 43 data = data. else if (data.DSL_BCS_CODE39: code = 69.min(data.min(data. // 0 wmax = 5.length() >= 7) wmax = 3.length() >= 16) wmax = 2. case 108: // ScanDataType. else if (data. case 106: // ScanDataType. break.DSL_BCS_UPCA: code = 65. if (data.

break.warn("Barcode symbology " + aSymbology + " ported").length().DSL_BCS_TF: case 120: // case ScanDataType. break. break.length() >= 15) wmax = 2.substring(0. else if (data. // Max length is 52 data = data.length() >= 21) wmax = 1.min(data. // Barcode Width buf.append("2").SAP ® wmax = 8. // Max length is 45 data = data. else if (data.length() >= 11) wmax = 3. 45)).0 D-69190 Walldorf Date: 11/24/2010 Page 53 of 63 . else if (data. case 105: // ScanDataType.append("064"). if (data.length() >= 6) wmax = 5. else if (data.length() >= 25) wmax = 1. else if (data. else wmax = 8.append(wmax). // Operator buf. } if (code != -1) { not sup- StringBuffer buf = new StringBuffer().append("068"). else wmax = 8. if (data. // Horizontal position in points buf. Math. else if (data.DSL_BCS_EAN128: default: // Not supported // log.length() >= 9) wmax = 3.substring(0.min(data. else if (data. case 109: // ScanDataType. else if (data.length() >= 8) wmax = 4. // Barcode height in points buf.DSL_BCS_CODE93: code = 72. buf.length() >= 5) wmax = 5.length() >= 13) wmax = 2.length() >= 7) wmax = 4. Math.DSL_BCS_CODE128: code = 73. 52)). break.append("01"). case 110: // ScanDataType.length(). // enabling printing HRI characters: 0=no // 1=sopra 2=sotto 3=sopra e sotto © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.

// * ScannerConst. // * ScannerConst. // * ScannerConst.append("00"). // Digits DSL_BCS_UPCE = 102. // -. // * ScannerConst.SCAN_SDT_UPCD2.SCAN_SDT_UPCD3. // OCR "B" * // Two dimensional symbologies DSL_BCS_PDF417 = 201. // * ScannerConst. // * ScannerConst.append("1"). // * ScannerConst. $.SCAN_SDT_ITF.SAP ® buf. // Unused buf. // * ScannerConst. // 128 * data characters DSL_BCS_UPCA_S = 111.SCAN_SDT_UPCA. $. } return out. // ScannerConst. // (Discrete 2 of 5) // Digits DSL_BCS_ITF = * 106. // +. // (Interleaved 2 of 5) // Digits * DSL_BCS_CODABAR = 107. // * ScannerConst. Digits. // = JAN 8 DSL_BCS_JAN13 = 104. %. // UPC-D5 DSL_BCS_EAN8_S = 118. // Digits. // ScannerConst. // UPC-D4 DSL_BCS_UPCD5 = 117. // ScannerConst. // = EAN 13 DSL_BCS_EAN13 = 104. // * ScannerConst.SCAN_SDT_EAN128.SCAN_SDT_OCRB. // = EAN 8 DSL_BCS_EAN8 = 103.append(code).SCAN_SDT_EAN8_S. // OCR "A" DSL_BCS_OCRB = 122. . // Same characters as // Code * 39 DSL_BCS_CODE128 = 110.SCAN_SDT_PDF417. Space.. // © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.SCAN_SDT_Code39. // * ScannerConst. // * ScannerConst.SCAN_SDT_TF. // ScannerConst. // ScannerConst. b. // font for characters HRI (0-3) buf.setBuffer(buf).SCAN_SDT_UPCA_S. } public static IBAdIPackageBarcodeOutput buildBarcode( IBAdIPackageBarcodeInput input) { /** * * The list of JavaPOS symbology DSL_BCS_UPCA = 101. // EAN 128 DSL_BCS_OCRA = 121. /.SCAN_SDT_Codabar. // UPC-E with // * supplemental barcode DSL_BCS_UPCD1 = 113. :. /.SCAN_SDT_OCRA.SCAN_SDT_JAN8. // UPC-D1 DSL_BCS_UPCD2 = 114.SCAN_SDT_Code93. // Barcode type buf. // EAN 8 with // supplemental barcode * DSL_BCS_EAN13_S = 119. // Digits DSL_BCS_JAN8 = 103. // UPC-A with // supplemental barcode * DSL_BCS_UPCE_S = 112.SCAN_SDT_UPCE. DSL_BCS_MAXICODE = 202. // ScannerConst. -. // * ScannerConst.SCAN_SDT_EAN13. // * ScannerConst. // * ScannerConst. c. .setCommandArray(command). // * ScannerConst. // Data out.SCAN_SDT_EAN13_S.0 D-69190 Walldorf Date: 11/24/2010 Page 54 of 63 . * // Special cases DSL_BCS_VENDOR = 501.append(data). // d) DSL_BCS_CODE39 = 108.SCAN_SDT_Code128. // UPC-D2 DSL_BCS_UPCD3 = 115.SCAN_SDT_UPCD5.SCAN_SDT_UPCE_S. // * ScannerConst.SCAN_SDT_EAN8..SCAN_SDT_MAXICODE.SCAN_SDT_JAN13. // * ScannerConst. // * start/stop (*) // Also has Full Ascii // feature DSL_BCS_CODE93 = * 109. // EAN 13 * with // supplemental barcode DSL_BCS_EAN128 = 120. * 4 start/stop // characters (a. // * ScannerConst. // Alpha.SCAN_SDT_UPCD1. // = JAN 13 DSL_BCS_TF = 105.SCAN_SDT_UPCD4. out. // * ScannerConst. // UPC-D3 DSL_BCS_UPCD4 = 116. +.

getAlignment(). int aIgnoredHeight = input. * */ public class BBoxBarcodeSampleImpl implements IBAdIPackageBarcode { © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. PackageBarcodeBitmapOutput out = new PackageBarcodeBitmapOutput(). int aIgnoredWidth = input.deviceservices. int aSymbology = input.SCAN_SDT_UNKNOWN.badi. import jpos. aIgnoredTextPosition).0 D-69190 Walldorf Date: 11/24/2010 Page 55 of 63 .epsonFP90.jpos.badi.saptest.epos. int aIgnoredAlignment = input. aIgnoredHeight.IBAdIPackageBarcodeOutput.deviceservices. import jpos.IBAdIContext. package com.interfaces.SCAN_SDT_OTHER.interfaces. int aIgnoredTextPosition = input. com.getWidth().FiscalPrinterControl17.sap.interfaces.// specific bar code // * symbologies DSL_BCS_UNKNOWN = 0. * **/ IBAdIPackageBarcodeOutput output = null.framework.badi.getHeight(). aSymbology.deviceservices. // * Cannot determine the // barcode symbology.epos.getTextPosition(). aIgnoredAlignment.deviceservices.packageBarcode. aIgnoredWidth.badi.epos. com.epos.interfaces.sap.getSymbology().sap. output = out. String aData = input. /** * Sample BAdI Implementation for the IBAdIBarcode interface.SAP ® * ScannerConst. // ScannerConst. try { out = buildBarcode(aData.IBAdIPackageBarcodeInput.sap. } catch (Exception e) { } return output. } } The following boxes show the sample BAdI implementation of the IBAdIBarcode interface for the IBM 4610 fiscal printer. This * implementation will provide a sample implementation for the Fiscal Printer * Barcode printing.IBAdIPackageBarcode. import import import import com.FiscalPrinter. // Start of vendor.getBarcodeData(). com.epos.

aIgnoredTextPosition). aIgnoredWidth. context.getBarcodeData().getHeight().getTextPosition(). */ public void execute( IBAdIContext<IBAdIPackageBarcodeInput.DEVICE_RECEIPT.symbologies table */ public static PackageBarcodeBitmapOutput buildBarcode(String data. int aIgnoredTextPosition = input. int aSymbology = input.setOutput(output). aIgnoredAlignment. int ignoredHeight. int ignoredAlignment. output = out. } // end execute public static IBAdIPackageBarcodeOutput buildBarcode( IBAdIPackageBarcodeInput input) { IBAdIPackageBarcodeOutput output = null. try { out = buildBarcode(aData. int aSymbology. } catch (Exception e) { } return output. IBAdIPackageBarcodeOutput> context) { IBAdIPackageBarcodeOutput output = new PackageBarcodeBitmapOutput(). int aIgnoredWidth = input. aSymbology. int ignoredTextPosition) throws Exception { /* * -----------------------------------------------------------------------------------------* The list of JavaPOS symbology DSL_BCS_UPCA = 101. output = buildBarcode(input). } /** * @param ignoredStationId * one of IDeviceSet. DEVICE_JOURNAL * @param aSymbology * an index into the ConfigPOSConstants. int ignoredWidth. // Digits DSL_BCS_UPCE = 102.SAP ® protected static FiscalPrinterControl17 printer = new FiscalPrinter(). String aData = input. int aIgnoredAlignment = input. DEVICE_SLIP.getSymbology().SCAN_SDT_UPCA. // * ScannerConst. /** * Method will provide access to the default implementation for the * IBAdIBarcode as a result of the BAdIOutput. int aIgnoredHeight = input.getWidth(). aIgnoredHeight. // © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. IBAdIPackageBarcodeInput input = context. PackageBarcodeBitmapOutput out = new PackageBarcodeBitmapOutput().getInput().getAlignment().0 D-69190 Walldorf Date: 11/24/2010 Page 56 of 63 .

// * * ScannerConst. // EAN 8 with // supplemental barcode * DSL_BCS_EAN13_S = 119.SCAN_SDT_UPCD2. // UPC-D1 DSL_BCS_UPCD2 = 114. :.SCAN_SDT_Code128. // * ScannerConst. // ScannerConst. // (Interleaved 2 of 5) // Digits * * DSL_BCS_CODABAR = 107. // * * ScannerConst. // * ScannerConst. // ScannerConst. // // = EAN 13 DSL_BCS_EAN13 = 104. // UPC-D4 DSL_BCS_UPCD5 = 117.SCAN_SDT_OTHER.SCAN_SDT_Code93.SCAN_SDT_Codabar. // * ScannerConst. // UPC-D3 DSL_BCS_UPCD4 = 116. // * ScannerConst.SCAN_SDT_EAN8_S. DSL_BCS_MAXICODE = 202. // ScannerConst. // OCR "A" DSL_BCS_OCRB = 122. // OCR "B" * // Two dimensional symbologies DSL_BCS_PDF417 = 201. // ScannerConst.SCAN_SDT_TF.SCAN_SDT_ITF. ScannerConst. Digits.SCAN_SDT_JAN8. int code = -1. // ScannerConst. // * ScannerConst. // ScannerConst. b.SCAN_SDT_JAN13.SCAN_SDT_UPCD1. /.SCAN_SDT_UPCD4.SCAN_SDT_MAXICODE.SCAN_SDT_UPCE. // // = JAN 13 DSL_BCS_TF = 105. // * ScannerConst. // * start/stop (*) // Also has Full Ascii // feature DSL_BCS_CODE93 = * 109. %. // Start of vendor. // // Digits DSL_BCS_JAN8 = 103. // * ScannerConst. // (Discrete 2 of 5) // Digits DSL_BCS_ITF * 106.SCAN_SDT_OCRA. // * * ScannerConst. switch (aSymbology) { case 104: // ScanDataType. // UPC-D5 DSL_BCS_EAN8_S = 118. // Digits. // * ScannerConst..SCAN_SDT_EAN128..SCAN_SDT_UPCD5.SCAN_SDT_UPCD3. . // // = JAN 8 DSL_BCS_JAN13 = 104. . -.SCAN_SDT_Code39. // UPC-E with // * supplemental barcode DSL_BCS_UPCD1 = 113. ScannerConst. ScannerConst. * */ PackageBarcodeBitmapOutput out = new PackageBarcodeBitmapOutput(). // * * ScannerConst.SCAN_SDT_EAN13_S. // * Cannot determine the // barcode symbology.SCAN_SDT_PDF417.SCAN_SDT_EAN8. // UPC-A with // supplemental barcode * DSL_BCS_UPCE_S = 112. $.SAP ® * * * * * * = ScannerConst. // Alpha. // +.// specific bar code // * symbologies DSL_BCS_UNKNOWN = 0. // d) DSL_BCS_CODE39 = 108.SCAN_SDT_UPCE_S. // // = EAN 8 DSL_BCS_EAN8 = 103. // -. ScannerConst. * // Special cases DSL_BCS_VENDOR = 501. * 4 start/stop // characters (a.0 D-69190 Walldorf Date: 11/24/2010 Page 57 of 63 . Space.DSL_BCS_EAN13: © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. // Same characters as // Code * 39 DSL_BCS_CODE128 = 110. +. c.SCAN_SDT_OCRB. // EAN 128 DSL_BCS_OCRA = 121. $.SCAN_SDT_UNKNOWN. // 128 * data characters DSL_BCS_UPCA_S = 111.SCAN_SDT_EAN13. // EAN 13 * with // supplemental barcode DSL_BCS_EAN128 = 120. // * ScannerConst. ScannerConst. // * ScannerConst. // UPC-D2 DSL_BCS_UPCD3 = 115.SCAN_SDT_UPCA_S. int[] command = { 0 }. // ScannerConst. /.

DSL_BCS_CODABAR: 6. buf.").")."). } return out. // 6 ScanDataType. // 0 ScanDataType.DSL_BCS_EAN8: 3. case 102: // code = break. // 2 ScanDataType.").setCommandArray(command). case 107: // code = break. out.append(". case 101: // code = break. case 110: // code = break. ScanDataType. case 106: // code = break. } } © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. buf.append("PBC=").append(".DSL_BCS_TF: case ScanDataType.append(data). // 1 ScanDataType. buf. out. // 3 ScanDataType.DSL_BCS_UPCE: 1. case 109: // code = break.append(code).SAP ® code = break. } 2.0 D-69190 Walldorf Date: 11/24/2010 Page 58 of 63 . ScanDataType. buf. buf. buf. // 5 ScanDataType. case 103: // code = break.DSL_BCS_UPCA: 0.DSL_BCS_CODE93: 8.DSL_BCS_ITF: // Interleaved 2 of 5 5.DSL_BCS_CODE39: -1. buf. buf. // 4 length is 30 ScanDataType. case 105: // case 120: // default: // Not break."). case 108: // code = // Max break.append(".setBuffer(buf).append(".DSL_BCS_EAN128: supported if (code != -1) { StringBuffer buf = new StringBuffer().DSL_BCS_CODE128: 7.append(".

Additionally.5 Create a jar file with the BAdI Implementations Once you have completed BAdI interface implementation(s) as described in the previous sections. 3. ensure that each BAdI implementation occurs only once. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. Other implementations can check the termination proposal and optionally decide to either:   Accept the proposal and return without further processing of the request. you can prepare the implementation(s) for deployment. a BAdI implementation must not throw an exception. these implementations are executed in sequence. 2. style sheets or images). that the different JAR files are disjunctive. Tip: The context object provides the following setter and getter methods for a termination proposal:  public void setTerminationProposal(boolean terminationProposal)  public boolean getTerminationProposal() If an Enhancement Spot allows multiple implementations of the BAdI interface.SAP ® Note: BAdI implementations may only throw exceptions that have been explicitly specified in the signature of the execute method of the BAdI interface. with all BAdI implementations provided in a single JAR file whenever possible. add all required resources to the Java project. Select Export  Jar  Next. 4. Optionally. To export the BAdI implementation in a JAR file: 1. Complete the steps of the Wizard and click Finish. BAdI implementations are provided bundled as JAR files. Note: BAdI implementations must invoke the context. In the Package Explorer. If the BAdI interface does not specify an exception.4.setOutput() method with the output from the implementation to make this output available to the relevant Enhancement Spots. that is. for IBAdIMulti BAdIs it may be appropriate to inspect the output of previous implementations (as shown in the IBAdILogOn examples). This is for BAdI implementations that need additional resources (for example.0 D-69190 Walldorf Date: 11/24/2010 Page 59 of 63 . Throwing exceptions other than the specified ones will result in an undefined state of the application. right-click on the Java project. or Continue executing 7. If you are providing multiple JAR files. An implementation may indicate that further processing is not necessary by setting a termination proposal.

deviceservices. the property value is a comma separated list of the fully qualified class names of the implementing classes.properties file must be used to configure all Enhancement Spots.properties file.6 Configure the Enhancement Spot There is a one-to-one relationship between an Enhancement Spot and the corresponding BAdI interface. … 3. create the badi. Caution: A single badi. ImplClass2. For an Enhancement Spot that supports single BAdI implementations only.0 D-69190 Walldorf Date: 11/24/2010 Page 60 of 63 .jpos. com. the fully qualified class name of the BAdI interface is used as the property name and represents the Enhancement Spot. The fully qualified class name of the implementing class of the BAdI interface represents the value. Caution: If an Enhancement Spot which supports a single BAdI implementation is configured with multiple implementations.deviceservices. Save the badi.sap. epsonFP90. Example: Configuration for the POS Client Print Barcode Enhancement Spot. In case of an Enhancement Spot which supports multiple implementations.SAP ® 7.properties file to the <TE_HOME>/custom/lib/badi directory. the format of the entry is: BAdIInterfaceName = ImplClass1 For an Enhancement Spot that supports multiple BAdI implementations. 2.BarcodeSampleImpl © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. in case of an Enhancement Spot that supports multiple implementations) to execute at runtime.epos.properties file. In the badi. Add an entry for each Enhancement Spot you want to configure.badi. the EHC framework will throw an exception and no implementation will be executed.saptest.IBAdIPackageBarcode= com. To configure the EHC Framework to execute the right implementations for a BAdI interface: 1. Using the text editor of your choice.properties is used to describe which BAdI implementation (or which BAdI implementations.packageBarcode. The sequence of the class names determines the sequence of the execution at runtime. The property file badi.interfaces. the format of the entry is: BAdIInterfaceName = ImplClass1.epos.4.framework.

badi.badi. This section describes how to implement the BAdI interface for Bitmap printing on the Epson FP90 printer model. public interface IBAdIPackageBitmap IBAdIPackageBitmapOutput>{ extends IBAdI<IBAdIPackageBitmapInput.sap.epos. 7.". * This value may be ignored by the implementation.epos.badi.sap. in dots. Note that the above configuration must be provided in a single line in the property file. } The interface for the input parameter is: package com.5 Implementation of the Java BAdI for the Bitmap Printing The second sample Java BAdI implementation provided is the POS Client Print Bitmap Enhancement Spot.epos. /** * The width of the barcode in printer dots. IBAdIPackageBitma- public static final String BADI_DESCRIPTION = "Enhancement spot invoked when attempting to print a bitmap on a Fiscal Printer. */ © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. import com. The sample POS Client Print Bitmap Enhancement Spot BAdI interface is as follows: package com. * @return the expected width of the bitmap. The implementation builds the bitmap format base on the target fiscal printer.interfaces.deviceservices.interfaces. the POS Client Print Barcode Enhancement Spot is configured to execute the BarcodeSampleImpl implementation of the IBAdIPackageBarcode interface.IBAdI.interfaces. Further information can be found in the Javadoc of the corresponding BAdI interface. */ public void execute(IBAdIContext<IBAdIPackageBitmapInput. import com. The POS Client Print Bitmap Enhancement Spot allows implementations to qualify a POS Client Print Bitmap request. or -1. or -1 to print it ‘as is’. /** * Method execution provides functionality of the nhancement Spot.sap.interfaces.badi.epos. therefore no sample implementation is provided here. The Epson FP90 fiscal printer does not support bitmap printing.SAP ® Caution: In the above example. pOutput> context).sap.IBAdIContext. * @return a filename */ public String getFilename().0 D-69190 Walldorf Date: 11/24/2010 Page 61 of 63 .deviceservices. public interface IBAdIPackageBitmapInput { /** * File path to the bitmap.

sap. * 0 . public interface IBAdIPackageBitmapOutput { /** * Get the command to send as the first parameter of the directIO call. /** * Get the packaged Object that could be sent to the printer via a * directIO call to print a bitmap of the given data.badi. } © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1. */ public int getCommand().right aligned * The implementation may ignore this value. /** * The positioning of the bitmap relative to the paper.deviceservices.epos.SAP ® public int getWidth(). * @return the expected alignment of the barcode.0 D-69190 Walldorf Date: 11/24/2010 Page 62 of 63 . */ public int getAlignment(). * @return an integer command. * @return a packaged Object suitable to send via a directIO call. */ public Object getObject(). } The interface for the output parameter is: package com.centered * 2 .left aligned * 1 .interfaces. */ public int[] getCommandArray(). or null if * it can't print the bitmap. /** * Get the data to send as the second parameter of the directIO call. * @return the integer command array data.

Stop the application.0 D-69190 Walldorf Date: 11/24/2010 Page 63 of 63 .SAP 7.properties file to the <TE_HOME>/custom/lib/badi directory. EHC Framework must be configured to be able to execute the right implementations for a BAdI interface. Restart the application. The BAdI implementations and the corresponding configuration must be distributed to all servers and clients. © 2010 SAP AG Title: SAP Enterprise POS Fiscal Printer User Exit Technical ReferDietmar-Hopp-Allee 16 ence Version: 1.6 ® Distribution and Deployment This guide describes the process of manually distributing and deploying the BAdI implementations. Copy the JAR files with the BAdI implementations and the badi. 3. To manually distribute and deploy the BAdI implementations: 1. 2.