Вы находитесь на странице: 1из 16

 Contact

Interfaces
INTERFACES

Interface is nothing but a program will be used to transfer the data from flat files to database table or
from database table to flat files with validations. WE have two types of Interfaces like Inbound Interface
Outbound Interface.

Inbound Interface
It will be used to upload the data from legacy system into Oracle Applications base table
Note: Legacy system is nothing but other applications which is used by client like SAP, JAVA, Mainframe
so on.

Example: In implementation project we can implement forms and report so that users can enter the
data after implementation but the previous data will be available in the legacy system we need to bring
that data in to Oracle Applications with validations.

Usage: SQL*Loader, .txt, .ctl, .dis, .bad, .log

Outbound Interface
It will be used to extract the data from Oracle Applications base tables in to flat files
Example: Client is using to applications one is for financial and another one is for manufacturing, we
have to transfer manufacture data in to financial applications, so that we can generate the Invoices in
financial applications.
Usage: UTL_FILE_PACKAGE
UTL_FILE.FOPEN() – Crate / Open file
UTL_FILE.PUT_LINE() – Transfer the data in to file
UTL_FILE.FCLOSE() – Close file
Exercise – OUTBOUND INTERFACE
We can generate flat file only in specified directory – to find directory list
Select * from V$PARAMETER Where NAME like ‘%UTL_%
Or
“INIT.ORA” file contains the information about active directory list.

Flat file Requirement

PO Number, Type, Creation date, Buyer Name,

PO Type – STANDARD Purchase orders only

Process Steps
1) Develop a procedure or package and register it as Concurrent Program
2) Writ the cursor to retrieve the data from database
3) Define the file by using UTL_FILE.FOPEN()
4) Open the cursor for loop and transfer the data in to file by using UTL_FILE.PUT_LINE()
5) Close the cursor and close the file by using UTL_FILE.FCLOSE()

*** Inbound Interface

Process Steps:

1) Stage Table Creation


2) Control file development
3) PL/SQL Program
4) Submit Standard Program
Inbound interface will be used to upload the data from legacy system in to Oracle applications base
tables.
We will receive the flat file from the client then we will create staging table upload the data from
flat file in to stage table.

 Develop the PL/SQL program to validate the data weather it is valid or not, if it is valid we will insert
in to interface table, if it is not valid we will insert in to error table.

 Once the data is available in interface table submit the standard program from SRS window, and we
will transfer the data from interface table to base tables.

Note
Staging table is required because the flat file structure may or may not be compatibles with base table
structure.

Interface table is required to make the pre validation and populate dynamic records.

GL Interface

GL_INTERFACE_TABLE

STATUS: This column will accept any string but we will always insert standards string called new it
indicates that we are brining new data in to General Ledge Applications.

SET_OF_BOOKS_ID: We have to enter the appropriate set of books ID, it should be valid set of books id
is available in GL_SETS_BOOKS table it is valid, otherwise i8t is invalid.

USER_JE_SOURCES_NAME: We have to enter the journal sources name for the transaction we can find all
the valid source names in the tabled called GL_JE_SOURCES.

USER_JE_CATEGORY_NAME: WE have to find out weather journal category is available in the


GL_JE_CATEGORIES table. It is is available then we will insert, otherwise we will reject.

CURRENCY_CODE: We have to enter the valid currency code in FND_CURREINCES table we can find out
weather it is valid or not.

ACCOUNTING_DATE and CREATION_DATE: Both columns will accept valid date but that date should be
less than or equal to System date.

CREATED_BY: WE have to enter valid user_id from FND_USER table we can identify weather it is valid
user_id or not.

PERIOD_NAME: We have to enter valid period name and period should be in the open status from
GL_PERIODS table we can find out weather it is valid period or not, from GL_PERIOD_STATUS table
we can find out period is in the open status or not.

ENTERED_DR and ENTERED_CR: Both columns will accept positive number Debit and credit amount,
both debit and credit should be equal otherwise account will be imported as suspense account.

