H E L P X. C A I N T B R SAP Library Documentation for Electronic Correction Letters (CC-e) Release 6 7 70
Copyright Copyright 2011 SAP AG. All rights reserved. SAP Library document classification: PUBLIC 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 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, SAP BusinessObjects Explorer, StreamWork, 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 Business Objects Software Ltd. Business Objects is an SAP company. Sybase and Adaptive Server, ianywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase, Inc. Sybase is an SAP company. (C) SAP AG SAP Library for CC-e 2
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. (C) SAP AG SAP Library for CC-e 3
Icons in Body Text Icon Meaning Caution Example Note Recommendation Syntax Additional icons are used in SAP Library documentation to help you identify different types of information at a glance. For more information, see Help on Help General Information Classes and Information Classes for Business Information Warehouse on the first page of any version of SAP Library. Typographic Conventions Type Style Example text Example text EXAMPLE TEXT Example text Example text <Example text> EXAMPLE TEXT Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation. Emphasized words or phrases in body text, graphic titles, and table titles. Technical names of system objects. These include report names, program names, transaction codes, table names, and key concepts of a programming language when they are surrounded by body text, for example, SELECT and INCLUDE. Output on the screen. This includes file and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. Exact user entry. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER. (C) SAP AG SAP Library for CC-e 4
Table of Contents NF-e Events... 6 Electronic Correction Letters (CC-e)... 7 Customizing for Electronic Correction Letters (CC-e)... 8 Interfaces for Electronic Correction Letters (CC-e)... 9 Interface for Outbound CC-e Messages... 10 Interface for Inbound NF-e Event Messages... 11 Process Flow for Electronic Corrections Letters (CC-e)... 12 Creating Electronic Correction Letters (CC-e)... 14 Archiving NF-Event Data... 15 (C) SAP AG SAP Library for CC-e 5
NF-e Events An NF-e event is an action that is related to an electronic nota fiscal (NF-e). Such actions include authorization, denial, cancellation, and so on. SEFAZ defines what the actions are and who the NF-e event author and recipient are. In Portuguese, this is known as evento. SEFAZ has identified a wide range of NF-e events, but only some are tracked by the government. These include, for example, the following: NF-e authorization Denial of NF-e authorization NF-e cancellation Electronic correction letter (CC-e) for an NF-e. For more information about CC-e, see Electronic Correction Letter (CC-e) [Page 7]. Your SAP ERP system allows you to create and process NF-e events in the NF-e Monitor and track the history of NF-e and their corresponding NF-e events. Integration You enable communication between the tax authority systems and your SAP ERP system about NF-e events with a messaging system. You can choose your own messaging system or an SAP product: SAP BusinessObjects Nota Fiscal Eletrônica. SAP BusinessObjects Nota Fiscal Eletrônica can be integrated into your existing system landscape, so that your SAP ERP system provides the data required by the authorities and SAP BusinessObjects Nota Fiscal Eletrônica communicates with the authorities and your customers and suppliers. For more information about SAP BusinessObjects Nota Fiscal Eletrônica, see http://help.sap.com/grc Nota Fiscal Eletrônica SAP BusinessObjects Nota Fiscal Eletrônica System Administrator's Guide. (C) SAP AG SAP Library for CC-e 6
Electronic Correction Letters (CC-e) An electronic correction letter (CC-e) is an NF-e event that informs the government and NF-e recipients about incorrect information contained in an NF-e already authorized by the government. The event author for an electronic correction letter is the NF-e issuer. In Portuguese, this NFe event is known as Carta de Correção eletrônica. To enable the processing of CC-e in your SAP ERP system, you must make certain settings in the Customizing for electronic notas fiscais (NF-e). For more information, see Customizing for Electronic Correction Letters (CC-e) [Page 8]. You use the NF-e Monitor to create, change and send CC-e for authorization. You can also track the statuses of CC-e in the NF-e Monitor. (C) SAP AG SAP Library for CC-e 7
Customizing for Electronic Correction Letters (CCe) To allow you to create and process electronic correction letters, you must record and map the following two kinds of NF-e event codes in Customizing: The official NF-e event code that is assigned to this NF-e event by SEFAZ The internal NF-e event code that is used for backend processing in your SAP ERP system Activities You make the following settings: 1. In the Enter Official NF-e Event Codes and Map to Internal Codes Customizing activity, you record the official NF-e event code from SEFAZ, enter a descriptive text for the event, and then map it to the resepctive internal NF-e event code that is delivered with your SAP ERP system. This Customizing activity is found in Customizing for Cross-Application Components under General Application Functions Nota Fiscal Electronic Notas Fiscais (NF-e) NF-e Events. 2. In the Group Internal NF-e Event Codes Customizing activity, you create NF-e event groups and assign the internal NF-e event codes of those NF-e events that should be processed by a business place in the same way. This Customizing activity is found in Customizing for Cross-Application Components under General Application Functions Nota Fiscal Electronic Notas Fiscais (NF-e) NF-e Events. 3. In the Define Business Places Customizing activity, you assign the corresponding NF-e event group to the relevant business places. This Customizing activity is found in Customizing for Cross-Application Components under General Application Functions Nota Fiscal CNPJ Business Places. (C) SAP AG SAP Library for CC-e 8
Interfaces for Electronic Correction Letters (CC-e) To communicate with the tax authorities about electronic correction letters (CC-e), you use the following function modules to establish the communication between your SAP ERP system and your messaging system: RFC call to the messaging system for CCe (J_1BNFE_CCE_OUT) for outbound messages. For more information, see Interface for Outbound CC-e Messages. Event Update From Messaging System (J_1BNFE_EVENT_IN) for inbound messages. For more information, see Interface for Inbound CC-e Messages. If you use SAP BusinessObjects Nota Fiscal Eletrônica as your messaging solution and have enabled the communication between this solution and your SAP ERP system, no further action is needed for supporting NF-e events. For more information about SAP BusinessObjects Nota Fiscal Eletrônica, see http://help.sap.com/grc Nota Fiscal Eletrônica SAP BusinessObjects Nota Fiscal Eletrônica System Administrator's Guide. (C) SAP AG SAP Library for CC-e 9
Interface for Outbound CC-e Messages Your SAP ERP system asynchronously sends electronic correction letters (CC-e) using the outbound interface RFC call to the messaging system for CCe (J_1BNFE_CCE_OUT) function module. This interface provides the data required by the tax authorities for registering and processing CC-e issued for NF-e. The interface to the messaging system comprises the following parameters: IV_NFE_ACCESS_KEY NF-e: 44-digit access key IV_EVENT_TYPE Official NF-e event code IV_INTERNAL_SEQUENCE_NUMBER Event sequence number that is used internally in your SAP ERP system IV_TIMESTAMP NF-e event: Timestamp of creation (YYYYMMDDhhmmssmmmuuun) IV_TIMEZONE Time zone of the issuing business place IV_CONTENT Content of the CC-e as a text string IV_RESEND Flag that is used for resending in the messaging system after RFC communication fails during the previous call. This is an optional parameter. More Information For other information that is not specific to CC-e, see Interface for Outbound Messages in the SAP Library (http://help.sap.com) under SAP ERP SAP ERP Central Component SAP ERP Central Component Financials Country Versions Americas Brazil Cross- Application Components Nota Fiscal Electronic Nota Fiscal (NF-e) Customizing for NF-e Interfaces for Communicating with Messaging System. (C) SAP AG SAP Library for CC-e 10
Interface for Inbound NF-e Event Messages Your SAP ERP system can receive messages about NF-e events using the inbound interface of the Event Update From Messaging System (J_1BNFE_EVENT_IN) function module. This interface is used for batch processing of NF-e events. The IT_EVENTS interface table contains single NF-e events. The interface structure comprises the following fields to be filled: DOCNUM NF-e document number that is used in your SAP ERP system EXT_EVENT Official NF-e event code SEQNUM Internal sequence number for the NF-e event, which is used in your SAP ERP system EXT_SEQNUM Official sequence number for the NF-e event. This is the sequence number for the NF-e event that is used by the tax authorities. This number is populated by the messaging system and should increase by one for an NF-e event if the previous one has been authorized. ACCKEY 44-digit access key for the NF-e AUTHCODE Protocol number of the NF-e event REPLY_TMPL Timestamp of reply to authorization request for NF-e. The format is as follows: YYYYMMDDhhmmssmmmuuun. CODE Status code that is related to the NF-e event MSGTYP Type of inbound message Your SAP ERP system requires a unique code that identifies the type of inbound message. These codes are defined in the backend. The inbound interfaces can process any of the following message types for NF-e events: Type of NF-e Event Message Code Message Type Electronic correction letter (CC-e) 1 Authorization Electronic correction letter (CC-e) 2 Rejection The CT_BAPIRET2 interface table contains the BAPI return information (type BAPIRETTAB) from your SAP ERP system. More Information For more information that is not specific to NF-e events, see Interfaces for Inbound Messages in the SAP Library (http://help.sap.com) under SAP ERP SAP ERP Central Component SAP ERP Central Component Financials Country Versions Americas Brazil Cross-Application Components Nota Fiscal Electronic Nota Fiscal (NF-e) Customizing for NF-e Interfaces for Communicating with Messaging System. (C) SAP AG SAP Library for CC-e 11
Process Flow for Electronic Corrections Letters (CC-e) An electronic correction letter (CC-e) issued to inform the tax authorities of changes to the information in an already authorized electronic nota fiscal (NF-e). This process up the response from the tax authorities is shown in the following figure and explained in more detail in the following documentation: P roc es s or S AP E R P S ys tem Mes s ag ing S ys tem Tax A uthorities C reate and S end C C -e S end C C -e Validation C heck of C C -e E rror OK E rror = V E rror = R F ix Data R esend CC-e R esend CC-e S end Authorization R equest C heck R equest OK E rror Authorize R equest R eject Deny Update C C -e S tatus in NF - e Monitor Update C C -e S tatus S end R esponse Creating and Sending a CC-e for Authorization Process 1. A processor creates and sends a CC-e for an authorized NF-e on the NF-e Monitor screen. For more information, see Creating Electronic Correction Letters (CC-e) [Page 14]. 2. Your SAP ERP system sends an authorization request to the messaging system. The system assigns 1 as the internal sequence number. One of the following error messages may be returned from the messaging system: o o o V: The CC-e did not pass the validation checks of the messaging system. You must fix the error and resend the CC-e. R: The messaging system is unavailable. You must resend the CC-e later. G: This message cannot be fixed by the processor in the SAP ERP system. It must be fixed in the messaging system before the process can continue. I (C) SAP AG SAP Library for CC-e 12
3. The messaging system sends the authorization request to the tax authorities. 4. The tax authorities respond to the authorization request in one of the following ways: o o Authorize the CC-e Reject the authorization request for the CC-e 5. The messaging system passes the response to your SAP ERP system. 6. Your SAP ERP system updates the status of the CC-e on the NF-e Monitor. The following figure shows how you can react to these different responses and is explained in more detail in the following documentation. P roc es s or S AP E R P S ys tem Mes s ag ing S ys tem Tax A uthorities C heck S tatus in NF -e Monitor Authorized R ejected E rror cannot be fixed E rror fixed R esend CC-e R esend C C -e S end Authorization R equest C heck R equest View Updated CC-e S tatus in NF -e Monitor Update C C - e S tatus Update C C -e S tatus S end R esponse After Initial Response from Tax Authorities Authorization Your messaging system increases the official NF-e event sequence number to 1 and passes this to your SAP ERP system. On the NF-e Monitor, the status of the CC-e is displayed as Authorized in the NF-e event history for the NF-e. The process for this CC-e is complete. If needed, you can create new CC-e for this NF-e later. Rejection Your SAP ERP system displays the relevant status for the CC-e in the NF-e event history for the NF-e on the NF-e Monitor. If possible, the processor makes the necessary changes and resends the CC-e for authorization. The messaging system sends the CC-e to the tax authorities and returns their response to your SAP ERP system. The updated response is displayed on the NF-e Monitor. (C) SAP AG SAP Library for CC-e 13
Creating Electronic Correction Letters (CC-e) Procedure 1. Open the NF-e Monitor using the J1BNFE transaction. 2. Select the NF-e that you want to change in the NF-e Monitor. 3. Choose NF-e Events CC-e Create. 4. Enter the text for the CC-e. The tax authorities have set a minimum limit of 15 characters and a maximum of 1000 characters. If you enter a longer text, the SAP ERP system cuts the text at the limit. 5. Send the CC-e to the tax authorities for authorization. Result After you create the CC-e, the system displays an icon in the NF-e Events column for this NFe. By clicking on the icon, you can display the NF-e Event History for this NF-e. The history shows the communication regarding all NF-e events for this NF-e between your SAP ERP system and the messaging system and the tax authorities. (C) SAP AG SAP Library for CC-e 14
Archiving NF-Event Data When you archive notas fiscais using the J_1BNF archiving object, you also archive the data for the corresponding NF-e events. This NF-e event data is stored in the following tables: J_1BNFE_EVENT: Table for storing data that is common to all NF-e event types J_1BNFE_CCE: Table for storing data that is specific electronic correction letters (CC-e) Procedure 1. You archive notas fiscais by choosing, from the SAP Easy Access screen, Tools Administration Administration Data Archiving. 2. Enter J_1BNF as the object name. More Information For more information about archiving notas fiscais, see Archiving Notas Fiscais in the SAP Library (http://help.sap.com) under SAP ERP SAP ERP Central Component SAP ERP Central Component Financials Country Versions Americas Brazil Cross- Application Components Nota Fiscal Nota Fiscal Writer.. (C) SAP AG SAP Library for CC-e 15