You are on page 1of 29

Oracle Financials of India (OFI)

E-Invoice Functionality

Author: Praveen Kumar


Creation Date: 02-Sep-2020
Last Updated:
Document Ref:
Version: 1.0

Organization: Oracle India Private Limited.

Page 1
Document Control

Change Record
5
7

Date Author Version Change Reference


03-Sep-20 Praveen Kumar 0.1 Initial document
10-Sep-20 Praveen Kumar 1.0 Added Object details

Reviewers

Name Position

Pawan Panwar Manager, Product Support

Pavan Raparla SME, Product Support

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.

1.1 Transaction flow:

IRN details table will get populated as soon as the


tax invoice generation is completed in success.

To generate the IRN extract,


submit “India Generate IRN
Extract” program.

Once the JSON inbound file is uploaded, the


information of IRN, Acknowledgment and QR gets
mapped to the tax invoice information in ERP

4
1.2 Summary of objects
Below list of Objects are introduced/modified via E-invoice functionality:

Object Object Type Summary


JAI_APEX_JSON_PKG Package Specification
Logic to derive data from JSON
JAI_APEX_JSON_PKG Package Body file and populate interface table
JAI_GST_INBOUND_PKG Package Specification
Inbound process is controlled by
JAI_GST_INBOUND_PKG Package Body the package till the data is
appended to ERP
JAI_CLIENT_EXTN_PKG Package Body Added function to facilitate calling
open source code to encode QR
code
ZT_QR Package Specification Open source package to encode
ZT_QR Package Body QR code for the QR code
responses received
JAI_IRN_EXTRACT_PKG Package Specification Logic to derive Outbound IRN
JAI_IRN_EXTRACT_PKG Package Body extract output.
JAI_INV_NUM_GEN_PKG Package Body Logic incorporated to populate
IRN details table as soon as tax
invoice number is generated.
JAI_LOBS Table Table stores JSON data imported
from FND_LOBS
JAI_GST_REPT_INBOUND_INTERFACE Table Table to store inbound
information
JAI_IRN_DETAILS Table Table to store all the required
information for IRN Outbound
extract as well as inbound
information received.
India Generate IRN Extract Concurrent Program Program to generate IRN extract
India-GSTIN Inbound Process Concurrent Program Program to interface and update
Inbound information either via
json/inbound approaches.
JAIIRNDATA Data Template(XDO_LOBS) Data template JAIIRNDATA.xml to
generate IRN extract in XML.
JAINTXPP Form India Tax Details form to display
JAINTXRP IRN details and QR code.
JAINTXOC
JAINTRPR Form View tax repository form
modified to have radio button
section for uploading JSON file.
JAINTPTY Form Third party registration form
JAINFPTY Form First party registration form

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

On successful generation of tax invoice number

Jai_inv_num_gen_pkg. populate_irn_details gets called with


below input parameters:
application_id , entity_code , trx_id

C_TRX_DATA cursor is defined on JAI_TAX_DET_FACTORS and JAI_TAX_LINES. System


will fetch records from cursor C_TRX_DATA based on the values provided via
parameters above, having tax invoice number generated and no record exists in
jai_irn_details tables for corresponding det factor id

Once the records are fetched, c_party_class will fetch the reporting code details
from third party . (Reporting_code from jai_reporting_associatons_v)

Now, the Section of TRANSACTIONS DETAILS gets started

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'

This will end the section of TRANSACTIONS DETAILS

6
System will derive the column data for IRN_Details table from cursor c_trx_data data as below

Start Of Section DOCUMENT DETAILS

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.

END Of Section DOCUMENT DETAILS

Now, calls the logic to retrieve SELLER DETAILS

Retrieves first_party_primary_reg_num, fp_legal_name, fp_legal_name from cursor data c_trx_data and


copies the values to seller_gstin, seller_legal_name, seller_trade_name for IRN table.

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.

This ends logic of retrieval of SELLER DETAILS

START Of Section BUYER DETAILS

Copies the value of third_party_primary_reg_num from c_trx_data for buyer_gstin and if


the values null, assigns the value as ‘URP’

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.

c_customer_details is defined on hz_parties and hz_cust_accounts.

Lastly, buyer_legal_name, ship_to_legal_name gets fetched from same column tp_legal_name fetched
by cursor c_trx_data.

This ends the logic to retrieve BUYER DETAILS

START Of Section DISPATCH DETAILS

BelowDispatch details will be as is copied from Seller