GROUP_ID: WE will enter unique group number while importing from interface table to base table it will
be used as parameter.

CTUAL_FLAG: This column will accept single character either ‘A’ or ‘B’ or ‘E’ a- Actual amounts, B-
Budget Amounts, E- Encumbrance Amounts

Reference 1 – Batch Name


Reference 2 – Batch Description
Reference 3 – Don’t Enter any value
Reference 4 – Journal Entry Name
Reference 5 – Journal Entry Description
Reference 11 to 20 – Don’t enter any values.
Chart_of_accounts_id – Don’t enter any values.
Transationc_date – Don’t enter any values.
Je-Batch_id – Don’t enter any values.
Je_header_id – Don’t enter any values.
Pre requisites for GL Interface:

1) Set of books should be defined (Currency, Calendar, Chart of Accounts)


2) Currency Conversion Rates needs to be defined.
3) Accounting Period should be defined and also opened
4) Source name and as well as category name should be defined.
Process Steps:
1) We have received flat file from client
2) We have created Staging table as per flat file structure
3) Developed Control file and uploaded data
4) Developed PL/SQL Program to upload the data from stage into interface table

i. declare Cursor
ii. open cursor
iii. Validate each record
iv. If no invalid record then insert into interface table.
5) Run the journal import from GL => Journal => Import => Run
i. Give the two parameters 1)Source 2)Group ID
6) Open the Output if status is ‘SUCEESS’ then take Request ID.
7) open Journal Enter screen Query the records based on the %requestid% As batch Name – Select
Review journal button we can see the journal detailed transaction
8) If we want correct the journals we can correct from Journal=>Import=>Correct
9) If we want delete the journals we can delete from Journal=>Import=>Delete

Temporary Table Creation

Create Table GL_INT_TEMP (


STATUS Varchar2(10),
SET_OF_BOOKS_ID Number(8),
ACCOUNTING_DATE, Date,
CURRENCY Number(8),
DATE_CREATED Date,
CREATED_BY Number(8),
ACTUAL_FLAG Varchar2(1),
CATEGORY Varchar2(10),
SOURCE Varchar2(10),
CURR_CONVERSION Number(8),
SEGMENT1 Varchar2(100),
SEGMENT2 Varchar2(100),
SEGMENT3 Varchar2(100),
SEGMENT4 Varchar2(100),
SEGMENT5 Varchar2(100),
ENTERED_DR Number(8),
ENTERED_CR Number(8),
ACCOUNTED_DR Number(8),
ACCOUNTED_CR Number(8),
GROUP_ID Number(8) );

view rawgistfile1.sql hosted with by GitHub

Control File Creation – To transfer the data from flat file to staging table.

LOAD DATA
INFILE *
INSERT INTO TABLE GL_INT_TEMP
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(STATUS,
SET_OF_BOOKS_ID,
ACCOUNTING_DATE,
CURRENCY,
DATE_CREATED,
CREATED_BY,
ACTUAL_FLAG,
CATEGORY,
SOURCE,
CURR_CONVERSION,
SEGMENT1,
SEGMENT2,
SEGMENT3,
SEGMENT4,
SEGMENT5,
ENTERED_DR,
ENTERED_CR,
ACCOUNTED_DR,
ACCOUNTED_CR,
GROUP_ID)

BEGINDATA

"NEW",1,"11-AUG-2002","USD","11-AUG-2002",1318,"A","Inventory","JETFORMS","Corporate","01","000","1410",
"NEW",1,"11-AUG-2002","USD","11-AUG-2002",1318,"A","Inventory","JETFORMS","Corporate","01","000","1410",
"NEW",1,"11-AUG-2002","USD","11-AUG-2002",1318,"A","Inventory","JETFORMS","Corporate","01","000","1410",
"NEW",1,"11-AUG-2002","USD","11-AUG-2002",1318,"A","Inventory","JETFORMS","Corporate","01","000","1410",
"NEW",1,"11-AUG-2002","SGD","11-AUG-2002",1318,"K","Inventory","JETFORMS","Corporate","01","000","1410",
"NEW",1,"11-AUG-2002","EUR","11-AUG-2002",1318,"A","Inventory","JETFORMS","Corporate","01","000","1410",

