Go to primary content
Oracle® Retail Fiscal Management/RMS Brazil Localization Implementation Guide
Release 14.1.3.1
E91382-02
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

13 Understanding Batch Processes

The batch overview provided in this chapter identifies the functional area description with the batch processes illustrated in the designs. This overview allows you to determine how a business function works behind the scenes. Batch designs describe how, on a technical level, an individual batch module works and the database tables that it affects. In addition, batch designs contain file layout information that is associated with the batch process.

This chapter covers the following topics:

TaxWeb Tax Rules Integration Batch

The RMS application provides integration with an external tax solution specific to the Brazilian market. The integration involves RMS, ORFM, RTIL, and a tax engine provided by the TaxWeb Tax Rules. Two batch programs have been introduced to facilitate the data transfer between applications.

Batch Design Summary

The following batch designs are included in this functional area:

  • L10nbr_taxweb_fisdnld.pc (Fiscal Download)

  • L10nbrfreclsprg (Fiscal Reclassification Purge)

L10nbr_taxweb_fiscnld (Fiscal Download)

Use this batch program to facilitate the download of fiscal attributes from the external tax engine.

Functional Area

TaxWeb Tax Rules Integration

Module Affected

l10nbr_taxweb_fisdnld.pc

Design Overview

This batch downloads the fiscal attributes from the external tax engine. The attribute can be passed as an input parameter to the program. The attribute is the key to be downloaded from the tax engine and it can be passed as input parameter to the program. No parameter is required, if the user wants to download all the fiscal attributes. The cutoff date to download the data from TaxWeb Tax Rules is fetched from FISCAL_ATTR_UPDATE table.

The majority of the work is done in the L10N_BR_T_FND_SQL package. Depending on the attribute requested to download the corresponding function in the package is invoked. An exception is codes/attributes for the nature of operation (NOP). The NOP download function is contained in the FM_UTILIZATION_SQL package. The list of package function calls mapped to the attributes are as follows:

  • NCM – L10N_BR_T_FND_SQL.MERG_INTO_NCM_CODES

  • MASSERV – L10N_BR_T_FND_SQL.MERG_INTO_MASSERV

  • FEDSERV – L10N_BR_T_FND_SQL.MERG_INTO_FEDSERV

  • NCMCARAC – L10N_BR_T_FND_SQL.MERG_INTO_NCM_CHAR_CODES

  • NCMPAUTA – L10N_BR_T_FND_SQL.MERG_INTO_NCM_PAUTA_CODES

  • NCMIPI – L10N_BR_T_FND_SQL.MERG_INTO_NCM_IPI_CODES

  • CNAE – L10N_BR_T_FND_SQL.MERG_INTO_CNAE_CODES

  • NOP – FM_UTILIZATION_SQL.P_CREATE_FM_NOP

  • CEST - L10N_BR_T_FND_SQL

  • MERG_INTO_NCM_CEST_CODES

The L10N_BR_T_FISCAL_FDN_QUERY_SQL and FM_UTILIZATION_SQL both call the fiscal foundation query package (L10N_BR_T_FISCAL_FDN_QUERY_SQL) which invoke RTIL to retrieve the requested fiscal attributes from the TaxWeb Tax Rules.

If any fiscal attributes are returned, they will be loaded (merged) to the corresponding table for that fiscal attribute. The tables loaded per attribute are as follows:

  • NCM_CODES with NCM codes

  • NCM_CHAR_CODES with NCM Characteristics codes

  • NCM_IPI_CODES with EX-IPI codes

  • NCM_PAUTA_CODES with the NCM Pauta codes

  • FEDERAL_SERVICE_CODES with the Federal service codes

  • L10N_BR_UNIFIED_SVC_CODES with TaxWeb Tax Rules specific codes

  • CNAE_CODES with the CNAE codes

  • CEST with the CEST codes

Finally, the LAST_UPD_DATE in the FISCAL_ATTRIB_UPDATES tables are updated to the current VDATE for the corresponding attributes once the data is loaded.

Scheduling Constraints

Table 13-1 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

This program can run in ad-hoc basis whenever the new fiscal attributes needs to be downloaded from the TaxWeb Tax Rules.

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-2 Tables Affected

Tables Select Insert Update Delete

L10N_BR_NCM_CODES

Yes

Yes

Yes

No

L10N_BR_NCM_CHAR_CODES

Yes

Yes

Yes

No

L10N_BR_NCM_PAUTA_CODES

Yes

Yes

Yes

No

L10N_BR_FEDERAL_SVC_CODES

Yes

Yes

Yes

No

L10N_BR_UNIFIED_SVC_CODES

Yes

Yes

Yes

No

L10N_BR_CNAE_CODES

Yes

Yes

Yes

No

FISCAL_ATTRIB_UPDATES

Yes

Yes

No

No

L10N_BR_T_TAX_CALL_STAGE_FSC_FDN

Yes

Yes

No

Yes

L10N_BR_T_TAX_CALL_STAGE_ROUTE

Yes

Yes

No

Yes

RETAIL_SERVICE_REPORT_URL

Yes

No

No

No

L10N_BR_T_TAX_CALL_RES_FSC_CNT

