Top Banner
SAP Iberia SAFT-PT (EN) 12-Fev-2009 Page 1 SAFT-PT: Standard Audit File for Tax Purposes for Portugal RTXDART_PT Contents 1. Introduction ............................................................................................................................... 1 2. Overview .................................................................................................................................... 2 3. Product data determination for FI invoices ................................................................................. 3 4. Product data customizing for FI invoices ..................................................................................... 6 5. DART preparation ....................................................................................................................... 7 6. DART configuration (FTWP) ........................................................................................................ 8 7. Data Extract (FTW1A) ................................................................................................................. 9 8. Tax data customizing (transaction: PTDART_TAX) ..................................................................... 12 9. Create XML file ......................................................................................................................... 13 10. Optimize memory configuration ............................................................................................. 15 11. Splitting files........................................................................................................................... 15 12. Merge XML files with report RDART_FILE_MERGE .................................................................. 15 13. Recommendations for splitting extracts and merging files ...................................................... 16 14. How to fill specific fields with a user exit: ............................................................................... 17 15. Configure date fields in the DMEE tree ................................................................................... 19 16. Create a transaction for report RTXDART_PT and RDART_FILE_MERGE .................................. 19 1. Introduction According to Portaria nº 321-A/2007 of Portuguese legislation, published on March 26thby the Portuguese government, a new requirement became mandatory as of fiscal year 2008 for all companies that use computerized means to manage their accounting and billing procedures. This new obligation consists in producing a file, the so-called SAF-T-PT file, whenever required by the Tax Authorities for auditing purposes. This file contains the data from the Accounting and Billing systems. Considering the fact that companies use the most diverse systems for their data processing, which at the same time are subject to verification by Tax Authorities, it was found necessary to follow a norm in order to obtain the same data export independently from the source so that the auditor is not forced to acquire skills in various systems. The structure of the file is thus a standard to follow in all cases and is described in the Portaria. According to the legally required file format and content the XML file consists of the following sections:
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 1

SAFT-PT: Standard Audit File for Tax Purposes for PortugalRTXDART_PT

Contents1. Introduction ............................................................................................................................... 1

2. Overview .................................................................................................................................... 2

3. Product data determination for FI invoices ................................................................................. 3

4. Product data customizing for FI invoices ..................................................................................... 6

5. DART preparation ....................................................................................................................... 7

6. DART configuration (FTWP) ........................................................................................................ 8

7. Data Extract (FTW1A) ................................................................................................................. 9

8. Tax data customizing (transaction: PTDART_TAX) ..................................................................... 12

9. Create XML file ......................................................................................................................... 13

10. Optimize memory configuration ............................................................................................. 15

11. Splitting files ........................................................................................................................... 15

12. Merge XML files with report RDART_FILE_MERGE .................................................................. 15

13. Recommendations for splitting extracts and merging files ...................................................... 16

14. How to fill specific fields with a user exit: ............................................................................... 17

15. Configure date fields in the DMEE tree ................................................................................... 19

16. Create a transaction for report RTXDART_PT and RDART_FILE_MERGE .................................. 19

1. IntroductionAccording to Portaria nº 321-A/2007 of Portuguese legislation, published on March 26thby the Portuguesegovernment, a new requirement became mandatory as of fiscal year 2008 for all companies that usecomputerized means to manage their accounting and billing procedures. This new obligation consists inproducing a file, the so-called SAF-T-PT file, whenever required by the Tax Authorities for auditing purposes.

This file contains the data from the Accounting and Billing systems. Considering the fact that companies usethe most diverse systems for their data processing, which at the same time are subject to verification by TaxAuthorities, it was found necessary to follow a norm in order to obtain the same data export independentlyfrom the source so that the auditor is not forced to acquire skills in various systems. The structure of the fileis thus a standard to follow in all cases and is described in the Portaria.

According to the legally required file format and content the XML file consists of the following sections:

Page 2: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 2

Header File headerMasterFiles Master Data

General Ledger GL Accounts from legal Chart of AccountsCustomer Customers Master DataSupplier Vendors Master DataProduct Products/Services Master DataTax Table Tax Master Data

GeneralLedgerEntries Accounting documentsSourceDocuments: Source Documents

SalesInvoices Billing documents (from SD or FI)

