Professional Documents
Culture Documents
E-Invoice Functionality
Page 1
Document Control
Change Record
5
7
Reviewers
Name Position
Audience
Name Position
12.1 & Above Product Support Team External
12.1 & Above Customers External
Contents
Document Control ......................................................................................... 2
1. Introduction ......................................................................................... 4
1.1 Transaction flow: ................................................................................ 4
1.2 Summary of objects........................................................................... 5
2. Transaction Information ................................................................... 6
3. IRN Extract: ........................................................................................ 13
4. Inbound Process .............................................................................. 22
4.1: JSON Upload - Approach:...................................................................... 22
4.2. JSON Upload – Transaction Flow: ........................................................ 23
4.3 Interface Loading – Approach:- ............................................................ 26
5. References ......................................................................................... 29
3
1. Introduction
E-invoice enablement functionality provided helps customer generate the invoice information as per
prescribed schema and assist in generating the outbound file and to receive inbound info from IRP.
Once this process is completed, the tax invoice data in ERP is appended with IRN, QR details. This
document provides insight over the technical flow/data model for the whole process.
4
1.2 Summary of objects
Below list of Objects are introduced/modified via E-invoice functionality:
5
2. Transaction Information
As soon as the tax invoice generation process returns with Success, the logic to populate the data in
JAI_IRN_DETAILS table gets called.
jai_inv_num_gen_pkg.process_generation
Once the records are fetched, c_party_class will fetch the reporting code details
from third party . (Reporting_code from jai_reporting_associatons_v)
If SHIP_TO_COUNTRY is not equal to IN, then category value will be taken as 'EXP' for IRN Details.
Else if first_party_primary_reg_num and third_party_primary_reg_num are not null, then category will
be identified as 'B2B' for IRN details.
Post this, if self_assessed_flag is Y , regrev in IRN details gets populated as 'Y' , else as 'N'
6
System will derive the column data for IRN_Details table from cursor c_trx_data data as below
Document_type Document_type
Document_num Tax_invoice_num
Document_date Tax_invoice_date
original_invoice_number Original_tax_invoice_num
preceding_invoice_number Original_tax_invoice_num
preceding_invoice_date original_tax_invoice_date
invoice_period_start_date Document_date(tax_invoice_date)
invoice_period_end_date Document_date(tax_invoice_date)
Once above values are derived, if the document type is null, error message
“Document Type is Null” will be shown in JAI_IRN_DETAILS.
If ship_from_location_id is not null for the transaction data fetched from c_trx_data, then system will fetch the
seller_address1, seller_address2, seller_building_number, seller_building_name, seller_floor_number, seller_district,
seller_location, seller_pincode, seller_state, seller_phone_number, seller_email_id from the fp_location_address cursor
which fetches the data from hr_locations_all and JA lookup value for state codes for ship_from_location_id.
Else if ship_from_location_id is null, system will not retrieve the above address fields for FP.
7
If bill_to_location_id is not null for the transaction data fetched from c_trx_data, then system will fetch
the buyer_address1, buyer_address2, buyer_building_number, buyer_building_name,
buyer_floor_number, buyer_district, buyer_location, buyer_pincode, buyer_state from the
tp_location_address cursor which fetches the data from hz_locations and JA lookup value for state
codes for bill_to_location_id.
Else if ship_from_location_id is null, system will not retrieve the above address fields for FP.
If party_id is not null in the data fetched by c_trx_data, then cursor c_customer_details fetches the
data of buyer_trade_name, buyer_phone_number, buyer_email_id based on the party_id and
tp_legal_name value fetched in c_trx_data.
Lastly, buyer_legal_name, ship_to_legal_name gets fetched from same column tp_legal_name fetched
by cursor c_trx_data.
8
If ship_to_location_id is null (or) ship_to_location_id
matches bill_to_location_id, below values gets copied
for ship_to details from buyer columns.
Else, ship_to_address1, ship_to_address2,
ship_to_address1 buyer_address1 ship_to_location, ship_to_pincode,
ship_to_address2 buyer_address2 ship_to_state gets populated from cursor
ship_to_location buyer_location tp_location_address based on
ship_to_pincode buyer_pincode ship_to_location_id, ship_to_state values.
ship_to_state buyer_state
Once ship to values are determined,system will retrieve “igst_applicability_flag” value from function “get_igst_applicability”
based on the values “reporting_code”, ship_from_state (dispatch state) and bill_to_state (ship_to_state);
If the reporting_code value is ‘SEZ’, then igst_applicability_flag will get populated as ‘Y’
elsif SHIP_FROM_STATE and BILL_TP_STATE are not equal, then igst_applicability_flag will get populated as ‘N’
and if both conditions are not met, it will be populated as ‘N’
If item_id is null
If item id is not null
9
Post that below the columns in JAI_IRN_DETAILS gets values from the transaction data cursor tl_trx_data
as below:
HSN_CODE HSN_CODE
BAR_CODE NULL
QUANTITY TRX_LINE_QUANTITY
FREE_QUANTITY 0
UOM TRX_UOM_CODE, if null as ‘Ea’
UNIT_PRICE UNIT_PRICE
TOTAL_AMOUNT LINE_AMT
DISCOUNT DISCOUNT
OTHER_CHARGES OTHER_CHARGES
ASSESSABLE_amount rounded_taxable_amt_fun_curr, if null as ‘0’
cgst_rate cgst_rate, if null as ‘0’
sgst_rate sgst_rate, if null as ‘0’
Igst_rate Igst_rate,if null as ‘0’
gst_rate If igst_rate is not 0, then igst_rate
Else cgst_rate+sgst_rate
cess_rate cess_rate, if null as ‘0’
state_cess_rate state_cess_rate, if null as ‘0’
cess_nonadv_amount cess_nonadv_amount, if null as ‘0’
cgst_amount cgst_amount, if null as ’0’
sgst_amount sgst_amount, if null as ‘0’
igst_amount igst_amount, if null as ‘0’
cess_amount cess_amount, if null as ’0’
state_cess_amount state_cess_amount, if null as ‘0’
state_cess_nonadvl_amt 0
total_item_value Line_amt- discount+other_charges+cgst_amount+
sgst_amount+ igst_amount+ cess_amount+
state_cess_amount+ CESS_NONADV_AMOUNT
pre_tax_value total_amount
batch_name null
batch_expiry_date null
warrenty_date null
If category for JAI_IRN_DETAILS is identified as “EXP”, then below fields gets populated
SHIPPING_BILL_NUMBER, SHIPPING_BILL_DATE, FOR_CURRENCY, COUNTRY_CODE gets populated from
PROOF_OF_EXPORT_NUM , PROOF_RECEIVED_DATE, trx_currency_code, ship_to_country values of transaction data
(c_trx_data) resepectively.
Additionally, Buyer_pincode as ‘999999’, buyer_state as ‘96’, buyer_place_of_supply as ‘96’, ship_to_pincode as ‘9999’
and ship_to_state as ‘99’ will only get populated in case SHIP_TO_COUNTRY for transaction is not ‘IN’ and category as
“EXP“
If category for IRN_Details is fetched as ‘EXP’, then Buyer_place_of_supply gets populated as ‘96’
otherwise, buyer_state code gets populated as buyer_place_of_supply.
SUMMARY DETAILS
Once the data is inserted into JAI_IRN_DETAILS, Procedure “populate_irn_details” is completed and also
ends the JAI_INV_NUM_GEN_PKG package execution.
12
3. IRN Extract:
Concurrent Processing:- India Generate IRN Extract to be submitted for generating the outbound extract
in xml format. Below are the program details.
Parameters:-
13
Parameter Details:-
14
2. JA_IN_REP_REG_NUM: Value set defined on views “jai_party_regs_v”, “jai_party_reg_lines_v”
15
3. JAI 240 Characters Optional:-
4. JAINARDR_START_DATE
5. JAINARDR_END_DATE
16
6. JAI_Yes_No:- Value Set defined on table ‘FND_LOOKUP’
17
Data Definition: JAIIRNDATA is the data definition for the concurrent program of IRN extract.
Data definition has data template “JAIIRNDATA.xml” attached to fetch the data for the concurrent
processing.
These parameters gets the values from the parameter values provided while submitting the concurrent
program.
The data definition has 2 queries Q1 and Q2 which will fetch the details for the XML tags from
JAI_IRN_DETAILS table for all the tags based on the parameter value passed.
Once the data is fetched and xml tags are assigned with values, after report trigger will call the package
“jai_irn_extract_pkg.afterreport” which will update the request id of concurrent request in
JAI_IRN_DETAILS table using below:
18
ELEMENTS and Mappings of column in JAI_IRN_DETAILS table:
19
Pin BUYER_PINCODE
Ph BUYER_PHONE_NUMBER
Em BUYER_EMAIL_ID
Nam PAYEE_NAME
AccDet PAYEE_ACCOUNT
Mode MODE_OF_PAYMENT
FinInBr BRANCH_IFSC
PayTerm PAYMENT_TERMS
PayInstr PAYMENT_INSTRUCTION
CrTrn CREDIT_TRANSFER
DirDr DIRECT_DEBT
CrDay CREDIT_DAYS
PaidAmt PAID_AMT
PaymtDue BALANCE_AMOUNT
Nm DISPATCH_ENTITY_NAME
Addr1 DISPATCH_ADDRESS1
Addr2 DISPATCH_ADDRESS2
Loc DISPATCH_LOCATION
Stcd DISPATCH_STATE
Pin DISPATCH_PINCODE
LglNm SHIP_TO_LEGAL_NAME
TrdNm SHIP_TO_TRADE_NAME
Gstin SHIP_TO_GSTIN
Addr1 SHIP_TO_ADDRESS1
Addr2 SHIP_TO_ADDRESS2
Loc SHIP_TO_LOCATION
Pin SHIP_TO_PINCODE
Stcd SHIP_TO_STATE
SlNo ITEM_SERIAL_NUMBER
PrdDesc PRODUCT_DESCRIPTION
IsServc ITEM_SERVICE_FLAG
HsnCd HSN_CODE
BarCd BARCODE
QTY QUANTITY
FreeQty FREE_QUANTITY
Unit UOM
UnitPrice Unit_Price
TotAmt TOTAL_AMOUNT
Discount Discount
PreTaxVal PRE_TAX_VALUE
AssAmt ASSESSABLE_AMOUNT
GstRt GST_RATE
IgstAmt IGST_AMOUNT
CgstAmt CGST_AMOUNT
SgstAmt SGST_AMOUNT
CesRt CESS_RATE
20
CessAmt CES_AMOUNT
CesNonAdvlAmt CESS_NONADV_AMOUNT
StateCesRt STATE_CESS_RATE
StateCesAmt STATE_CESS_AMOUNT
StateCesNonAdvlAmt STATE_CESS_NONADVL_AMT
OthChrg OTHER_CHARGES
OrdLineRef ITEM_ORDER_LINE_REF
TotItemVal TOTAL_ITEM_VALUE
OrgCnt ITEM_ORIGIN_COUNTRY
PrdSlNo SERIAL_NUMBER
Nm ITEM_ATTRIBUTE_NAME
Val ITEM_ATTRIBUTE_VALUE
AssVal TOTAL_ASSESSABLE_VALUE
IgstVal TOTAL_IGST_VALUE
CgstVal TOTAL_CGST_VALUE
SgstVal TOTAL_SGST_VALUE
CesVal TOTAL_CESS_VALUE
StCesVal TOTAL_STATE_CESS_VALUE
Discount DISCOUNT_AMT_INV_LEVEL
OthChrg OTHER_CHARGES_INV_LEVEL
RndOffAmt ROUND_OFF_AMT
TotInvVal TOTAL_INVOICE_VALUE
TotInvValFc TOTAL_INV_FOREIGN_CURR
ForCur FOR_CURRENCY
CntCode COUNTRY_CODE
Port PORT_CODE
ShipBNo SHIPPING_BILL_NUMBER
ShipBDt SHIPPING_BILL_DATE
ExpDuty EXPORT_DUTY_AMT
RefClm REFUND_CLAIM_OPTION
Url ADDTL_SUPP_DOCS_URL
Docs ADDTL_SUPP_DOCS
Info ADDITIONAL_INFORMATION
TransId TRANSPORTER_ID
TransMode TRANS_MODE
Distance TRANS_DISTANCE
TransName TRANSPORTER_NAME
TrnDocNo TRANS_DOC_NO
TrnDocDt TRANS_DOC_DATE
VehNo VEHICLE_NO
VehType VEHICLE_TYPE
21
4. Inbound Process
Inbound process allows to update the IRN details from tax repository form back to the ERP
system.
a. JSON Upload
b. Interface loading
"GSTIN": "FIRST_PARTY_REG_NUM",
"STATUS":"ACT",
"IRNDTLS": [
"IRN": "INVOICE_REFERENCE_NUMBER",
"ACKNO":"ACKNOWLEDGMENT_NUMBER",
"ACKDT":"ACKNOWLEDGEMENT_DATE”,
"QRCODE":"QR_CODE_RESPONSE"
As soon as the file is uploaded in the tax repository form, the file gets processed and the relevant
details gets inserted into the JAI_GST_REPT_INBOUND_INTERFACE table and the concurrent
processing will map the data from JAI_GST_REPT_INBOUND_INTERFACE to the jai_irn_details
table.
Post that provision is provided to display the QR code and IRN details in India tax details form.
22
4.2. JSON Upload – Transaction Flow:
As soon as the FileType is selected as “IRN-INBOUND” from the list of values and clicked on
browse button, a OAF page “oracle/apps/fnd/upload/webui/UploadPG” gets launched
which has the options to browse and submit JSON file for inbound data.
As soon as the JSON file is selected and submitted in the page, there will be an entry that gets
created in table “fnd_lobs” for the file that is uploaded.
This table will have File_data column which has the entire data of the file.
With file getting submitted in this OAF page, we have to select Yes in Tax repository form
(JAINTRPR.fmb).
Once the “Yes” is selected saying file is uploaded, then JAINTRPR.fmb – will call
When_Button_pressed trigger and checks if there is an entry in the fnd_lobs table. If the file is found
in the fnd_lobs table, then the package “jai_gst_inbound_pkg.jai_load_jason_file” gets called to load
the data into the JAI_LOBS from FND_LOBS table.
If the file upload to JAI_LOBS table fails , then below error message will be displayed:
File upload has failed! Please re-try again , Check Log for details
At this moment, once you click save on review repository form, you will find data as below:-
If Form_type value is in “IRN-INBOUND”, then below procedure gets called to load data:
jai_apex_json_pkg.jai_jsontotbl_irn
JSON package will check if there is an entry in jai_lobs table for the
file id with file_type as the form_type.
System uses “apex_json.parse” apex function to retrieve values from the JSON file
uploaded as below:
24
Once the data is retrieved from the JSON File, procedure “ jai_gst_inbound_pkg.jai_populate_interface”
gets called to insert retrieved data into interface table “jai_gst_rept_inbound_interface”, with parameters
file id and form type as “IRN-INBOUND”
With the data fetched from interface table, if form_type is “IRN-INBOUND”, then
jai_irn_details gets updated with below fields, where SELLER_GSTIN in JAI_IRN_DETAILS
matches the First_party_primary_reg_num in interface and document_number in
JAI_IRN_DETAILS matches the tax_invoice_number in interface.
qr_code_response qr_code_response
Status PS
acknowledgement_number gstn_acck_id
acknowledgement_date GSTN_ACCK_DATE
25
JAI_TAX_LINES and JAI_TAX_DET_FACTORS tables gets updated as follows:
Once all the above updates are completed, interface table gets updated with record_type_code as
“REPOSITORY_UPDATED” and UPLOAD_DATE as SYSDATE.
Once a record is marked as REPOSITORY_UPDATED, it will not get picked up again for populating the
JAI_IRN_DETAILS table.
Post this, in india tax details form, IRN details and QR code will be displayed.
In Interface loading approach, instead of uploading the JSON file, there is an option provided to insert the
data directly into interface table “jai_gst_rept_inbound_interface”.
Below are the mandatory fields that needs to be populated for the program to pick the data from
interface:
26
Once the data is inserted into interface, the concurrent program “India-GSTIN Inbound Process” need to
be ran as follows:
Please make sure that you are providing the correct parameters while running the program manually post
populating the interface.
File name can be passed as “dummy/sample/test” as an example. There is no validation for manual
program execution on filename.
Concurrent program for both Interface approach and the JSON upload both are same.
In Interface upload approach, once the data is inserted and program was run explicitly, there is no
difference in logic. As soon as the file name is found null, it calls “jai_return_repository_update” which
will pick the data from interface table and update the fields as mentioned in the 1st approach as below:
“zt_qr.f_qr_as_bmp” gets
called and will return the
encoded data in QR code.
27
Once the JAI_IRN_DETAILS table is updated, invoice_reference_number in jai_tax_det_factors table also
gets updated with the IRN number.
Once all the above updates are completed, interface table gets updated with record_type_code as
“REPOSITORY_UPDATED” and UPLOAD_DATE as SYSDATE.
Once a record is marked as REPOSITORY_UPDATED, it will not get picked up again for populating the
JAI_IRN_DETAILS table.
Post this, in india tax details form, IRN details and QR code will be displayed.
28
5. References
1. E-Business Suite Release 12: Oracle Financials for India (OFI) Information Center (Doc ID
2640446.2)
2. Oracle E-Business Suite: India GST E-Invoice, October 1, 2020 (Doc ID 2628076.1)
3. Oracle Financials for India (OFI) - Goods and Services Tax(GST) - E-invoicing Functionality
(Doc ID 2710671.1)
29