No

Yes

No

Yes

L10N_BR_T_TAX_CALL_RES_FSC_FND

Yes

Yes

No

Yes

FM_NOP

No

Yes

Yes

No

L10N_BR_NCM_IPI_CODES

Yes

Yes

Yes

No

L10N_BR_NCM_CEST_CODES

Yes

Yes

Yes

No


I/O Specification

Not applicable

L10nbrfreclsprg (Fiscal Reclassification Purge)

Use this batch program to clear the database tables.

Functional Area

TaxWeb/Synchro Integration

Module Affected

L10NBRFRECLSPRG.PC

Design Overview

This batch purges the processed reclassification data from L10N_BR_FISCAL_RECLASS table. The records to be purged are based on its processed_date or active_date less than the current vdate along with the status.

Scheduling Constraints

Table 13-3 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

This program can run after the successful completion of the following scripts:

  • l10n_br_fiscal_reclass_item_setup_retail.ksh

  • l10n_br_fiscal_reclass_item_process_retail.ksh

  • l10n_br_fiscal_reclass_item_finish_retail.ksh

Pre-Processing

  • l10n_br_fiscal_reclass_item_setup_retail.ksh

  • l10n_br_fiscal_reclass_item_process_retail.ksh

  • l10n_br_fiscal_reclass_item_finish_retail.ksh

Post-Processing

Not applicable

Threading Scheme

Threading based on reclassification ID.


Restart/Recovery

Not applicable

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-4 Tables Affected

Tables Select Insert Update Delete

L10N_BR_FISCAL_RECLASS

Yes

No

No

Yes

PERIOD

Yes

No

No

No

L10N_BR_FISCAL_RECLASS_NV

Yes

No

No

Yes


I/O Specification

Not applicable

Synchro Tax Engine Integration Batch

The RMS application provides integration with an external tax solution specific to the Brazilian market. The integration involves RMS, ORFM, and a tax engine provided by Synchro. Two batch programs have been introduced to facilitate the data transfer between applications.


Note:

ORFM Release 14.1.3 does not support Synchro tax engine integration.

Batch Design Summary

The following batch designs are included in this functional area:

  • L10nbr_synchro_fisdnld.pc (Fiscal Download)

  • L10nbrfreclsprg (Fiscal Reclassification Purge)

L10nbr_synchro_fiscnld (Fiscal Download)

Use this batch program to facilitate the download of fiscal attributes from the external tax engine.

Functional Area

Synchro Integration

Module Affected

l10nbr_synchro_fisdnld.pc

Design Overview

This batch downloads the fiscal attributes from the external tax engine. The attribute can be passed as an input parameter to the program. The attribute is the key to be downloaded from the tax engine and it can be passed as input parameter to the program. No parameter is required, if the user wants to download all the fiscal attributes. The cutoff date to download the data from Synchro is fetched from FISCAL_ATTR_UPDATE table.

The majority of the work is done in the L10N_BR_S_FND_SQL package. Depending on the attribute requested to download the corresponding function in the package is invoked. An exception is codes/attributes for the nature of operation (NOP). The list of package function calls mapped to the attributes are as follows:

  • NCM – L10N_BR_S_FND_SQL.MERG_INTO_NCM_CODES

  • UNISERV – L10N_BR_S_FND_SQL.MERG_INTO_UNISERV

  • FEDSERV – L10N_BR_S_FND_SQL.MERG_INTO_FEDSERV

  • NCMCARAC – L10N_BR_S_FND_SQL.MERG_INTO_NCM_CHAR_CODES

  • NCMPAUTA – L10N_BR_S_FND_SQL.MERG_INTO_NCM_PAUTA_CODES

  • NCMIPI – L10N_BR_S_FND_SQL.MERG_INTO_NCM_IPI_CODES

  • CNAE – L10N_BR_S_FND_SQL.MERG_INTO_CNAE_CODES

  • NOP – L10N_BR_S_FND_SQL.MERG_INTO_NOP_CODES

  • DIFFTAXREG – L10N_BR_S_FND_SQL.MERG_INTO_DIFF_TAX_REG_CODE

  • TAXCODES – L10N_BR_S_FND_SQL.MERG_INTO_TAX_CODES

  • CONTRIBTYPE – L10N_BR_S_FND_SQL.MERG_INTO_CONTRIB_TYPE_CODES

  • EXCEPTTAXTYPE – L10N_BR_S_FND_SQL.MERG_INTO_EXCEP_TAX_TYPE_CODES

  • L10N_BR_S_FND_SQL

  • MERG_INTO_NCM_CEST_CODES

The L10N_BR_S_FISCAL_FDN_QUERY_SQL call the fiscal foundation query package (L10N_BR_S_FISCAL_FDN_QUERY_SQL) which invoke ORT_SYN_TAX_CALL to retrieve the requested fiscal attributes from Synchro Tax Engine.