Most of the data can be read directly from the system (DART Extract or Data Base Tables) to populate thefields in the XML file. However, some data has to be derived under specific conditions before being sent tothe file. Whenever this is the case it is explained in this document.The objective is to obtain one SAFT-PT XML file for one fiscal year containing all the relevant data.

The SAP Notes 1082823 and 1293083 provide the required functionality that enables SAP ERP users tocreate the SAF-T_PT file according to Portuguese Legislation - Portaria 321a/2007. Each one of the programsis suitable for different situations:

Note 1293083 refers to the program RSAFT_PT_XML. This program is suitable for all companycodes, from small to very large amount of data. You may produce a file for the data of a completeyear. Additional notes add corrections and should be implemented.

Note 1082823 refers to the program RTXDART_PT. This program is suitable only for company codeswith a small to medium amount of data (< 1Mio FI or SD documents per year; < 999 line items perSD document ; < 250.000 Customers / Vendors / Materials). Additional notes add corrections oradditional functionality and should be implemented as well. The notes are mentioned under“Related Notes”. For example note 1321746 adds functionality to RTXDART_PT for FI-invoices;these invoices are manually created invoices in FI or invoices created out of SAP Real Estate.

This Manual refers to Report RTXDART_PT and focuses particularly on the creation of the xml file for FIinvoices. Nevertheless, the user should be aware that he can use this report to create a SAFT file forMaster Data and SD invoices as well.

2. OverviewAll solutions work based on the same process:

Step 1: Produce a data extract in DART with the relevant data for single periods or for the completefiscal year;

Step 2: Run the XML conversion report (RTXDART_PT) to produce an XML file out of the data in theDART extract. This program will create a file in the legally required format.

Step 3: Merge the single XML files in case you create files for small subperiods instead of one forthe complete period as requested. Use program RDART_FILE_MERGE for this step. If you create afile for the complete year right away you will not need to execute this step.

Step 4: Download the file on your local PC with program RFASLDPC or get it directly from the server.

Page 3: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 3

3. Product data determination for FI invoicesSpecial attention has to be paid to the Product Data for FI invoices. This data is not stored in a specific database; it only exists in the document itself. Therefore it has to be derived from there to fill the specific fieldsin the file adequately. Besides, a system for the numbering of the products has to be defined.

Three different situations for the determination of the Product Data are identified:

1. For Real Estate FI invoice:o This type of FI invoice is identified by having the fields Contract Type (TZB0A-RANTYP)

and Flow Type (TZB0A-SBEWART) filled; the concatenation of these two fields shall betaken automatically as the Product Code; a number prefix can be added.

o The Materials Master Data Record (table MARA) or table SAFT_PT_FIMD shall be usedto store the relevant Product data for these documents and maintained accordingly.The user may choose between these two options: if Materials Master Record for MMor SD is already being used he may find it more practical to just add the informationhere. If that is not the case he may find it more practical to just maintain the tableSAFT_PT_FIMD which requires only the information for this particular purpose). Anumber prefix can be used to assure that the numbering of these entries in tableMARA is unique; this prefix is maintained in table PTSAFT_MATPRE.

o Customizing:Master Data Record (table MARA) or Table SAFT_PT_FIMDPTSAFT_MATPRE for number prefix (if required).

o Process:

Page 4: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 4

2. For FI manual invoice (non RE) with a clear identification of the Product based on GL account:o If the FI invoice does not fulfill the criteria for situation 1 then it is automatically

identified as an FI manual invoice. In this case the product can be identified accordingto the GL account range it is posted to. The product numbering is customized in tablePTSAFT_MATACCNT .

o The Materials Master Data Record (table MARA) or Table SAFT_PT_FIMD (if MARA isnot to be used for the same reason as explained under 1.) shall be used to store therelevant Product data for these documents and maintained accordingly. The productnumber shall be taken as customized in table PTSAFT_MATACCNT.

o Customizing:Master Data Record (table MARA) or Table SAFT_PT_FIMDPTSAFT_MATACCNT for Product numbering according to GL-Account.

o Process:

3. FI manual invoice (non RE) based on GL line item text:o This is an exceptional situation and is therefore treated as customer specific.

If the FI invoice does not fulfill the criteria for situation 1 and 2 then it is automaticallyidentified as an FI manual invoice whose product data will be identified according toGL line item text and GL account range. The program will call a user exit passing theLine Item Text and it will return the ProductCode; This is customized in a customerspecific table.

