You are on page 1of 11

CFDI Payslip XML Extract (Mexico): How to Create a Custom

Template and Add Custom XML Code

An Oracle E-Business Suite White Paper


April 2015
Copyright 2014, 2015 Oracle. All rights reserved.

This document was prepared to assist the customer in the use of Oracle HRMS. Its contents may not be used for
any other purpose without written permission. The material contained herein is supplied without representation
or warranty of any kind including any implied warranties or merchantability. Oracle Corporation assumes no
responsibility and shall have no liability of any kind from the supply or use of this document and the material it
contains.

This publication could include technical inaccuracies or typographical errors. Changes are periodically made to
the information herein; these changes will be incorporated in new editions of the publication.

These are licensed materials for internal and customer use only, all rights reserved, including the right to
photocopy, reproduce, translate, or make other reproductions of this document or any part thereof.

All other products or company names are used for identification purposes only, and may be trademarks of their
respective owners.

Page 2
Contents

CFDI Payslip XML Extract (Mexico): How to Create a Custom Template and Add Custom XML Code .. 1

Introduction .......................................................................................................................................................... 4

Creating a Custom Template ............................................................................................................................... 5

Sample Templates ................................................................................................................................................. 6

Adding Custom XML Code for the CFDI Payslip ........................................................................................... 11

Page 3
Introduction
Effective 2014, the CFDI employer must send the payroll payslips (XML format) to SAT to
get CFDI stamp. To implement this feature, Oracle HRMS Development team (Mexico
Localization) has developed new process to generate Payslip information in XML format
based on the requirements. The new CFDI XML Interface has been developed using BI
Publisher Template approach, the process first creates an internal base XML and merges with
XSL Template and produces the final XML as per the requirements. Using the Template
approach, customers can themselves customize the template if they require to change the
XML Layout or to change the default values, which are currently hard coded in the XML
according to their needs.

This document outlines the procedure to be followed to create and register Custom Template
for CFDI Payroll Payslip XML Interface. The CFDI XML Payslip functionality also provides
the ability to add Custom XML code.

Page 4
Creating a Custom Template

1. Creating the custom template

Download a copy of the seeded template (Mexico XML Payslip Template), make the required
changes and save it as a custom template. You must not update the seeded template definition
directly.
Navigation : XML Publisher Responsibility > Home > Template

Following attachment is the sample XSLT document and the highlighted text in red box are
the custom edits.

Screenshot: Custom Changes

In the above example, the Root tags of the XML have been modified from
PAYSLIP_REPORT to CFDI_REPORT and hard coded value of description attribute at
cfdi:Concepto tag has been changed from Pago de nomina to Prima vacacional
Below are the links for complete xsl template files which are used in the example

Page 5
Sample Templates

Following sample XSLT templates are available as attachments with this note (Doc ID:
1675858.1). Please download them from My Oracle Support.
Sample Seeded Template: PAYMXXMLPYSLP_Seeded.xsl
Sample Custom Template: CUSMXXMLPYSLP_Custom.xsl
Note:
1. Be cautious about the XML levels while creating the custom template.
2. The text under the braces {} refers to base xml XML nodes(including path).
3. The text which does not start with braces are hard coded values.

2. Register the Custom Template with the Corresponding Payroll Report:

In order to register the template, it is necessary to know the concurrent program short names
and data definition for each report. The following table provides the necessary information for
CFDI Payroll Payslip XML Interface.

CONCURRENT
REPORT DATA DEFINITION
PROGRAM SHORT NAME
CFDI Payroll Payslip XML Mexico XML Payslip Data
PYMXXMLPSLP
Interface Definition

To find the seeded data definition, perform the following steps:


a. Switch to the XML Publisher Administrator responsibility.
b. Click Data Definition.
c. Enter the concurrent program short name in the Code field.
d. Click Go.
To register the custom template, complete the following steps:
i. Step 1: Create the new template definition.
ii. Step 2: Group the Related Templates.
iii. Step 3: Register the new template with the corresponding report.