Creation of PL/SQL procedure – to transfer the data from staging table to interface table after
validation.

CREATE OR REPLACE PROCEDURE GL_IN_PRO( Errbuf OUT VARCHAR2,


Retcode OUT VARCHAR2)
IS
-- cursor declaration
CURSOR gl_cur IS
SELECT
status ,
set_of_books_id ,
accounting_date ,
currency ,
date_created ,
created_by ,
actual_flag ,
category ,
source ,
curr_conversion ,
segment1 ,
segment2 ,
segment3 ,
segment4 ,
segment5 ,
entered_dr ,
entered_cr ,
accounted_dr ,
accounted_cr ,
group_id
FROM GL_INT_TEMP;
l_currencycode VARCHAR2(25);
l_set_of_books_id NUMBER(3);
l_flag VARCHAR2(2);
l_error_msg VARCHAR2(100);
l_err_flag VARCHAR2(10);
l_category VARCHAR2(100);
L_USERID NUMBER(10);
BEGIN
DELETE FROM gl_interface;
COMMIT;
FOR rec_cur IN gl_cur LOOP
l_flag:='A';
l_err_flag:='A';
--This PL/SQL Block will do the currency validation
--end of the currency validation
--Category Column Validation
BEGIN
SELECT USER_JE_CATEGORY_NAME
INTO l_CATEGORY
FROM GL_JE_CATEGORIES
WHERE USER_JE_CATEGORY_NAME = REC_CUR.Category;
EXCEPTION
WHEN OTHERS THEN
l_category:=NULL;
l_flag:='E';
l_error_msg:='Category does not exist ';
END;
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
--End Category Column Validation
--User ID column validation
BEGIN
SELECT USER_ID
INTO L_USERID
FROM FND_USER
WHERE USER_ID = REC_CUR.created_by;
EXCEPTION
WHEN OTHERS THEN
L_userid:=NULL;
l_flag:='E';
l_error_msg:='User ID does not exist ';
END;
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
--End of Created_by OR UserID column Validation
--Set of books Validation
BEGIN
SELECT set_of_books_id
INTO l_set_of_books_id
FROM GL_SETS_OF_BOOKS
WHERE set_of_books_id=rec_cur.set_of_books_id;
EXCEPTION
WHEN OTHERS THEN
l_set_of_books_id:=NULL;
l_flag:='E';
l_error_msg:='set of Books ID does not exist ';
END;
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
-- End Set of books Validation
--Status Column validation
/* BEGIN
IF rec_cur.status = 'NEW' THEN
l_flag:= 'A';
ELSE
l_flag:= 'E';
Fnd_File.put_line (Fnd_File.LOG,'Status column has got invalid data');
END IF;
END;*/
BEGIN
SELECT currency_code
INTO l_currencycode
FROM fnd_currencies
WHERE currency_code=rec_cur.currency
AND currency_code='USD';
EXCEPTION
WHEN OTHERS THEN
l_currencycode:=NULL;
l_flag:='E';
l_error_msg:='currency code does not exists';
END;
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
--End of Actual Flag Column validation
IF l_flag!='E' THEN
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE');
INSERT INTO gl_interface(status,
set_of_books_id,
accounting_date,
currency_code,
date_created,
created_by,
actual_flag,
user_je_category_name,
user_je_source_name,
user_currency_conversion_type,
segment1,
segment2,
segment3,
segment4,
segment5,
entered_dr,
entered_cr,
accounted_dr,
accounted_cr,
group_id)
VALUES
(rec_cur.status ,
rec_cur.set_of_books_id ,
rec_cur.accounting_date ,
rec_cur.currency ,
rec_cur.date_created ,
rec_cur.created_by ,
rec_cur.actual_flag ,
rec_cur.category ,
rec_cur.source ,
rec_cur.curr_conversion ,
rec_cur.segment1 ,
rec_cur.segment2 ,
rec_cur.segment3 ,
rec_cur.segment4 ,
rec_cur.segment5 ,
rec_cur.entered_dr ,
rec_cur.entered_cr ,
rec_cur.accounted_dr ,
rec_cur.accounted_cr ,
rec_cur.group_id);
END IF;
l_flag:=NULL;
l_error_msg:=NULL;
END LOOP;
COMMIT;
END GL_IN_PRO;