If any fiscal attributes are returned, they will be loaded (merged) to the corresponding table for that fiscal attribute. The tables loaded per attribute are as follows:

  • NCM_CODES with NCM codes

  • NCM_CHAR_CODES with NCM Characteristics codes

  • NCM_IPI_CODES with EX-IPI codes

  • NCM_PAUTA_CODES with the NCM Pauta codes

  • FEDERAL_SERVICE_CODES with the Federal service codes

  • L10N_BR_UNIFIED_SVC_CODES with Tax Web Tax Rules specific codes

  • CNAE_CODES with the CNAE codes

  • DIFFTAXREG with Differentiated Tax Regime Codes

  • TAXCODES with Tax Codes

  • CONTRIBTYPE with Contributor Types

  • EXCEPTTAXTYPE with Exception Tax Types

  • CEST with Cest codes

Finally, the LAST_UPD_DATE in the FISCAL_ATTRIB_UPDATES tables are updated to the current VDATE for the corresponding attributes once the data is loaded.

Scheduling Constraints

Table 13-5 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

This program can run in ad-hoc basis whenever the new fiscal attributes needs to be downloaded from Synchro

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-6 Tables Affected

Tables Select Insert Update Delete

L10N_BR_NCM_CODES

Yes

Yes

Yes

No

L10N_BR_NCM_CHAR_CODES

Yes

Yes

Yes

No

L10N_BR_NCM_PAUTA_CODES

Yes

Yes

Yes

No

L10N_BR_FEDERAL_SVC_CODES

Yes

Yes

Yes

No

L10N_BR_UNIFIED_SVC_CODES

Yes

Yes

Yes

No

L10N_BR_CNAE_CODES

Yes

Yes

Yes

No

FISCAL_ATTRIB_UPDATES

Yes

Yes

No

No

L10N_BR_FISCAL_QUERY_REQ

Yes

Yes

No

Yes

L10N_BR_TAX_CALL_REQ

Yes

Yes

No

Yes

FM_NOP

No

Yes

Yes

No

L10N_BR_FISCAL_QUERY_RES

Yes

Yes

No

Yes

L10N_BR_CONTRIB_TYPES

No

Yes

Yes

No

L10N_BR_EXCEPTION_CODES

Yes

Yes

Yes

No

FM_TAX_CODES

Yes

Yes

Yes

No

L10N_BR_DIFF_TAX_REGIME

Yes

Yes

Yes

No

L10N_BR_NCM_IPI_CODES

Yes

Yes

Yes

No

L10N_BR_NCM_CEST_CODES

Yes

Yes

Yes

Yes


I/O Specification

Not applicable

L10nbrfreclsprg (Fiscal Reclassification Purge)

Use this batch program to clear the database tables.

Functional Area

TaxWeb/Synchro Integration

Module Affected

L10NBRFRECLSPRG.PC

Design Overview

This batch purges the processed reclassification data from L10N_BR_FISCAL_RECLASS table. The records to be purged are based on its processed_date or active_date less than the current vdate along with the status.

Scheduling Constraints

Table 13-7 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

This program can run after the successful completion of the following scripts:

  • l10n_br_fiscal_reclass_item_setup_retail.ksh

  • l10n_br_fiscal_reclass_item_process_retail.ksh

  • l10n_br_fiscal_reclass_item_finish_retail.ksh

Pre-Processing

  • l10n_br_fiscal_reclass_item_setup_retail.ksh

  • l10n_br_fiscal_reclass_item_process_retail.ksh

  • l10n_br_fiscal_reclass_item_finish_retail.ksh

Post-Processing

Not applicable

Threading Scheme

Threading based on reclassification ID


Restart/Recovery

Not applicable

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-8 Tables Affected

Tables Select Insert Update Delete

L10N_BR_FISCAL_RECLASS

Yes

No

No

Yes

PERIOD

Yes

No

No

No

L10N_BR_FISCAL_RECLASS_NV

Yes

No

No

Yes


I/O Specification

Not applicable

Financial Postings Batch

Use this batch program to roll up financial data for accounting purposes.

Batch Design Summary

The following batch designs are included in this functional area:

  • fmfinpost.pc

  • fmtrandata.pc

fmfinpost.pc

Functional Area

Financial Postings

Module Affected

fm_financial_posting_sql

Design Overview

Rolls up the transaction amount into accounts based on general ledger.

Scheduling Constraints

Table 13-9 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Key Tables Affected

Table 13-10 Tables Affected

Tables Select Insert Update Delete

FM_GL_OPTIONS

Yes

No

No

Yes

FM_COA_SETUP

Yes

No

No

No

FM_SOB_SETUP

Yes

No

No

No

FM_ACCOUNT_SETUP

Yes

No

No

No

FM_DYNAMIC_SEGMENT_SETUP

Yes

Yes

No

No

FM_GL_CROSS_REF

Yes

Yes

No

No

FM_GL_DYNAMIC_ATTRIBUTES

Yes

Yes

No

No

FM_TRAN_DATA

Yes

No

No

No

FM_FISCAL_DOC_HEADER

Yes

No

Yes

No

FM_SCHEDULE

Yes

No

Yes

No

FM_AP_STAGE_HEAD

Yes

Yes

No

No

FM_AP_STAGE_DETAIL

Yes

Yes

No

No

STG_FIF_GL_DATA

Yes

Yes

No

No


I/O Specification

Not applicable

fmtrandata.pc

Functional Area

Financial Postings

