How-to Guide SAP Business One 8.82 SAP Business One 9.0 and SAP Business One 9.0, version for SAP HANA SAP Business One 9.1 and SAP Business One 9.1, version for SAP HANA Document Version: 1.0 2014-11-27 How to Manage UUID field in Existing Purchasing Documents (Electronic Accounting Statement Feature) Mexico
Typographic Conventions Type Style Example Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Textual cross-references to other documents. Example EXAMPLE Example Example <Example> Emphasized words or expressions. 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. EXAM PLE Keys on the keyboard, for example, F2 or EN TER. 2 2014 SAP SE. All rights reserved. Typographic Conventions
Table of Contents 1 Introduction... 4 2 SDN Information... 5 3 Updating the UUID Field in Existing Invoice Type Documents on the A/P Side... 6 Process Visualization... 7 4 Updating UUID in Existing Documents... 8 Table of Contents 2014 SAP SE. All rights reserved. 3
1 Introduction To comply with the regulations regarding the Electronic Accounting Statement in Mexico, SAP Business One partners must manually create a UDF for the purpose of managing UUID information (for more information, see SAP Note 2048577). This document describes the process of managing the UUID field for invoice type documents on the purchasing side, which are created within the transition period (from July to December 2014). All such documents must be reported in the journal entry report (JE report). The UUID field appears on all invoices (in XML file structure) and consists of 36 characters provided by the Mexican tax authority (SAT). For SDN information, refer to the section SDN Information. 4 2014 SAP SE. All rights reserved. Introduction
2 SDN Information Summary Hereby provided Tool is designed for managing electronic document numbering information (UUID) provided by SAT Authority. Tool is relevant for electronic document communication in Mexico (herein referred to as Tool ) is delivered within the SDN license structure and therefore no support is provided. This guide helps you run the application easily (no installation is needed). This Tool is a freeware application provided by SAP SE to SAP Business One customers in Mexico in order to provide automated way of managing UUID information from XML into existing documents created within the transitional period. Tool shall provide automated way of associating UUID information from XML representing electronic form of document for documents existing in the database. During its run, temporary data are created to provide a mapping bridge between the documents and XML files in order to correctly update UUID information in the relevant existing documents in the database. Feedback on Tool should be provided through SDN forum or through your official SAP Local Product expert. Authors: Pawel Kostorz, Martin Slavik, Martin Pavlinsky Company: SAP Slovensko, s.r.o. Created on: July 10, 2014 Author Bio SAP Business One Solution Management created this application to fulfill a business gap which emerged due to a recent legal requirement effective from January 2015. Note Find the relevant how-to guide attached to this document. You can download Tool here. SDN Information 2014 SAP SE. All rights reserved. 5
3 Updating the UUID Field in Existing Invoice Type Documents on the A/P Side An overview of the process of updating the UUID field in existing purchasing documents is as follows: 1. The XML files representing electronic documents are generated by the SAP authority. Note o As a prerequisite, all XML files for relevant documents must exist in the database. o Each XML file represents one document. 2. Using a prepared query, the XML data are extracted and placed into a temporary table. Note o The temporary table identifies each relevant document existing in the database in order to update the UUID information. o Each table line represents one document. 3. A/P documents created during the transition period are identified and compared to the data in the temporary table as follows: o If the XML file matches the document created in the database, then the document type and document number are assigned to the relevant table line (the yellow column in the example below). o This identification and comparison between the XML files and the relevant documents in the database are based on unique parameters. o If more than one document in the database matches an XML file, then the user needs to manually identify which document is valid. 4. A bridge between the XML files and the documents in the database is created so the application can identify which UUID belongs to which document. Using the Data Transfer Workbench migration tool, users can then update the UUID information in each relevant document in the database using a batch run. 6 2014 SAP SE. All rights reserved. Updating the UUID Field in Existing Invoice Type Documents on the A/P Side
Process Visualization Updating the UUID Field in Existing Invoice Type Documents on the A/P Side 2014 SAP SE. All rights reserved. 7
4 Updating UUID in Existing Documents To update the UUID field in existing relevant documents, proceed as follows: 1. Open SQL Enterprise Manager and run the following query: BEGIN TRANSACTION SET QUOTED_IDENTIFIER ON SET ARITHABORT ON SET NUMERIC_ROUNDABORT OFF SET CONCAT_NULL_YIELDS_NULL ON SET ANSI_NULLS ON SET ANSI_PADDING ON SET ANSI_WARNINGS ON COMMIT BEGIN TRANSACTION GO CREATE TABLE dbo.ttst ( EntryNo int NOT NULL, CardName nvarchar(50) NULL, RFC nvarchar(50) NULL, DocTotal numeric(19, 6) NULL, DocDate nvarchar(50) NULL, UUID nvarchar(50) NULL ) ON [PRIMARY] GO ALTER TABLE dbo.ttst SET (LOCK_ESCALATION = TABLE) GO COMMIT Note This query creates a temporary TTST table which you can delete after you complete the entire procedure. 2. From the Start menu, choose Run and enter "cmd". 3. Open the path where XMLRead.exe is located and then enter the following parameters: FILE;[path where the xml files are stored] SERVER; [name and alias of the server] DATABASE; [name of the database where TTST table from Step 1 was created] 8 2014 SAP SE. All rights reserved. Updating UUID in Existing Documents
Note "FILE", "SERVER, and "DATABASE" are fixed string expressions. Example A user may enter the following parameters: XMLRead.exe FILE;C:\temp\ SERVER;BTSN60264814A\b1 DATABASE;PKO_MX_TEST 4. Press ENTER. The console reports that the process has been finished successfully. 5. Go to SQL Enterprise Manager and run the query below to select all invoices that match at least one record from the XML files: select DocEntry, DocNum, T1.CardName as xmlcardname, T0.Cardname, convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) as xmldate, convert(varchar(10),t0.docdate,10) as DocDate, T1.DocTotal as xmldoctotal, T0.DocTotal, T1.RFC, T0.LicTradNum, T1.UUID from OPCH T0 right outer join TTST T1 on T0.CardName = T1.CardName and T0.LicTradNum = T1.RFC and convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) = convert(varchar(10),t0.docdate,10) and T1.DocTotal = T0.DocTotal union all select DocEntry, DocNum, T1.CardName as xmlcardname, T0.Cardname, convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) as xmldate, convert(varchar(10),t0.docdate,10) as DocDate, T1.DocTotal as xmldoctotal, Updating UUID in Existing Documents 2014 SAP SE. All rights reserved. 9
T0.DocTotal, T1.RFC, T0.LicTradNum, T1.UUID from ORPC T0 right outer join TTST T1 on T0.CardName = T1.CardName and T0.LicTradNum = T1.RFC and convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) = convert(varchar(10),t0.docdate,10) and T1.DocTotal = T0.DocTotal 6. The query below helps you create an XML document for the DTW import: select '18' as ObjType, T0.DocEntry, T1.UUID from OPCH T0 right outer join TTST T1 on T0.CardName = T1.CardName and T0.LicTradNum = T1.RFC and convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) = convert(varchar(10),t0.docdate,10) and T1.DocTotal = T0.DocTotal where T0.CardName = T1.CardName and T0.LicTradNum = T1.RFC and T1.DocTotal = T0.DocTotal and convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) = convert(varchar(10),t0.docdate,10) union all select '19' as ObjType, T0.DocEntry, T1.UUID from ORPC T0 right outer join TTST T1 on T0.CardName = T1.CardName and T0.LicTradNum = T1.RFC and convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) = convert(varchar(10),t0.docdate,10) and T1.DocTotal = T0.DocTotal 10 2014 SAP SE. All rights reserved. Updating UUID in Existing Documents
where T0.CardName = T1.CardName and T0.LicTradNum = T1.RFC and T1.DocTotal = T0.DocTotal and convert(varchar(10),cast(replace(t1.docdate, 'T',' ') as datetime),10) = convert(varchar(10),t0.docdate,10) 7. Copy the results into Microsoft Excel and update the UDF_UUID field in existing A/P invoices either manually or through the Data Transfer Workbench. For more information, refer to the documentation related to DTW. Updating UUID in Existing Documents 2014 SAP SE. All rights reserved. 11
www.sap.com/contactsap Material Number 2014 SAP SE. All rights reserved. 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 ads, 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, xapps, xapp, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, 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 in several other countries all over the world. 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.