Creation of Package: Package Specification:

CREATE OR REPLACE package APPS.GL_INTER as


PROCEDURE GL_PRO(ERRBUF OUT VARCHAR2,
RETCODE OUT VARCHAR2 );

PROCEDURE CATEGORY(l_category_name IN Varchar2,


l_flag OUT Varchar2);

function CREATED_BY(l_created_by IN Number) return char;


function Books (l_id in number) return char;

Procedure errors_gl(r_no in number,


c_name in varchar2,
err_msg in Varchar2);

END GL_INTER;
/

Package Body:

CREATE OR REPLACE package body APPS.GL_INTER as


PROCEDURE errors_gl(r_no in number,
c_name in varchar2,
err_msg in varchar2) is
begin
INSERT INTO GL_ERROR(RECORDNO,
COLUMN_NAME,
ERR_MESG)
VALUES(r_no,
c_name,
err_msg);
end;
PROCEDURE CATEGORY(l_category_name IN varchar2,
l_flag OUT varchar2) is
l_ca_name Varchar2(100);
Begin
SELECT USER_JE_CATEGORY_NAME
INTO l_ca_name
FROM GL_JE_CATEGORIES
WHERE USER_JE_CATEGORY_NAME = l_category_name;
l_flag := 'A';
Exception
When others then
l_flag := 'E';
Fnd_File.put_line (Fnd_File.LOG,'Category Does Not Exist');
End;
function CREATED_BY(l_created_by in number) return char is
l_userid NUMBER(9);
begin
SELECT USER_ID
INTO l_userid
FROM Fnd_user
WHERE user_id = l_created_by;
return('A');
Exception
When others then
return('E');
Fnd_File.put_line (Fnd_File.LOG,'User ID Does not exist');
End;
function Books(l_id in number) return char as
l_set_id NUMBER(9);
begin
SELECT SET_OF_BOOKS_ID
INTO l_set_id
FROM GL_SETS_OF_BOOKS
WHERE SET_OF_BOOKS_ID = l_id ;
RETURN('A');
Exception
when others then
return('E');
Fnd_File.put_line (Fnd_File.LOG,'Set of Boos ID Does not exist');
End;
PROCEDURE GL_PRO(Errbuf OUT VARCHAR2,
Retcode OUT VARCHAR2) IS
-- cursor declaration
CURSOR gl_cur IS
SELECT
status ,
set_of_books_id ,
accounting_date ,
currency ,
date_created ,
created_by ,
actual_flag ,
category ,
source ,
curr_conversion ,
segment1 ,
segment2 ,
segment3 ,
segment4 ,
segment5 ,
entered_dr ,
entered_cr ,
accounted_dr ,
accounted_cr ,
group_id
FROM XX_GL_TEMP;
l_currencycode VARCHAR2(25);
l_set_of_books_id NUMBER(3);
l_flag VARCHAR2(2);
l_error_msg VARCHAR2(100);
l_err_flag VARCHAR2(10);
l_category VARCHAR2(100);
L_USERID NUMBER(10);
l_count NUMBER(9) default 0;
l_source varchar2(100);
BEGIN
DELETE FROM gl_interface;
COMMIT;
FOR rec_cur IN gl_cur LOOP
l_count:=l_count+1;
l_flag :='A'; --No Error
CATEGORY(rec_cur.category,
l_flag );
l_flag := CREATED_BY(REC_CUR.created_by);
l_flag := Books (REC_CUR.SET_OF_BOOKS_ID);
--Cuurency Code Validation
BEGIN
SELECT currency_code
INTO l_currencycode
FROM fnd_currencies
WHERE currency_code=rec_cur.currency
AND currency_code='USD';
EXCEPTION
WHEN OTHERS THEN
l_flag:='E';
l_error_msg:='currency code does not exists';
errors_gl(L_count,
'CURRENCY_CODE',
'Invalid Currency Code');
END;
--Source Column Validation
BEGIN
SELECT USER_JE_SOURCE_NAME
INTO l_source
FROM GL_JE_SOURCES
WHERE USER_JE_SOURCE_NAME = rec_cur.source;
EXCEPTION
WHEN Others Then
l_flag:='E';
l_error_msg:='Source Name does not exists';
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface
TABLE'||'-'||l_count||' '||l_error_msg);
END;
-- End of Source Column Validation
IF l_flag!='E' THEN
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE');
INSERT INTO gl_interface(status,
set_of_books_id,
accounting_date,
currency_code,
date_created,
created_by,
actual_flag,
user_je_category_name,
user_je_source_name,
user_currency_conversion_type,
segment1,
segment2,
segment3,
segment4,
segment5,
entered_dr,
entered_cr,
accounted_dr,
accounted_cr,
group_id)
VALUES
(rec_cur.status ,
rec_cur.set_of_books_id ,
rec_cur.accounting_date ,
rec_cur.currency ,
rec_cur.date_created ,
rec_cur.created_by ,
rec_cur.actual_flag ,
rec_cur.category ,
rec_cur.source ,
rec_cur.curr_conversion ,
rec_cur.segment1 ,
rec_cur.segment2 ,
rec_cur.segment3 ,
rec_cur.segment4 ,
rec_cur.segment5 ,
rec_cur.entered_dr ,
rec_cur.entered_cr ,
rec_cur.accounted_dr ,
rec_cur.accounted_cr ,
rec_cur.group_id);
END IF;
l_flag:=NULL;
l_error_msg:=NULL;
END LOOP;
END ;
END;
/