details.
DISPATCH_ENTITY_NAME seller_trade_name
dispatch_address1 seller_address1
dispatch_address2 seller_address2
dispatch_location Seller_location
dispatch_pincode Seller_pincode
dispatch_state Seller_state

END Of Section DISPATCH DETAILS

START Of Section SHIP TO DETAILS

Retrieve third_party_primary_reg_num and buyer_trade_name from c_trx_data cursor and


copy the ship_to_gstin and ship_to_trade_name respectively

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’

END Of Section SHIP TO DETAILS

START Of Section ITEM DETAILS

If item_id is null
If item id is not null

Fetches product_description, item_service_flag values using cursor c_item_details


which is defined on mtl_system_items_b by passing item_id and organization_id
from C_TRX_DATA

Fetches item_serial_number from trx_line_number


and populates serial_number as null

Updates the product_description value with the


value from the above cursor of c_item_details.

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

START Of EXPORT DETAILS


END Of Section ITEM DETAILS

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“

END Of EXPORT DETAILS


10
START Of BUYER PLACE OF SUPPLY Details

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.

END Of BUYER PLACE OF SUPPLY Details

START Of Section EWAY BILL DETAILS

Fields TRANSPORTER_ID, TRANS_MODE, TRANS_DISTANCE, TRANSPORTER_NAME, TRANS_DOC_NO, VEHICLE_NO,


VEHICLE_TYPE are populated as NULL

END Of Section EWAY BILL DETAILS

SUMMARY DETAILS

Retrieves data of ASSESSABLE_amount, cgst_amount, sgst_amount, igst_amount, cess_amount,


state_cess_amount, cess_nonadv_amount, discount, other_charges, total_item_value for calculating totals

Below validations are in place on seller details fetched.

If seller_gstin is null ERROR_MESSAGE will have message ‘seller_gstin is Null’


If seller_location is null ERROR_MESSAGE will have message ‘seller_location is Null’
If seller_state is null ERROR_MESSAGE will have message ‘seller_state is Null’
If seller_pincode is null ERROR_MESSAGE will have message ‘seller_pincode is Null’
Below validations are in place on buyer details fetched.

If buyer_gstin is null ERROR_MESSAGE will have message ‘buyer_gstin is Null’


If buyer_location is null ERROR_MESSAGE will have message ‘buyer_location is Null’
If buyer_state is null ERROR_MESSAGE will have message ‘buyer_state is Null’
If buyer_pincode is null ERROR_MESSAGE will have message ‘buyer_pincode is Null’
Once the above fields are validated, similar validation message for checking null value is existing on
product_description, hsn_code, quantity, unit_price and ASSESSABLE_amount value fields.

START Of Section SUMMARY DETAILS

The summary section will have the total_ASSESSABLE_value, total_sgst_value , total_igst_value,


total_cgst_value, total_cess_value, total_state_cess_value, total_invoice_value,
round_off_amt(rounded to 2 decimal) calculated based on the data retrieved in summary
details. 11
If category is fetched as ‘EXP’ , then TOTAL_INV_FOREIGN_CURR value gets calculated as below:
total_invoice_value/currency_conversion_rate , outcome rounded to 2 decimals.

WHO COLUMNS ‘created_by’, ‘creation_date’, last_updated_by, last_update_date, last_update_login values


are fetched accordingly.

End Of Section SUMMARY DETAILS

Once the required data is retrieved for all columns


following above sequence, data gets inserted into
“jai_irn_details” table now.

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:-

Seq Parameter Enabled Value Set Default Required Display


1 Tax Regime Yes JA_IN_REP_REGIME NA Yes Yes
2 Registration Number Yes JA_IN_REP_REG_NUM NA Yes Yes
3 Tax Invoice Number Yes JAI 240 Characters Optional NA No Yes
4 Start Date Yes JAINARDR_START_DATE NA No Yes
5 End Date Yes JAINARDR_END_DATE NA No Yes
6 Re-Extract Yes JAI_Yes_No No No Yes

Value Set Details for the parameters:-

1. JA_IN_REP_REGIME: Value set defined based on table ‘JAI_REGIMES’

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.

JAIIRNDATA.xml has the default package ‘JAI_IRN_EXTRACT_PKG’ linked.

<dataTemplate name="JAIIRNDATA" defaultPackage="JAI_IRN_EXTRACT_PKG" description="JAIIRNDATA


FORM" Version="1.0">