Module Affected

fm_trandata_posting_sql

Design Overview

Computes transactional data based on the transaction codes.

Scheduling Constraints

Table 13-11 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Multi-threaded based on location


Restart/Recovery

The logical unit of work is location_id and fiscal_doc_id.

Key Tables Affected

Table 13-12 Tables Affected

Tables Select Insert Update Delete

FM_TRAN_DATA

No

Yes

No

No

FM_FISCAL_DOC_HEADER

Yes

No

Yes

No

FM_TRAN_CODES

Yes

No

No

No


I/O Specification

Not applicable

Deal Income Postings Batch

Use this batch program to create NFs in Approved status.

Batch Design Summary

The following batch design is included in this functional area:

  • fmdealinc.pc

fmdealinc.pc

Functional Area

Deal Income Postings

Module Affected

Not applicable

Design Overview

This batch program reads the data from RMS staging tables STAGE_FIXED_DEAL_HEAD, STAGE_FIXED_DEAL_DETAIL, STAGE_COMPLEX_DEAL_HEAD, and STAGE_COMPLEX_DEAL_DETAILl and creates the NFs in Approved status. If the NF creation fails for some fatal reason, the error is logged in the error file. This batch runs on a daily basis after vendinvc and vendinvf RMS batches.

Scheduling Constraints

Table 13-13 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

vendinvc and vendinvf RMS batches

Post-Processing

Not applicable

Threading Scheme

Multi-threaded based on deal_id


Restart/Recovery

The logical unit of work is Deal_id, Deal_detail_id, and location_id.

Key Tables Affected

Table 13-14 Tables Affected

Tables Select Insert Update Delete

FM_FIXED_DEAL_LOC _DEFAULT

Yes

No

No

No

STAGE_FIXED_DEAL_HEAD

Yes

No

No

No

STAGE_FIXED_DEAL_DETAIL

Yes

No

No

No

STAGE_COMPLEX_DEAL_HEAD

Yes

No

No

No

STAGE_COMPLEX_DEAL_DETAIL

Yes

No

No

No

TSF_ENTITY_ORG_UNIT_SOB

Yes

No

No

No

MV_L10N_ENTITY

Yes

No

No

No

SYSTEM_OPTIONS

Yes

No

No

No

FM_SYSTEM_OPTIONS

Yes

No

No

No

FM_FISCAL_DOC_HEADER

Yes

Yes

No

No

FM_FISCAL_DOC_DETAIL

No

Yes

No

No


I/O Specification

Not applicable

Financial Postings for Tax Changes Batches

Use these batch programs to update the Weighted Average Cost (WAC) and the TaxWeb Tax Rules historical data.

Batch Design Summary

The following batch designs are included in this functional area:

  • fmprepost.pc

  • fmtaxupld.pc

  • fmtaxchg.pc

  • fmpurge.pc

  • l10npurge.pc

fmprepost.pc

This batch has pre/post dependencies on the fmtaxupld batch.

Functional Area

Pre/post functionality for ORFM

Module Affected

Not applicable

Design Overview

This batch program has pre/post module for fmtaxupld batch. It contains fmtaxupld_post function. This function processes the records from staging table FM_STG_TAXCHG_DTL, contains process_ind as ’N', and inserts the records into FM_TAXCHG_HEADER and FM_TAXCHG_DETAIL tables.

This program considers the following four parameters:

  • Username/password to log on to Oracle

  • A program before or after which this script must run

  • An indicator indicating whether the script is a pre or post function

  • chunk_size for fmtaxupld only, which defines the number of records under one location that need to clubbed as single chunk

Scheduling Constraints

Table 13-15 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Fmtaxupld

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Key Tables Affected

Table 13-16 Tables Affected

Tables Select Insert Update Delete

FM_STG_TAXCHG_DTL

Yes

No

Yes

Yes

FM_TAXCHG_HEADER

Yes

Yes

No

No

FM_TAXCHG_DETAIL

Yes

Yes

No

No

V_FISCAL_ATTRIBUTES

Yes

No

No

No

FM_TAXCHG_HEADER_HIST

Yes

No

No

No

FM_TAXCHG_DETAIL_HIST

Yes

No

No

No


I/O Specification

Not applicable

fmtaxupld.pc

Use this batch program to upload the 'Tax Change Upload' input file consisting of tax rule changes into the system for processing purpose.

Functional Area

WAC and Substituição Tributária (ST) History Update

Module Affected

Not applicable

Design Overview

FMTAXUPLD.PC is a Pro*C program that runs as a module in Adhoc. The purpose is to upload and process Tax Change input file consisting of tax rule changes. The module accepts Tax Change data contained in a flat file (ASCII text) and formatted to match the prescribed retail input file format.

All items are validated, FMTAXUPLD.PC writes a row into the FM_STG_TAXCHG_DTL table.

Scheduling Constraints

Table 13-17 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Fmtaxupld post

Threading Scheme

Not applicable


Restart/Recovery

Since this is a file based upload, file based restart/recovery logic is applied. The commit_max_ctr field should be set to prevent excessive rollback space usage, and to reduce the overhead of file I/O.

Key Tables Affected