o The structure SAFTPT_PRODS shall be used to maintain the product master data asrequired for the Master Data in the xml file.

o This approach should be used only as an exception for documents that cannot becategorized easily as described in point 1 and 2.

o Customizing:User Exit FI-Invoices Case 1 (see chapter 14 in this document)User Exit FI-Invoices Case 2 (see chapter 14 in this document)User Exit FI-Invoices Case 3 (see chapter 14 in this document)

o Process:

Page 5: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 5

In terms of fields in the XML file it can be summarized as follows

FieldCode

XML Field Description Mandatory

SAP Solution in SAFTPT_FIMD

2.4.1. ProductType Indicator for product type; for FIinvoices it is generally related toa service.(Set “P” for products, “S” forservices and “O” for Others).

*

This is set as "S" by default;Fill the user exit for customer specific definition or maintainaccordingly in Material Master Data or SAFTPT_FIMD;

2.4.2. ProductCode Unique code to identify theproduct

*

For FI invoices from RE: read TXW_MAT;

For FI invoices where product is dependent on GL-Accnt: readTXW_MAT or SAFTPT_FIMD-PRODUCTCODE

For FI invoices where product corresponds to GL-line item textbased on GL-Accnt range: read structure SAFTPT_PRODS.

2.4.3. ProductGroup Product group

*

For FI invoices from RE: read TXW_MAT;

For FI invoices where product is dependent on GL-Account:read TXW_MAT or SAFTPT_FIMD;

For FI invoices where product corresponds to GL-line item textbased on GL-Account range: read structure SAFTPT_PRODS.

2.4.4. ProductDescription Product description

*

For FI invoices from RE: read TXW_MAT;

For FI invoices where product is dependent on GL-Account:read TXW_MAT or SAFTPT_FIMD;

For FI invoices where product corresponds to GL-line item textbased on GL-Account range: read structure SAFTPT_PRODS.

2.4.5. ProductNumberCode EAN Code. If not available fillfield with ProductCode (2.4.2.)

*

Equal ProductCode (2.4.2.)

Page 6: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 6

Field Code XML Field Description Mandatory SAP Solution4.1.4.10.3. ProductCode Product code derived

from the FI document* For FI invoices from RE: concatenate the fields TZB0A-

RANTYP and TZB0A-SBEWART to compose the productcode;

For FI invoices where product is dependent on GL-Account: read PTSAFT_MATACCNT and based on GL-Account find the Product Code.

For FI invoices where product corresponds to GL-lineitem text based on GL-Account range: read user exitand customer specific table and identify Product Codeaccording to GL line item text.

4.1.4.10.4. ProductDescription Product descriptionaccording to MasterData

* For FI invoices from RE: read TXW_MAT;

For FI invoices where product is dependent on GL-Account: read TXW_MAT or SAFTPT_FIMD;

For FI invoices where product corresponds to GL-lineitem text based on GL-Account range: read user exitand customer specific table and identifyProductDescription according to GL line item text.

4.1.4.10.5. Quantity Quantity * per default = 1

4.1.4.10.6. UnitOfMeasure Unit of measure N/A

4. Product data customizing for FI invoicesNew data has to be maintained in order to obtain what is described under point 3:

Material Master DataMaintain Material Master Record for Products in FI invoices: maintain at least these fields inthe Material Master Data. This data will be taken from the DART-Extract to the XML file.

Field Name MeaningMANDT ClientBUKRS Company code

MATNR Product number

MATNAME Product description

MATGROUP Product group

PTSAFT_MATPRE (optional)Define Product Number Prefix: As Material Master Data records are created for REServices/Products with numbering taken from the concatenation of TZB0A-RANTYP and TZB0A-SBEWART, number prefixes may have to be defined to avoid duplicated Material Number.

Field Name MeaningMANDT Client

BUKRS Company code

MAT_PREFIX Product number prefix for RE invoices

PTSAFT_MATACCNTDefine Product Number depending on GL-Account: where there is a clear relationship betweenthe GL account and the service/product from the invoice the product data can be definedbased on the GL Account

Field Name MeaningMANDT Client

BUKRS Company code

GLACCOUNT General ledger account

MATNR Product number

Page 7: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 7

SAFTPT_FIMDMaintain Product Master Data: this can be used whenever the Material Master Data is notsuitable: this table is only used to read Master Data for the XML file; so whatever is maintainedin this table will be transferred to the xml file.