Below are the parameters which will be used to filter data:

<parameter name="PI_TAX_REGIME_ID" dataType="NUMBER"/>

<parameter name="PI_REG_NUM" dataType="VARCHAR2"/>

<parameter name="PI_TAX_INVOICE_NUM" dataType="VARCHAR2"/>

<parameter name="PI_START_DATE" dataType="DATE"/>

<parameter name="PI_END_DATE" dataType="DATE"/>

<parameter name="PI_REEXTRACT" dataType="VARCHAR2"/>

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:

<dataTrigger name="afterReport" source="jai_irn_extract_pkg.afterreport"/>

18
ELEMENTS and Mappings of column in JAI_IRN_DETAILS table:

Element Name in XML Column in JAI_IRN_DETAILS


TaxInvoiceNum DOCUMENT_NUMBER
Version ‘1.03’
Irn INVOICE_REFERENCE_NUMBER
SupTyp CATEGORY
RegRev REGREV
IgstOnIntra IGST_APPLICABILITY_FLAG
EcmGstin ECOMM_GSTIN
TaxSch ‘GST’
Typ DOCUMENT_TYPE
No DOCUMENT_NUMBER
Dt DOCUMENT_DATE
InvStDt INVOICE_PERIOD_START_DATE (yyyy-mm-dd)
InvEndDt INVOICE_PERIOD_END_DATE (yyyy-mm-dd)
PrecInvNo PRECEDING_INVOICE_NUMBER
PrecInvDt PRECEDING_INVOICE_DATE (yyyy-mm-dd)
OthRefNo OTHER_REFERENCE
RecAdvRefr RECEIPT_ADVICE_NUMBER
RecAdvDt RECEIPT_ADVICE_DATE (yyyy-mm-dd)
TendRefr LOT_NUMBER
ContrRefr CONTACT_REFERENCE_NUMBER
ExtRefr EXTRA_REFERNCE
ProjRefr PROJECT_REFERENCE_NUMBER
PORefr VENDOR_PO_REFERENCE_NUMBER
PORefDt VENDOR_PO_REF_DATE (yyyy-mm-dd)
InvRm REMARKS
LglNm SELLLER_LEGAL_NAME
TrdNm SELLER_TRADE_NAME
Gstin SELLER_GSTIN
Addr1 SELLER_ADDRESS1
Addr2 SELLER_ADDRESS2
Loc SELLER_LOCATION
Stcd SELLER_STATE
Pin SELLER_PINCODE
Ph SELLER_PHONE_NUMBER
Em SELLER_EMAIL_ID
LglNm BUYER_LEGAL_NAME
TrdNm BUYER_TRADE_NAME
Gstin BUYER_GSTIN
POS BUYER_PLACE_OF_SUPPLY
Addr1 BUYER_ADDRESS1
Addr2 BUYER_ADDRESS2
Loc BUYER_LOCATION
Stcd BUYER_STATE

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.

Inbound process can be done in 2 approaches:

a. JSON Upload
b. Interface loading

4.1: JSON Upload - Approach:

JSON file to be uploaded will be in the below prescribed schema:-

"GSTIN": "FIRST_PARTY_REG_NUM",

"STATUS":"ACT",