Table 13-18 Tables Affected

Tables Select Insert Update Delete

FM_STG_TAXCHG_DTL

No

Yes

No

Yes

ITEM_MASTER

Yes

No

No

No

ITEM_LOC_SOH

Yes

No

No

No

SYSTEM_OPTIONS

Yes

No

No

No

WH

Yes

No

No

No


I/O Specification

The input file name is not fixed and it is determined by a run time parameter. Records rejected by the import process are written to a reject file. The reject file name is not fixed and it is determined by a run time parameter.

Table 13-19 Input File

Record Name Field Name Field Type Default Value Description

FHEAD

File record descriptor

Char (5)

FHEAD

It describes the file line type.


Line number

Number (10)

0000000001

it is a sequential file line number.


File Type

Char (4)

TXUP

It is the Tax change Upload.


File create date

Char (14)


It is YYYYMMDDHH24MISS format.

FDETL

File record descriptor Cha r(5) FDETL It describes the file line type.

Line number

Number (10)


It is the sequential file line number.


Action Type

Char (1)


Following is the type of mode: 'I'nsert or 'D'elete


NF number

Number (15)


The NF number is used only for delete scenario.


Series No

Char (20)


The series number is used only for delete scenario.


Item

Char (25)


It is the item number.


Location_id

Number (10)


It is the location ID.


Location_type

Char (1)


Following is the type of location: 'S'tore or 'W'arehouse


Quantity

Number (12)


Quantity * 10000 (4 implied decimal places), quantity of item at that location. It is used to update the MTR history tables.


Unit cost

Number (20)


Unit cost * 10000 (4 implied decimal places), Unit cost of the item. It is assumed that it will be in location currency.


ICMS unit amount

Number (20)


Imposto Sobre Circulação de Mercadorias e Serviços (ICMS) unit amount * 10000 (4 implied decimal places), ICMS amount changed per unit. It is assumed that it will be in location currency.


ICMSST unit amount

Number (20)


ICMSST unit amount * 10000 (4 implied decimal places), ICMSST amount changed per unit. It is assumed that it will be in location currency.


ICMSST Base Value

Number (20)


ICMSST Base Value* 10000 (4 implied decimal places), ICMSST Base value per unit for the item. It is assumed that it will be in location currency.


ICMSSTE unit amount

Number (20)


ICMSSTE unit amount * 10000 (4 implied decimal places), ICMSSTE amount changed per unit. It is assumed that it will be in location currency


ICMSSTE Base Value

Number (20)


ICMSSTE Base Value * 10000 (4 implied decimal places), ICMSSTE Base value per unit for the item. It is assumed that it will be in location currency.


New average cost

Number (20)


New average cost * 10000 (4 implied decimal places), New average cost of the item after tax law change. It is assumed that it will be in location currency.

FTAIL

File record descriptor

Char (5)

FTAIL

It describes the file record type.


Line number

Number (10)


It is a sequential file line number (total number of lines in the file).


Number of detail records

Number (10)


It is the number of FDETL lines in the file.


Fmtaxchg.pc

Use this batch program to process the item/location records affected by tax change.

Functional Area

TAXCHG Processing

Modules Affected

  • l10n_br_wacadj_sql

  • lfm_ext_taxes_sql

Design Overview

The fmtaxchg RFM batch processes the records from FM_TAXCHG_HEADER and FM_TAXCHG_DETAIL tables with 'U' un-processed or 'E' error status.

The major functionality of this batch program is divided into the following three steps:

  1. Making a call to RMS packaged function L10N_BR_WACADJ_SQL.WAC_UPDATE to update WAC and TRAN_DATA postings for cost variance. In case of unhandled exceptions and package errors, the batch stops further processing and an error is reported in error file.

  2. Making a call to FM_T_EXT_TAXES_SQL and FM_S_EXT_TAXES_SQL with taxchg_ids for locations having control_rec_st_ind set to 'Y' in V_FISCAL_ATTRIBUTES, to update the ST history in MTR tables. In case of unhandled exceptions and package errors, the batch stops further processing and an error is reported in error file.

  3. The STATUS column is updated to 'A' in FM_TAXCHG_HEADER table of WAC and ST history tables if the records are updated successfully.

Scheduling Constraints

Table 13-20 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Multi Threaded based on taxchg_id


Restart/Recovery

The logical unit of work is taxchg_id.

Key Tables Affected

Table 13-21 Tables Affected

Tables Select Insert Update Delete

FM_TAXCHG_HEADER

Yes

No

Yes

No

FM_TAXCHG_DETAIL

Yes

No

No

No

V_FM_RESTART_TAXCHG

Yes

No

No

No

V_FISCAL_ATTRIBUTES

Yes

No

No

No


I/O Specification

Not applicable

Purging Process Batch

This batch is used to purge the NF records from the transaction and history tables.

fmpurge.pc

Functional Area

Purging Process

Design Overview

In production environment, as the number of transactions increases over a period of time; in order to keep the performance intact it is required to keep purging the data from the active tables of the application periodically. This batch purges the data from the active tables and stores them in history tables.

You can also purge the data from history tables over a period of time.

Scheduling Constraints

Table 13-22 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Key Tables Affected