Field Name MeaningMANDT Client

COMPANY_CODE Company codeGLACCOUNTFROM From General ledger account

GLACCOUNTTO To General ledger account

PRODUCTCODE Product numberPRODUCTTYPE Product type

PRODUCTGROUP Product group

PROD_DESCRIPTION Product description

SAFTPT_PRODSThis is filled at runtime for line item text based Product data using User Exit Case 2. This willprovide the Product Master Data for this kind of invoices.

Field Name MeaningMATNR Product number

MTREF Product type

CNAME1 Product groupMAKTX Product description

EAN11 EAN11 code

5. DART preparation

a) Check DART version: proceed as follows:for 4.6C release:(1) SE11 -> Utilities-> Other Dictionary objects(2) insert DART1 in Type Group(3) click on display

for releases > 4.6C:(1) SE12 -> Select radio button "Type Group"(2) -> Enter DART1(3) -> Click on "Display" or "F7"; under section of constants you can find: CONSTANTS: dart1_rl

LIKE txw_c_v0-dart_rl VALUE '2.5'.This indicates the DART version.

Please note that the minimal requirement is DART version 2.4. If this is not the case in your systemplease carry out the upgrade of the DART tool first. Please refer to the relevant SAP Notes (componentCA-GTF-DRT) and make also sure that error correction notes related to DART are implemented. (Pleasecheck OSS note 945615 for some more details on DART tool).To upgrade DART release from 2.3 to 2.4, refer the note: 810014This note has correction instruction and also SAR files (in the note attachment);Implement both correction instruction and the SAR file.

b) Assign the DART data volume to your company codeExecute transaction SM30;specify “TXW_C_BUKRS”;Assign the data volume “ALL” to the company code.

Page 8: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 8

6. DART configuration (FTWP)For a complete understanding of the DART tool please check also the respective Online Documentation.Only the most relevant steps for producing the SAFT-PT file are explained here

a) Make the following configuration of DART in tab Data Extraction:here you define the items that shall appear on the selection screen of the data extract program orthe parameters that influence the extract. When running the program you can still select orunselect the options.Select at least the following items:

Go to tab Transaction Data

Go to tab Master DataCheck the selection check box “Enable master data segment selection”; this activates the fieldson the selection screen when running the data extract enabling you to make the selectionwhen running the extract.

Go to tab Technical SettingsMake sure that the technical settings are adequately defined according to your systemenvironment. The figures shown here are only examples and may not be the best configurationfor your system

Page 9: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 9

The limitation of data volume may be convenient for testing purposes and you can select orunselect it later on the selection screen.

b) File Directories:Create the file directories where to locate the data extractGo to Details to define Directory Set, Directory Set Description, the file location;you may receive an error message XW163: “…file name is limited to ‘n’ digits…“. This is anOperating System issue. Proceed as follows: SM30, enter “V_FILESYS” and press “maintain”.Here you can define more digits for the respective operating system.Click “Create”

7. Data Extract (FTW1A)

Create a data extract:a) Specify the following parameters to run the data extract according to customer specific

environment:General

Company CodeFiscal YearPosting Period (optional)Maximum number of documents (optional)

Transaction DataChoose the items you want to extract:

Finance Documents (FI)

1. Master data segmentsIn order to select only the master data that is needed in the extract according to therequirement it is sufficient to select the following items:

TXW_BSEC One-Time Account One-time-Customers/Vendors

TXW_COMPC Company code master (mandatory)Company Code master data(selected by default)

TXW_CUST_E1 Customer master Customer Master DataTXW_GLACC G/L account master GL accounts Master DataTXW_LFAS Vendor master Vendor Customer MasterTXW_MAT Material master Materials Customer Master

Page 10: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 10

TXW_PLANT Plant master Plant Customer MasterTXW_VENDOR Vendor master Vendor Customer Master

Select radio button “Select all” and then press button “Select individual master data segments”in order to restrict the selection.

Data fileData file name (any user defined file name)Directory set (defined previously using FTWP)

After executing the extract use transaction FTWF to browse the file extract.

Page 11: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 11

Note: To obtain the following section of the Audit File you need to select the following data sourceitems:

Audit File Section Data source

FTW1A – DART segment(s); Selectionscreen fields

RSAFT_FIRE

Audit File Is created automatically whenrunning RTXDART_PT