Page 6
Step 1: Create the new template definition:
a. Switch to the XML Publisher Administrator responsibility.
b. Navigate to Templates > Create Template.
c. Populate the following fields:
i. Name: Enter an appropriate name (less than 50 Characters). For example,
Custom Template for XML Payslip.
ii. Code: Enter the code such as %XML in all caps to indicate that this
template will be used for generating the XML file. For example,
CUSMXPSLPXML
iii. Application: Select Payroll.
iv. Data Definition: Select the applicable Data Definition corresponding to
your report as referenced above. Choose Mexico XML Payslip Data
Definition for Mexico XML Payslip.
v. Type: Select XSL-XML.
vi. Start Date: Enter a date prior to todays date.
vii. Sub template: Select No.
viii. Description: Enter any description of your choice (less than 50 characters).
ix. File: Browse to select the desired template file created in part 1. Make sure
this file is renamed before selecting it so that it matches the template code.
For example, CUSMXPSLPXML.xsl
x. Language: Select English.
xi. Territory: Select the applicable legislation: Mexico.
xii. Translatable: It is not required to check this box.
xiii. Click on Apply to save you changes.
Screenshot: View Template: Custom XML Payslip Template Page

Page 7
Step 2: Group the Related Templates:
The template created in Step 1 now needs to be grouped so that the template is available for
selection when registering with the corresponding concurrent program.
a. Switch to the Application Developer responsibility.
b. Navigate to Application > Lookups > Common.
c. Enter the following fields to create the lookup group:
i. Type: Enter an appropriate name. The name should be in the format
%<legislation code>%<concurrent program short name>%. This format is
mandatory. For example, NOMINA_MX_PYMXXMLPSLP_CUST
ii. Meaning: Enter an appropriate name (less than 50 characters). This name
will be used for displaying the Template Groups available for selection
when running the report. For example, Custom Template for CFDI Payslip
iii. Application: Select Payroll.
iv. Code: Enter the template code used in Step 1. For example,
CUSMXPSLPXML
v. Meaning: Enter the same template code.
vi. From: Enter a date prior to todays date.
vii. Save the record.
Screenshot: Sample Lookup

Page 8
Step 3: Register the new template with the corresponding report:
Once the template grouping is complete, the custom template needs to be registered with the
applicable concurrent program so that it is available for selection when submitting the report.
a. Switch to the Mexico HRMS Manager/ (or applicable custom) responsibility.
b. Navigate To Processes and Reports > Submit Processes and Report > Single Request.
c. Run the process Register BI Publisher Templates for Payroll.
d. Enter the parameters as follows:
i. Payroll Process Name: Select the process for which the custom template
must be registered. For example, CFDI Payroll Payslip XML Extract.
ii. Template Group: Select the template group created in Step 2. For example,
Custom Template for CFDI Payslip.
e. Click OK and submit the request.
Screenshot: Sample Submission

Once the process has successfully completed, the custom template will be available for
selection when submitting the report CFDI Payroll Payslip XML Interface parameter CFDI
Payslip Style.

Page 9
3. Run the Report Using the Custom Template:

So far, a custom template has been created to add the additional custom changes as per the
requirement. This template group has been created and registered with the corresponding
concurrent program so that it is now available for selection when submitting the report.
When submitting the report, select the template group from the list of values. (For CFDI
Payroll Payslip XML Interface the parameter CFDI Payslip Style shows the Custom
Template Group.

Screenshot: Selecting a custom template for the CFDI Payroll Payslip XML Interface

Page 10
Adding Custom XML Code to the CFDI Payslip
The CFDI XML Payslip functionality provides the ability to add Custom XML code.
Follow these steps to add custom XML to the existing XML data:

1. Create a custom procedure:


The custom code should be written in a package procedure with the following input parameters, in the
same order, to fetch the required additional data elements.
a. Action Context ID
b. Action Information Category
c. Document Type

Example:
Package.Procedure = pay_custom_rules.add_custom_xml
------------------------------------------------------
PACKAGE pay_custom_rules AS

PROCEDURE add_custom_xml(p_assignment_action_id number,


p_action_information_category varchar2,
p_document_type varchar2);
END pay_custom_rules;
------------------------------------------------------
2. Add Package Procedure to the Lookup:
The custom procedure mentioned in step 1 must be defined in the lookup type
PAY_CUSTOM_XML_CODE in order to be available during processing.
Add custom procedure in the description section of the lookup code MX_CFDI_PAYSLIP. The
detailed steps are:
a. Switch to the Application Developer responsibility.
b. Navigate to Application > Lookups > Common.
c. Search for lookup type PAY_CUSTOM_XML_CODE and enter the custom procedure
defined in step 1 in the format <package_name> .<procedure_name> under Description
for the corresponding lookup code 'MX_CFDI_PAYSLIP' and save.
Example: pay_custom_rules.add_custom_xml
3. Run the CFDI Payroll Payslip XML Extract concurrent process and check the base XML file
generated and you can find the custom XML tags with data which was created in the package.

Page 11

You might also like