Table 13-23 Tables Affected

Tables Select Insert Update Delete

FM_SCHEDULE_HIST

No

Yes

No

No

FM_FISCAL_DOC_HEADER_HIST

No

Yes

No

No

FM_FISCAL_DOC_DETAIL_HIST

No

Yes

No

No

FM_TRAN_DATA_HIST

No

Yes

No

No

FM_RECEIVING_HEADER_HIST

No

Yes

No

No

FM_RECEIVING_DETAIL_HIST

No

Yes

No

No

FM_FISCAL_DOC_TAX_HEAD_HIST

No

Yes

No

No

FM_FISCAL_DOC_TAX_DETAIL_HIST

No

Yes

No

No

FM_RESOLUTION_HIST

No

Yes

No

No

FM_CORRECTION_TAX_DOC_HIST

No

Yes

No

No

FM_CORRECTION_DOC_HIST

No

Yes

No

No

FM_NF_DOC_TAX_HEAD_EXT_HIST

No

Yes

No

No

FM_FISCAL_IMPORT_DETAIL_HIST

No

Yes

No

No

FM_FISCAL_IMPORT_HEADER_HIST

No

Yes

No

No

FM_NF_DOC_TAX_DETAIL_EXT_HIST

No

Yes

No

No

FM_NF_DOC_TAX_DETAIL_WAC_HIST

No

Yes

No

No

FM_FISCAL_DOC_PAYMENTS_HIST

No

Yes

No

No

FM_NF_DOC_TAX_RULE_EXT_HIST

No

Yes

No

No

FM_SPED_FISCAL_DOC_HEADER_HIST

No

Yes

No

No

FM_SPED_FISCAL_DOC_DETAIL_HIST

No

Yes

No

No

FM_SCHEDULE

Yes

No

No

Yes

FM_FISCAL DOC HEADER

Yes

No

No

Yes

FM_FISCAL_DOC_DETAIL

Yes

No

No

Yes

FM_TRAN_DATA

Yes

No

No

Yes

FM_RECEIVING_HEADER

Yes

No

No

Yes

FM_RECEIVING_DETAIL

Yes

No

No

Yes

FM_FISCAL_DOC_TAX_HEAD

Yes

No

No

Yes

FM_FISCAL_DOC_TAX_DETAIL

Yes

No

No

Yes

FM_RESOLUTION

Yes

No

No

Yes

FM_CORRECTION_TAX_DOC

Yes

No

No

Yes

FM_CORRECTION_DOC

Yes

No

No

Yes

FM_FISCAL_DOC_TAX_HEAD_EXT

Yes

No

No

Yes

FM_FISCAL_DOC_TAX_DETAIL_EXT

Yes

No

No

Yes

FM_FISCAL_DOC_TAX_DEATIL_WAC

Yes

No

No

Yes

FM_FISCAL_DOC_PAYMENTS

Yes

No

No

Yes

FM_FISCAL_DOC_TAX_RULE_EXT

Yes

No

No

Yes

FM_SPED_FISCAL_DOC_HEADER

Yes

No

No

Yes

FM_SPED_FISCAL_DOC_DETAIL

Yes

No

No

Yes

FM_FISCAL_ENTITY_OTHER

Yes

No

No

Yes

FM_FISCAL_ENTITY_OTHER_HIST

Yes

Yes

No

Yes

FM_EDI_FISCAL_ENTITY_OTHER

Yes

No

No

Yes

FM_NF_PURGE_DAYS_SETUP

Yes

No

No

No

FM_FRECLASS_STG

Yes

No

No

Yes

FM_FRECLASS

Yes

No

No

Yes

FM_FRECLASS_SCHEDULE

Yes

No

No

Yes


I/O Specification

Not applicable

Localization Purging Process Batch

This batch is used to purge records from the transaction and history tables.

l10npurge.pc

Functional Area

Purging Process

Design Overview

In production environment, as the number of transactions increases over a period of time; in order to keep the performance intact it is required to keep purging the data from the active tables of the application periodically. This batch purges the data from the active tables and stores them in history tables.

Scheduling Constraints

Table 13-24 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Key Tables Affected

Table 13-25 Tables Affected

Tables Select Insert Update Delete

GTAX_ITEM_ROLLUP

Yes

No

No

Yes

POS_MODS_TAX_INFO

Yes

No

No

Yes

GTAX_ITEM_ROLLUP_HIST

No

Yes

No

No

POS_MODS_TAX_INFO_HIST

No

Yes

No

No


I/O Specification

Not applicable

Localization Batch

This batch refreshes a materialized view MV_L10N_ENTITY. This materialized view is built on the addresses for entities like stores, warehouses, partners, suppliers, outside locations, and set of books. This materialized view is used in the decoupling logic.

refmvl10entity (Refresh MV MV_L10N_ENTITY)

Functional Area

Not applicable

Module Affected

REFMVL10ENTITY.PC

Design Overview

This is an ad hoc batch program that refreshes the materialized view MV_L10N_ENTITY that is based on ADDR, OUTLOC, COMPHEAD, and COUNTRY_ATTRIB table.

Scheduling Constraints

Table 13-26 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Not applicable

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