Header DART segment:TXW_COMPC

Selection Screen fields:Company IDTax Accounting BasisHeader Comment

MasterFiles

General Ledger DART segment:TXW_GLACC

Customer DART segment:TXW_CUST_E1

To include One-time-Customers: Selection Screen field:Finance documents (FI)

DART segment:TXW_BSEC

Supplier DART segment:TXW_LFASTXW_VENDOR

To include One-time-Vendors: Selection Screen field:Finance documents (FI)

DART segment:TXW_BSEC

Product DART segment:TXW_MATTXW_PLANT

Tax Table Table:PTDART_TAX_DATA

GeneralLedgerEntries Selection Screen field:Finance documents (FI)

DART segment:TXW_BSEC

Page 12: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 12

Audit File Section Data source

FTW1A – DART segment(s); Selectionscreen fields

RSAFT_FIRE

SourceDocumentsTo include FI-invoices:

To include SD-invoices:

Selection Screen field:Finance documents (FI)

Sales documents (SD)Delivery documents (SD)Billing Documents (SD)

DART segment:TXW_PLANTTXW_CUST_E1TXW_LFAS

8. Tax data customizing (transaction: PTDART_TAX)

According to the mandatory file structure the tax codes master data (Tax Table) shall include tax codeinformation which does not exist in the system. In order to be able to reflect this tax data in the fileaccording to the legal requirement a new table - PTDART_TAX_DATA - is used to maintain the data asrequired for all tax codes, such as:

The fields in table PTDART_TAX_DATA have the following meaning:

Field Content SAFT fieldTx Tax code -Tax type define whether the tax code refers to VAT (IVA) or to

Stamp Tax (imposto de selo) (IS)-