"IRNDTLS": [

"IRN": "INVOICE_REFERENCE_NUMBER",

"ACKNO":"ACKNOWLEDGMENT_NUMBER",

"ACKDT":"ACKNOWLEDGEMENT_DATE”,

"DOCDTLS": {"TYP": "INV","NO": "TAX_INVOICE_NUM","DT":


"TAX_INVOICE_DATE"},

"QRCODE":"QR_CODE_RESPONSE"

The file should be in the “.json” extension.

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:-

As soon as we click on Process button on Review repository form, WHEN_BUTTON_PRESSED trigger


gets called on JAITRPR.fmb form, and submits the concurrent request “India-GSTIN Inbound Process”.

FND_REQUEST.SUBMIT_REQUEST is used to execute the request “JAIINBDCP”.

Once the request is submitted, below message is displayed:

“Conc: India-GSTIN Inbound Process Submitted , Request Id=>(request_id)”


23
As soon as the concurrent request is submitted, below package gets called
JAI_GST_INBOUND_PKG.jai_process_inbound_main

by passing parameter values “File ID” and “Form Type IRN-INBOUND”

If Form_type value is in “IRN-INBOUND”, then below procedure gets called to load data:

jai_apex_json_pkg.jai_jsontotbl_irn

by passing parameter values file_id and form type IRN-INBOUND

JSON package will check if there is an entry in jai_lobs table for the
file id with file_type as the form_type.

If the file is found and p_form_type = 'IRN-INBOUND' in JAI_LOBS table.

System uses “apex_json.parse” apex function to retrieve values from the JSON file
uploaded as below:

1. IRN GSTIN is the value mapped to GSTIN


2. IRN Acknowledgment No is the value mapped to ACKNO under IRNDTLS
3. IRN Acknowledgment Date is the value mapped to ACKDT under IRNDTLS in
DD-MM-YYYY format.
4. gstn_acck_status gets mapped as “PS”
5. Invoice_reference_number is the value mapped to IRN under IRNDTLS
6. Trx_type is the value mapped to TYP under DOCDTLS of IRNDTLS
7. TAX_INVOICE_NUMBER is the value mapped to NO under DOCDTLS of
IRNDTLS
8. TAX_INVOICE_DATE is the value mapped to DT under DOCDTLS of IRNDTLS
9. Trx_number for IRN will be mapped with Tax invoice number retrieved
above.
10. QR_code_response is the value mapped to QRCODE under IRNDTLS.
11. ERROR_CODE, ERROR_DESC will be assigned with null values.

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”

Batch_id in interface gets mapped with the file_id.


Once the insertion of data is successful, then “jai_gst_inbound_pkg.jai_return_repository_update”
gets called to retrieve data from interface table, which is matching the file_id and form_type “IRN-
INBOUND” and RECORD_TYPE_CODE is null.

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.

Column in JAI_IRN_DETAILS Data fetched from jai_gst_rept_inbound_interface


Invoice Reference Number Invoice_Reference_number
qr_code_image
Procedure call jai_client_extn_pkg.f_qr_as_bmp gets
QR_CODE_RESPONSE provided in interface table and
calls the below procedure to encode QR code.

“zt_qr.f_qr_as_bmp” gets called and will


return the encoded data in QR code.

The QR code returned from above package call gets


inserted into QR_CODE_IMAGE Column

qr_code_response qr_code_response
Status PS
acknowledgement_number gstn_acck_id
acknowledgement_date GSTN_ACCK_DATE

Once the JAI_IRN_DETAILS table is updated, invoice_reference_number in jai_tax_det_factors table also


gets updated with the IRN number.

25
JAI_TAX_LINES and JAI_TAX_DET_FACTORS tables gets updated as follows:

a. Reporting_status_flag gets updated with gstn_acck_status from inbound details


b. gstn_acck_status updated with gstn_acck_status from inbound details
c. match_status_flag updated with match_status_flag from inbound details
d. action_flag with action_flag from inbound details
e. record_type_code as GSTIN_INB_UPDT

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.

This ends the program which got submitted in


background once the process button is clicked in
review repository form.

Post this, in india tax details form, IRN details and QR code will be displayed.

4.3 Interface Loading – Approach:-

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:

inbound_intf_line_id (for table constraint)


first_party_primary_reg_num
form_type (value must be 'IRN-INBOUND')
trx_type
tax_invoice_number
tax_invoice_date
gstn_acck_status ('PS')
gstn_acck_id
invoice_reference_number
gstn_acck_date
QR_code_response

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:

Column in JAI_IRN_DETAILS Data fetched from jai_gst_rept_inbound_interface


Invoice Reference Number Invoice_Reference_number
qr_code_image
Calls jai_client_extn_pkg.f_qr_as_bmp
package to with the data of
QR_CODE_RESPONSE provided in
interface table.

“zt_qr.f_qr_as_bmp” gets
called and will return the
encoded data in QR code.

The QR code returned from above package call gets


inserted into QR_CODE_IMAGE Column
qr_code_response qr_code_response
Status PS
acknowledgement_number gstn_acck_id
acknowledgement_date GSTN_ACCK_DATE

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.

JAI_TAX_LINES and JAI_TAX_DET_FACTORS tables gets updated as follows:

a. Reporting_status_flag gets updated with gstn_acck_status from inbound details


b. gstn_acck_status updated with gstn_acck_status from inbound details
c. match_status_flag updated with match_status_flag from inbound details
d. action_flag with action_flag from inbound details
e. record_type_code as GSTIN_INB_UPDT

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.

This ends the program which got submitted in


background once the process button is clicked in
review repository form.

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

You might also like