view rawgistfile1.sql hosted with by GitHub

Overview:
Oracle provides flexible tools in the form of Interface programs to import the
master and transactional data like Customers, Invoices, and Sales Orders
etc from external systems into Oracle Applications or to transfer the data
from one module to another module.

There are 2 types of interfaces:

1)Inbound Interface: will be used to upload the data from legacy system
(Flat files) into Oracle Applications base tables.
2)Outbound Interface: will be used to extract the data from oracle Database
tables into the flat files.
Conversion/Interface Strategy:
1. Data Mapping
During the data mapping process, list of all the data sets and data
elements that will need to be moved into the Oracle tables as part of
conversion are identified. Data mapping tables are prepared as part of
this activity that show what are the data elements that are needed by the
target system to meet the business requirements and from where they
will be extracted in the old system.

2. Download Programs
After the conversion data mapping is complete, download programs are
developed that are used to extract the identified conversion data
elements from the current systems in the form of an ASCII flat file. The
structure of the flat file must match the structure of the Oracle standard
interface tables. These flat files generated may be in text form or a
comma or space delimited, variable or fixed format data file.
3. Upload Program
Once the data has been extracted to a flat file, it is then moved to the
target file system and the data from the file is loaded into user defined
staging tables in the target database using SQL Loader or UTL_FILE
utilities. Then programs are written and run which validate the data in the
staging tables and insert the same into the Oracle provided standard
Interface tables.

4. Interface Program
Once the interface tables are populated, the respective interface program
(each data element interface has a specific interface program to run) is
submitted. The interface programs validate the data, derive and assign
the default values and ultimately populate the production base tables.

A typical path to transfer the data from Legacy System to Oracle Apps:

Interface/Conversion examples and details:

The below list of interfaces/conversions are covered in this section. Details


like pre-requisites required, interface tables, interface program, base tables,
validations that need to be performed after inserting the details into the
interface tables and required columns that need to be populated in the
interface table are discussed for each interface.

Вам также может понравиться