Tax Descr Define to which region the tax code refers to(concatenated with tax type: IVACON for ‘Continente’;IVARAA for ‘Região Autónoma dos Açores’; IVARAM for‘Região Autónoma da Madeira’; IS for Stamp Tax;

Description

Tax C. Det. Code for tax rate type: 1 – Intermédia (Intermediate); 2– Normal; 3 – Reduzida (Reduced); 4 – Isenta(Exempted); 5 – Outras (Others);

TaxCode

Description Full text for tax rate type: Normal; Intermédio;Reduzida; Isenta

Description

Condition rate Tax percentage TaxPercentage

Run the transaction PTDART_TAX; Press the button ‘Maintain’.

Click the button ‘New Entries’ and specify the values for all the fields and save the entries.

Example:

Page 13: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 13

Tx Tax type Tax Descr Tax C. Det. Description Condition rateAB IVA IVACON 1 Intermédia 12AB IVA IVARAA 2 Normal 20AC IVA IVARAM 3 Reduzida 5AD IVA IVACON 4 Isenta 0AF IVA IVACON 5 Outras n/aS1 IS IS 4 Cheques de

qualquernatureza…

1

9. Create XML file

After creating the extract(s) of the data you want to report in the xml file you have to run a report toproduce the xml file(s) in the requested structure.If you have created several extracts you will have to create the same number of XML files. In the end youobtain the complete file for one fiscal year by merging them into one final file.

To create an xml file, according to the XSD requested by Portuguese Tax Law proceed as follows:

1. Create XML file: program RSAFT_FIRE:

a. Execute transaction SA38 for report RSAFT_FIRE or follow the menu path: Accounting ->Financial Accounting -> General Ledger -> Reporting -> Tax Reports -> Portugal -> DART: createXML file (Portugal) (report: RSAFT_FIRE).

b. Selection fields in RSAFT_FIRE

Page 14: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 14

Field name MeaningData extract data

Data file name The extract for which you want to create the xml fileDirectory set Where the extract files are storedMaster Data Extract File The extract file that contains the relevant master data; fill only in case

it is not included in the data file (first field) itself. Please consider thedetails explained under point 9 and the recommendations given.Please keep in mind that when creating the XML file for Billingdocuments you need to indicate the correspondent Master Dataextract in order to obtain a complete file as some of the required datais taken from the Master Data tables (e.g. Addresses). This is onlynecessary in case the master data is in a separate extract.

Company specific dataCompany Code The company code for which you created the extract and want to

create the xml file.Fiscal year The fiscal year for which you created the extract and want to create

the xml file.Plants The relevant plants for the company code to which you want to limit

the Materials Master DataLedger Select the Ledger

Legal chart of accountsPrimary Chart of Account Check this radio button if your Portuguese Chart of Accounts

is the main Chart of Accounts in your Company Code MasterData (KTOPL)

Country Chart of Accounts check this radio button if your Portuguese Chart of Accountsis Check parallel Chart of Accounts in your Company CodeMaster Data (KTOP2)

XML file dataCompany ID Field ‘CompanyID’ in File Header: Registration Number of the

companyTax Accounting Base Field ‘TaxAccountingBasis’ in File Header: Specify for which data you

are creating the file: financial data, or billing data, or integrated data:Contabilidade or Facturação or Integrado – Contabilidade eFacturação

Header Comment Field ‘HeaderComment‘ in File Header: fill with you own free textFile Name File name of the target xml file you want to create

Invoice selectionFI invoices Check this box if you have FI invoicesDocument types Specify the document type(s) for the FI invoices; only FI documents

with this document type will be selected as invoices.Line item selection for documentsDoc.types shown with GL Select the document type of the FI invoices for which you

want to show the GL lines in the file; this is the defaultconfiguration of the report

Doc.types shown with BP Select the document type of the FI invoices for which youwant to show the Business Partner lines in the file;

SD Billing documents Check this box if you have SD invoices

c. Execute: to execute in online mode press Enter or F8. You can also run the report in background.This is recommended if you are processing a huge amount of data.When the execution of the report is finished you will receive a success message.

2. Obtain the XML: use program RFASLDPC or from the server.

a. The XML file can be downloaded with the program RFASLDPC or it can be fetched directly fromthe server (if you have a Unicode system you have to convert the file to ANSI format locally).

b. When running RFASLDPC specify “File type” as **.

Page 15: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 15

10. Optimize memory configurationIn some situations, especially on 32bit platforms or/and with a huge data volume this procedure may beextremely memory consuming and problems may arise to complete the program execution. Please refer tonotes 353579 and 552209 for further suggestions on how to enhance system and OS settings for bettermemory conditions when producing the SAF-T file on 32 bit systems. If necessary avoid running otherprocesses at the same time.

11. Splitting filesIf you have memory problems due to very huge data volume, or you want to distribute the tasks of creatingthe SAFT-PT file over the year you may follow the approach of creating several files and merge these to oneSAFT-PT file at the end.In such cases proceed as described here:

Step 1: split the data extraction of one fiscal year into small units such as per quarters, or periods or youmay even split into GL documents, SD documents and Master Data.Step 2: create one XML file for each of these extracts.Step 3: Join all single XML files to one file in the correct format for the whole data of one year.

12. Merge XML files with report RDART_FILE_MERGE

If you create several xml files each with a data subset from the relevant fiscal year, you will have to mergethem to one file after creating all the subset XML files.

1. Merge XML files: program RDART_FILE_MERGE

a. Selection screen fields for RDART_FILE_MERGE:

File name press the arrow button beside this field to enter all thefiles you want to merge

Master Data file indicate the xml file which contains the master data. Allother files will be merged into this file.

XML files indicate the name of the target xml file

Page 16: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 16

b. Execute the report. Once the file is created you will receive a success message.

2. Obtain XML file: program RFASLDPC or from the serverThe XML file can be downloaded with the program RFASLDPC or it can be fetched directly from theserver.

13. Recommendations for splitting extracts and merging filesThis step in the process is normally not needed, as you can generate the file for the whole year in oneprogram execution. However, in case you want to create the files period by period you need to merge themin the end to one single file for a whole fiscal year. In this case you need to take the following aspects intoconsideration:

- Some Billing documents fields in the XML file (ship-to and bill-to addresses) may be filled withinformation from the Customer and Vendor Master Records.

- Customer and Vendor master data are complemented with data from FI documents (One-time-customers/vendors).

- Though Master Data are not as time dependent as transactional data they can change during the year.

Thus, it is necessary to create specific extracts or xml files simultaneously so that the data is complete. Thefollowing matrix gives a step by step instruction on how to proceed to create one file in one execution andin a splitting files scenario. This is only a recommendation. The example below considers only the splittingof the Billing documents in periods. However, the same can be done for the Accounting documents as well.

Page 17: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 17

14. How to fill specific fields with a user exit:

For some fields it is necessary to define the filling procedure with a user exit. This is the case when you needto influence the output in the respective fields in a different way than defined by SAP standard.Name : PT_USER_EXIT_DART.Purpose : To fill up the following fields of XML file. Customers can indicate their own rule where to find orhow to fill the correct content for the above fields.

Field in xmlfile

Xml structure Field according toPort.321a/2007

ProductType Masterfiles Product ProductType 2.4.1.Description GeneralLedgerEntries Journal Transaction Description 3.4.3.5.Invoice Type SalesInvoices Invoice InvoiceType 4.1.4.4.

Proceed as described here:

Page 18: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 18

1. Transaction to edit the source code of the user exit: SE37

2. Structure :

Import Parameters:WA_MASTER TYPE PTDART_ITEMSTRANSACTION_TYPE TYPE I.

Export Parameters:PRODUCT_TYPE TYPE MTREF

TDGL_DESC TYPE BKTXTINVOICE_TYPE TYPE BKTXT

Note: From the report key fields will be sent to the above user exit and transaction also the transactiontype.

Work area wa_master will contain the key fields, For TRANSACTION_TYPE = 1.Wa_master will contain values for ProductCode and ProductGroup.User has to fill the value for variable PRODUCT_TYPE based on above 2 fields

For TRANSACTION_TYPE = 2.Wa_master will contain the key fields JOURNAL_ID, TransactionID and also other related to thedocument header and the line item (RecordID, AccountID ).

User has to fill the value for variable TDGL_DESC based on the key fields present in the work areawa_master.

For TRANSACTION_TYPE = 3.Wa_master will contain the key fields InvoiceNo, LineNumber and also other related to the documentheader and the line item

User has to fill the value for variable INVOICE_TYPE based on the key fields present in the work areawa_master.

Depending on the TRANSACTION_TYPE (report will pass the value while calling the user exit), respectiveexport parameters can be filled using the work are wa_master.

FI Invoices – User exit details

Case 1: * 4.1.4.10.3 / 4.1.4.10.4 CALL FUNCTION 'ZPT_USER_EXIT_DART' EXPORTING wa_master = wa_master transaction_type = '1' IMPORTING prod_code = wa_master-sd_matnr

Case 2 : SAFT_PTPRODS . Master data creation.

Case 3: product based on line item text / other cases. CALL FUNCTION 'ZPT_USER_EXIT_DART' EXPORTING WA_MASTER = wa_master TRANSACTION_TYPE = '5' IMPORTING PROD_CODE = wa_master-sd_matnr PROD_DESCRIPTION = prod_desc TABLES IT_EXPREPROD = IT_EXPREPROD.

Page 19: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 19

Case . 4 : Prefix – Invoice YYYY/0CALL FUNCTION 'ZPT_USER_EXIT_DART' EXPORTING WA_MASTER = wa_master TRANSACTION_TYPE = '4' IMPORTING PROD_DESCRIPTION = prod_desc TABLES IT_EXPREPROD = IT_EXPREPROD.

15. Configure date fields in the DMEE tree

After uploading DMEE trees please check mapping procedure for all the date fields of the XML file. Theformat of these fields may not correspond to the legally required and shall be changed according to theinstructions in the respective notes.For releases R/3 Enterprise and higher please follow the instructions in SAP note 1268403;For release 4.6C check SAP Notes 1142934 and 1161775.

16. Create a transaction for report RTXDART_PT andRDART_FILE_MERGE

In order to have a direct access to the reports RTXDART_PT and RDART_FILE_MERGE you may want tocreate a transaction. In that case please proceed as explained below in on example to create it manually inyour system. You can also install it via an upcoming Support Package. Proceed the same way for each of thereports.

Step 1:Go to transaction SE80 and open the report RDART_FILE_MERGE.Follow the menu path (right click on the report): Report Create Transaction.

Step 2:You will see the following screen; proceed as follows:

Specify Transaction code e.g. ‘safpt_merge’ (you can specify your own name for this)Specify Short text, e.g. ‘Dart PT: XML file merge report’ (you can specify your own name for this)Select radio button : ‘Program and selection screen’ (report transaction)

Page 20: saft

SAP Iberia SAFT-PT (EN) 12-Fev-2009

Page 20

Step 3:System will show the following screen. Proceed as follows:

Specify Program : RDART_FILE_MERGE

Select all ‘GUI support’ parameters

Save the transaction.

Specify package as ‘ID-FI’.