This batch program uses table-based restart/recovery. The commit happens in the database when the commit_max_ctr is reached.

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-27 Tables Affected

Tables Select Insert Update Delete

ADDR

Yes

No

No

No

OUTLOC

Yes

No

No

No

COMPHEAD

Yes

No

No

No

COUNTRY_ATTRIB

Yes

No

No

No


I/O Specification

Not applicable

Localization Purging Process Batch

This batch is used to clear records from the stage tables.

fm_batch_clear_calc_stg_t.ksh

Functional Area

Not applicable

Module Affected

fm_batch_clear_calc_stg_t.ksh

Design Overview

New batch process to get all data informed in table FM_CLEAR_CALC_STG_TABLES and for each line call function.

  • FM_T_EXT_TAXES_SQL

  • CLEAR_STG_TABLES

After call the function delete the processed lines in table FM_CLEAR_CALC_STG_TABLES.

Scheduling Constraints

Table 13-28 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

This batch program uses table-based restart/recovery. The commit happens in the database when the commit_max_ctr is reached.

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Table Affected

Table 13-29 Table Affected

Tables Select Insert Update Delete

FM_CLEAR_CALC_STG_TABLES

Yes

No

No

Yes


I/O Specification

Not applicable

SPED Batch

This batch is used to post NF transactions into staging tables for SPED reporting by Fiscal Partners.

Import_sped

Functional Area

SPED

Module Affected

Import_SPED.ksh

Design Overview

This batch inserts all processed NFs (status = FP) into two tables for SPED - FM_SPED_FISCAL_DOC_HEADER and FM_SPED_FISCAL_DOC_DETAIL. It looks into the driving table, FM_SPED_LAST_RUN_DATE, for the last run date of SPED to fetch all closed NFs whose transaction amounts are also rolled up into ledger accounts based on gl_cross_ref in between last run date and sysdate from the main tables of ORFM. Once the records are successfully inserted, the batch updates the last _run_date column of the driving table, FM_SPED_LAST_RUN_DATE to sysdate.It is recommended that you run this batch job on a daily basis due to performance impacts. This batch has a pre-dependency on the ORFM Financial postings batch, so once Financial postings batch program completes and sets the Nota Fiscal status to 'F'inancially 'P'osted (FP) only after that SPED insert batch job - import_SPED.ksh should be triggered to fetch all such 'F'inancially 'P'osted (FP) NFs from the ORFM tables.

Scheduling Constraints

Table 13-30 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

This program should run only after the successful completion of FMFINPOST.PC

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-31 Tables Affected

Tables Select Insert Update Delete

FM_FISCAL_DOC_HEADER

Yes

No

No

No

FM_FISCAL_DOC_DETAIL

Yes

No

No

No

FM_SCHEDULE

Yes

No

No

No

FM_FISCAL_DOC_TAX_HEAD

Yes

No

No

No

FM_FISCAL_DOC_TAX_DETAIL

Yes

No

No

No

FM_FISCAL_DOC_TAX_DETAIL_EXT

Yes

No

No

No

FM_FISCAL_UTILIZATION

Yes

No

No

No

FM_FISCAL_DOC_PAYMENTS

Yes

No

No

No

FM_SPED_FISCAL_DOC_HEADER

No

Yes

No

No

FM_SPED_FISCAL_DOC_DETAIL

No

Yes

No

No

ITEM_MASTER

Yes

No

No

No

FM_SPED_LAST_RUN_DATE

Yes

No

Yes

No

V_BR_ITEM_FISCAL_ATTRIB

Yes

No

No

No

V_FISCAL_ATTRIBUTES

Yes

No

No

No


I/O Specification

Not applicable

NF EDI Batch

This batch is used to generate NF from EDI staging tables.

fmedinf

Functional Area

NF creation and searching for an item.

Module Affected

fmedinf

Design Overview

This EDI batch runs to create the NF from the entries in the EDI NF tables, in Worksheet status. This NF is not linked to any schedule. Errors can only be viewed in the error log file. A new column in the NF header table displays if the NF has been created manually or through the EDI batch process.

The FM_EDI_DOC_DETAIL table is modified to include a new field, called VPN. This field allows the user to specify the VPN number, if the user is not aware of the RMS item number.

Scheduling Constraints

Table 13-32 Scheduling Constraints

Schedule Information Description

Processing Cycle

Ad-hoc

Scheduling Considerations

Ad-hoc

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Multi-threaded based on Supplier


Restart/Recovery

The logical unit of work is Supplier and edi_doc_id.

Locking Strategy

Not applicable

Security Considerations

Not applicable

Performance Considerations

Not applicable

Key Tables Affected

Table 13-33 Tables Affected

Tables Select Insert Update Delete
FM_EDI_DOC_HEADER

Yes

No

Yes

No

FM_EDI_DOC_DETAIL

Yes

No

No

No

FM_EDI_DOC_PAYMENT

Yes

No

No

No

FM_EDI_DOC_COMPLEMENT

Yes

No

No

No

FM_EDI_IMPORT_HEADER

Yes

No

No

No

FM_EDI_IMPORT_DETAIL

Yes

No

No

No

FM_FISCAL_IMPORT_HEADER

Yes

Yes

No

No

FM_FISCAL_IMPORT_DETAIL

Yes

Yes

No

No

FM_EDI_DOC_TAX_HEAD

Yes

No

No

No

FM_EDI_DOC_TAX_DETAIL

Yes

No

No

No

FM_FISCAL_DOC_HEADER

Yes

Yes

No

No

FM_FISCAL_DOC_DETAIL

Yes

Yes

No

No

FM_FISCAL_DOC_COMPLEMENT

Yes

Yes

No

No

FM_FISCAL_DOC_PAYMENTS

No

Yes

No

No

FM_FISCAL_DOC_TAX_HEAD

Yes

Yes

No

No

FM_FISCAL_DOC_TAX_DETAIL

Yes

Yes

No

No

FM_UTILIZATION_ATTRIBUTES

Yes

No

No

No

FM_FISCAL_DOC_TAX_HEAD_EXT

Yes

Yes

No

No

FM_FISCAL_DOC_TAX_DETAIL_EXT

Yes

Yes

No

No

FM_ERROR_LOG

No

Yes

No

Yes


I/O Specification

Not applicable

Tax Calculation - Legislation of MG State

The specific legislation of MG state (federation unit) drives the Retailers located there to get a monthly historical average sales price by item for domestic (intrastate) sales to end consumers.

Basically the average sales price must be used when the Item is sent out of the MG state.

Batch Design Summary

The following batch design is included in this functional area:

  • fm_batch_avg_sales_price.ksh

fm_batch_avg_sales_price.ksh

Functional Area

Calculation for average sales price for items.

Module Affected

fm_batch_avg_sales_price.ksh

Design Overview

Must support new state (MG) legislation for new calculation for average sales price for items.

Scheduling Constraints

Table 13-34 Scheduling Constraints

Schedule Information Description

Processing Cycle

At the end of RMS batch cycle (Daily).
Scheduling Constraints

This program is scheduled once a month.

Pre-Processing

Not applicable.

Post-Processing

Not applicable.

Threading Scheme

Location.


Key Tables Affected

Table 13-35 Tables Affected

Tables Select Insert Update Delete
TRAN_DATA_HISTORY

Yes

No

No

No

FM_FISCAL_DOC_HEADER_HIST

Yes

No

No

No

FM_FISCAL_DOC_DETAIL_HIST

Yes

No

No

No

FM_FISCAL_DOC_HEADER

Yes

No

No

No

FM_FISCAL_DOC_DETAIL

Yes

No

No

No

FM_AVERAGE_SALES_PRICE

Yes

Yes

Yes

No


FM Manifest Batch

This batch is used to post NF transactions into staging tables for SPED reporting by DFe Partners.

fmmanifest

Functional Area

Fiscal Receiving

Module Affected

fmmanifest.ksh

Design Overview

This batch inserts in the FM_STG_NFE the record that indicates to the Partner DFe the ”Manifestação do Destinatário SEFAZ” request for the "Operação Não Realizada" (status = NFE_C_P) and "Desconhecimento da Oparação" (status = NFE_U_P) events.

Are eligible for the event "Operação Não Realizada": the fiscal documents that are in the FM_FISCAL_DOC_HEADER table inactive (status = I), and the fiscal document previews that are in the FM_IRL_STATUS table refused (status: 305- REFUSED BY DISAGREEMENT, 306 - REFUSED AUTOMATICALLY AFTER PRE-VALIDATION, 6- REFUSED RECEIVING or 802- PHYSICAL RECEIVING REFUSED).

Are eligible for the manifestation of the event "Desconhecimento da Operação" are the fiscal document previews that are in the FM_IRL_STATUS table refused exclusively by unknown (status: 304- REFUSED BY UNKNOWN OPERATION).

In addition to the eligibility status criterion, the batch considers the number of days defined through the MDEST_SEFAZ System Option. Only records that have status definition dates less than or equal to the VDATE added to the defined number of days are processed.

If the record has been successfully inserted into the FM_STG_NFE table, the batch changes the status of the fiscal document (status = NFE_MP), and the status of the fiscal document previews (status: 1001- WAITING SEFAZ CONFIRMATION) to Manifest Pending.

Single and daily execution of this batch is recommended.

Scheduling Constraints

Table 13-36 Scheduling Constraints

Schedule Information Description

Processing Cycle

Daily

Scheduling Considerations

Not applicable

Pre-Processing

Not applicable

Post-Processing

Not applicable

Threading Scheme

Not applicable


Restart/Recovery

Not applicable

Locking Strategy

Not applicable

Security Considerations

Not applicable

Key Tables Affected

Table 13-37 Tables Affected

Tables Select Insert Update Delete

FM_FISCAL_DOC_HEADER

Yes

No

Yes

No

FM_IRL_STATUS

Yes

No

Yes

No

FM_IRL_HEADER

Yes

No

No

No

FM_IRL_LOG

No

Yes

No

No

FM_NFE_STG

Yes

Yes

No

No

FM_UTILIZATION_ATTRIBUTES

Yes

No

No

No

FM_SYSTEM_OPTIONS

Yes

No

No

No