Está en la página 1de 31

INTERFACE

Inter face is a process loading data from legacy system to oracle database
(or) Oracle database to Text files or Excel files. We have mainly two types of
interfae
1.Inbound interface
2.Outbound interface

1 . Inbound interface :
Inbound is a process data loading from legacy flat files to
Oracle database.

Exceldata Oracle Database

All Interfaes having its own interface tables before loading data into Base
table.
All interface tables having (_interface)
Ex: AP_INVOICE_INTERFACE
PO_INVOICE_INTERFACE
By the following query we can find list of interface tables
SELECT * from tab where tname like %_INTERFACE;



Inbound interrface

*InBound Interface Process :
Sql*loader

Pl/Sql progam







Sql*loader :
Sql*loader is a tool to load data from flat file to Oracle tables .
We have mainly 5 types of fields
1 . Data file
2 . Control file
3 . log file
4 . band file
5 . discard file


Flat files
Interface tables
Staging table
Base tables
Error Tables
Stdrd error tables
If any standerd error
If any error
1 . Data file :
Data file is a flatfile having the budines data to load flat file in the
formatt of .txt , .csv , .dat ..etc
2 . Control file:
Control file is a program writing instructions to load which flatfile to
Oracle tables and extension should be .ctl
Syntax :
Load Data
Infile File path
<method> into table <table name>
Fields terminated by <Delimeter>
Optionally enclosed by <Delimeter>
Trailing Null cols(column1,column 2.column 3..)

XXSTD_DTLS (Table name)
C:\XXSTD Data_txt
1 naresh , 5000 , 01-jan-13
2 raju ,600 , 02-jan-14
3 gopal , , 04-jan-13
.
.
..
.1000
XXSTDDATA.ctl :
Load data
Infile c:\XXSTDDATA.txt
<METHOD> into table XXSTD_DTLS
Filelds terminated by ,
Optionally terminated by
Trailing nullcolumns (Sno , Sname , Fee , Joindate)

Insert :
In insert method table must be empty
Append :
In append method the new records rewrite to the old data from the
lastline.
Replace :
In replace method data will be overwrited
Truncate :
In truncate method data will be overwrite and delete the space also.

Load To load num of specific records
Skip To skip num of specific records
Rows To issue commit explicitly for a num of specific record

Ex :
Flatfile having 1000 records out of which skip 50 records between 751 to
800 and commit the data for every 100 reords
Load = 750
Skip = 50
Load =200
Rows = 100

Filter :
To skip the specific column
Ex: Skip the Fee column
Trailing Null cols(Sno , Sname , Fee Filter , Joindata)
When :
To write the condition
Ex: Skip the record whih having * mark
When(1:1)<> *
We can use all predefined functions in control file like Upper() , Trim() ,
Sum() , Constant and we cant use any userdefined functions
(Sno Trim(:Sno) ,
Sname Upper(:sname) ,
Fee Filter,
Joindate)
How to run Sql*loader :
Oracle :
C:\Sqlldr userid = apps/apps control = XXSTD_DATA.ctl
Oracle apps:
Move .ctl Custom_top\12.0.0\bin

Create the Executable by taking
Exwcutable Method
Executable Filename

3 .log file :
Log file generate automatically once run the control files execution
should be .log and It provide information like how many records are loaded ,
Notloaded .etc

4.Bad file :
Bad file will be generated whenever errors in the flatfile the
extension should be .bad
Ex: Data mismatch , Invalid dataype , Junk character
5.Discard file :
Discard file will be generate whenever condition fail in control file .
extension should be .dis
Ex: when class failed data
Sql*loader
XXSTD_DATA
Case study :
1.load the single flat file into multiple tables
2.load the multiple flat files to single table
3.load the large objects
4.load the images.


In Inbound interface we have mainly 3 stages :
Stage 1 :
Use sql*loader write the control files. To load the data from flat file
to staging table.

Stage 2:
Develop a pl/sql procedure to load data from staging table to
interface table and write the validation logic to successful data into interface
table. Error data into error table.

Stage 3 :
Switch to specific responsibility and run the standard concurrent
program to load data from interface table to base table and if any setup error it
goes to standard error table


Stage 4 :
Create a Request set for stage1 and stage2 to run sequentially and
schedule the Request set to run on specific interval(Shell script prog)

Stage 5 :
Develop a outbound interface to extract all error table data into excel
sheet

Stage 6 :
Develop a email procedure which will send the status to client status.
Onsite team will identify the type of issue raise the error records and reload
the data Once again.
Staging table creation :
We should maintain our own temporary tables for pre-validation and
map the flatfile structure. We should create Staging table based on interface table
by taking only structure.
Syntax :
Create table <Staging table>
As select column 1,
Column 2,
Column 3
From <Interface table>
Where 1=2;
Interface component:
Worked on GL interface to upload the legacy flat file journal data into
GL base table
Note: journal is a transaction and each record having two lines i.e Credit and
Debit
Credit Debit
10,000 0
0 10,000
















XXGLDATA.dat
XXGL_INTERFACE_STG
GL_INTERFACE
GL_JE_BATCHES
GL_JE_HEADERS
GL_JE_LINES
1.Sql*loader 2.utl file
3 .external file/Tables

Pl/sql program
Standard concurrent
program
XXGLDATA.ctl
XXGLDATA_PROC
Switch to GL
XXGLDATA.dat :
"NEW","1","11_AUG_2002","USD","11_AUG_2002","1318","A","Inventory","Jfor
ms","Corporate","01","110","7730","0000","000","1100","0","1100","0","62","XX
SIVA","BATCH_SIVA","XXSIVA_JOURNAL","JOURNL_DESC"
"NEW","1","11_AUG_2002","USD","11_AUG_2002","1318","A","Inventory","Jfor
ms","Corporate","01","110","7730","0000","000","0","1000","0","1000","62","XX
SIVA","BATCH_SIVA","XXSIVA_JOURNAL","JOURNL_DESC"

Staging table creation:
Connect to gl schema and create the table like below
Sql> conn gl/gl@vis
create table XXGL_INTERFACE_STG_SP
as select
status
,ledger_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
from
gl_interface
where 1=2;
Sql > Table created
Sql>Grant all on XXGL_INTERFACE_STG to apps;
Sql>Grant Successful
Sql>Conn apps/apps@vis
Sql>create Synonym XXGL_INTERFACE_STG for GL.XXGL_INTERFACE_STG;
Sql>Synonym created

Stage1:
Use sql*loader to load data from flatfile to staging table
Step1:
Develop a control file and save it as a .ctl
Ex:XXGLDATA.ctl
Load data
infile '/u01/oracle/VIS/apps/apps_st/appl/gl/12.0.0/bin/XXGLDATASP1.dat'
Truncate into table XXGL_INTERFACE_STG_SP
Fields terminated by ','
Optionally enclosed by '"'
Trailing nullcols
(status
,LEDGER_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
,reference1
,reference2
,reference4
,reference5
)
Step2:
Move the .ctl file into server
Step3:
Create the Executable
Executable : XXGLDATA_EXEC
Short name : XXGLDATA_EXEC
Application : General Ledger
Description :
Execution method : Sql*loader
Execution filename : XXGLDATA
Create the concurrent program and attach the executables
XX General Ledger Stp

Assign the concurrent program to GL Request group
Group : GL Concurrent Program Group
Application : General Ledger
Switch to GL Responsibility submit your sql*loader program. Once request
completed normal and data go to from flat file to staging table

Stage 2:
Develop a pl/sql procedure to load data from staging table to Interface
table . write the validation logic to load successful data into interface table and
error data into log file.(i.e) if error table required.
Steps:
Connect to apps schema and develop a procedure like below
CREATE OR REPLACE PROCEDURE XXGL_INTERFACE_SIVA_PROC
(errbuf OUT VARCHAR2
,retcode OUT VARCHAR2)IS
--cursor declaration
CURSOR gl_cur IS
SELECT STATUS
,LEDGER_ID
,ACCOUNTING_DATE
14/02/2014
,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_CR
,ENTERED_DR
,ACCOUNTED_CR
,ACCOUNTED_DR
,REFERENCE1
,REFERENCE2
,REFERENCE4
,REFERENCE5
,GROUP_ID
FROM XXGL_INTERFACE_STG_SP;
l_currencycode varchar2(25);
l_ledger_id number(3);
l_flag varchar2(2);
l_error_msg varchar2(100);
l_err_flag varchar2(10);
l_count number(9) default 0;
BEGIN
FOR rec_cur IN gl_cur
LOOP
l_count:=l_count+1;
l_flag:='A';
--ledger ID validation
BEGIN
SELECT ledger_ID
INTO l_ledger_id
FROM GL_LEDGERS
WHERE ledger_id=rec_cur.ledger_id;
EXCEPTION
WHEN OTHERS THEN
l_flag:='E';
l_error_msg:='LEDGER_ID Does Not Exist';
Fnd_File.put_line(Fnd_File.LOG,'Inserting data into the Interface
TABLE'||'_'||l_count||' '||l_error_msg);
END;
--currency code validation
BEGIN
SELECT currency_code
INTO l_currencycode
FROM fnd_currencies
WHERE currency_code=rec_cur.currency_code
AND currency_code='USD';
EXCEPTION
WHEN OTHERS THEN
l_flag:='E';
l_error_msg:='Currency Code Does Not Exists';
Fnd_File.put_line(Fnd_File.LOG,'Inserting data into the Interface
TABLE'||'_'||l_count||' '||l_error_msg);
END;
IF l_flag!='E' THEN
Fnd_File.put_line(Fnd_File.LOG,'Inserting data into the Interface TABLE');
INSERT INTO gl_interface(STATUS
,LEDGER_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_CR
,ENTERED_DR
,ACCOUNTED_CR
,ACCOUNTED_DR
,REFERENCE1
,REFERENCE2
,REFERENCE4
,REFERENCE5
,GROUP_ID)
VALUES(rec_cur.STATUS
,rec_cur.LEDGER_ID
,rec_cur.ACCOUNTING_DATE
,rec_cur.CURRENCY_CODE
,rec_cur.DATE_CREATED
,rec_cur.CREATED_BY
,rec_cur.ACTUAL_FLAG
,rec_cur.USER_JE_CATEGORY_NAME
,rec_cur.USER_JE_SOURCE_NAME
,rec_cur.USER_CURRENCY_CONVERSION_TYPE
,rec_cur.SEGMENT1
,rec_cur.SEGMENT2
,rec_cur.SEGMENT3
,rec_cur.SEGMENT4
,rec_cur.SEGMENT5
,rec_cur.ENTERED_CR
,rec_cur.ENTERED_DR
,rec_cur.ACCOUNTED_CR
,rec_cur.ACCOUNTED_DR
,rec_cur.REFERENCE1
,rec_cur.REFERENCE2
,rec_cur.REFERENCE4
,rec_cur.REFERENCE5
,rec_cur.GROUP_ID);
END IF;
l_flag:=NULL;
l_error_msg:=NULL;
END LOOP;
COMMIT;
END;

Compile the procedure and make sure procedure created successfully
Create the executable by taking execution method is pl/sql stored
procedure and execution file name is Procedure name
Create the concurrent program and attach the Executable
Assign the Concurrent Program and attach the Executable
Switch to GL Responsibility submit your pl/sql Concurrent Program. Once
request completed normal data goes from staging table to interface table.
If any error check the log file (or) error table

Stage3:
Switch to specific responsibility and run the standard Concurrent program
to load data from interface table to base table
Switch to GL responsibility and run the standard concurrent program i.e
journal import
Navigation is
Journal


Import
Run


Source Jetforms
Ledger_id Vision operation(usa)
Click on import button
It asks you are you start general import click on yes the request is submitted. Find
the request. Once request completes normal the data goes from the interface
table to base table and check the base tables
(GL_JE_HEADERS,GL_JE_LINES,GL_JE_BATCHES)


Request Set :
Request set is a collection of concurrent program to submit more than one
program at a time and make sure programs will run by as partially or sequentially
Steps:
Go to system administrator
Navigation is
concurrent

click on request set wizard button
Select sequentially and click on next
Select abort processing and click on next

Set : XXGLREQUEST_INTERFACE
Application : General Ledger
Select As each request in the set completes
Select your programs and click on finish button. Request set has been
created
Assign the Request set to Request Group
15/02/2014
set
In Request Group
Type
Set
Switch to Responsibility run the Request Set
Navigation is
view


Select the Request set

Click on next

How to schedule Request or Request Set :
Select the request or request set click on schedule button
We have mainly 4 options
1. As soon as possible
Its a default and request submitted automated or Immedia
2. F
To fire only once on a specific date and time.
3. S
To schedule request on a given date range for every day month mins
4. On specific
To submit a request on a given date range and given cal days
To save the schedule select save the schedule and provide schedule
name
To apply same schedule to other program click on apply a saved schedule
button and select the schedule
request
Submit new request
Note:
In unix environment we should write shellscript program for scheduling,
crownjobs , while transfers connecting oracle.etc

Component2:
Worked on GL_DAILY_RATES_INTERFACE to upload exchange rates from
one currency to other currency GL module















Flat file
Staging table
GL_Daily_Rates_Interface
GL_Daily_Rates
OUTBOUND is a process extracting data from oracle database to
external files.
we should generally creates outbound interface to extract business
data into excel and sending to any Third party whenever they are requesting
Ex: vendors , customer , bank , agents.etc
Extracting all employee payroll data into excel sheet and sending to
bank for crediting their salaries



We should use UTL_File for OutBound purpose
UTL_File :
It is an package utility to read or write data into textfiles.
The main attributes are
UTL_File.File_Type
UTL_File.Fopen
UTL_File.put-line
UTL_File.Fclose
UTL_File.Fclose_all

UTL_File.File_Type:
This attribute is used to declare the variable as UTL File variable
Ex:
OUTBOUND INTERFACE
Oracle
Databse
Excel/textfiles
Outbound
Interface
UTL_File.Fopen :
This attribute is used will generate the textfile after writing in a
specific directory path.
Ex: UTL_File.Fopen (filepath , filename , method);
Filepath:
Files will generate I only specific directory path by the following query we
can find UTL_File in directory path.
SELECT * from v$parameter where name like UTL_File;
To change the directory path go to init.orafile then change the parameter
value for UTL_FILE_dir
Ex: UTL_File_dir(d:\outbound)
Filename :
User defined filename and which will generate at run time
Method :
We have 3 methods
W for writing
A for append
R for read

UTL_File.put_line :
This attribute is used to generate the text files in localsystem or server
where as to display the output in browser window
UTL_File.Fclose :
This attribute is used to close the UTL_file variables which are opened
Out bound purpose
pipurpose
In bound purpose
UTL_File.fclose_all :
This attribute is used to close all the UTL_File variable which are opened
and mostly we can using Exceptions.
UTL_File Exceptions :
UTL_File.Invalid_path
UTL_File.Invalid_mode
UTL_File.Invalid_file
UTL_File.Write_error
UTL_File.Read_error
When others

Example:
Develop a outbound interface to extract all invoices details which are paid
in the given date range.








We have mainly two types of columns
1. Data base columns
2. Who columns

In database columns
we have System columns
Business columns

Flat file having only business columns and to load the business data, setup
columns , sequence colums must be required. i.e setup columns must be exist and
business data should not be exist
Who columns will capture with the API FND_global

Ex:
Insert into gl_interface (ledger_id
,currency_code
,created_by
,creation_date
.
.
.
Values(i.ledger_id
,i.currency_code
.
.
Fnd_global.user_id,
Sysdate,
,fnd_global.login_id);

18/02/2014

Conversion S:
Conversion is a migration process to upload all legacy historical data into
ERP system.
Conversion Interface
It is a one time process It is a repetating and cheduled process
In conversion loading data directly into the
base tableby calling the standard APIs
In interface loading data into interface
table and then into base table by running
the standard concurrent program
In conversion we know exact volume of the
datatype
In interface we dont know size of the flat
file
Conversion mostly we are using
implementation time
Interface mostly using supporting time
Conversion process
Faltfile






Interface process
Flat file

Conversion documents are
Cv040 conversion function
Cv060 conversion technical
Interface documents are
Md050 interface functional
Md070 interface Technical
Ex for conversion
1.customer conversion
2.receipt conversion
3.vendor conversion
Ex for interface
1.gl interface
2.po interface
3.sales order interface
4.item interace
5.customer interface
Temporary table
Base table
Staging table
Interface table
Base table
Customer Conversion APIs :
1. HZ_PARTY_V2PUB.CREATE_PERSON :

This API is used to create person on that table is HZ_PARTIES.
Important parameters are:
Party_id
Party_name
Person_number
Party_title
Profile_id

2. HZ_CUSTOMER_PROFILE_V2PUB.CREATE_CUSTOMER_PROFILE :
This API is used to create a customer profile onthat table is
HZ_CUSTOMER_PROFILES

3. HZ_CUST_ACCOUNTS_V2PUB.CREATE_CUST_ACCOUNTS :
This API is used to create customer account for the person or
organization that table is HZ_CUST_ACCOUNTS
4. HZ_LOCATION_V2PUB.CREATE_LOCATION :
This API is used to create address location details the table is
HZ_LOCATIONS.
5. HZ_PARTY_CONTACT_V2PUB.CREATE_ORG_CONTACT :
This API is used to create contact details for organization or person.
That table is HZ_ORG_CONTACTS
19/02/14
6. HZ_CONTACT_POINT_V2PUB.CREATE_PHONE_CONTACT_POINT :
This API is used to create contact point details for an party or party_site
that table is HZ_CONTACT_POINTS.

Component 3:
Worked on AP_INVOICE_INTERFACE to upload legacy invoice to AP_module
















Flat file
Staging table
AP_Invoices_Interface
AP_Invoice_lines_Interface
AP_Invoices_all
AP_Invoice_lines_all
AP_Invoice_distributions_all
AP_Payment_Schedules_all

AP_Interface_rejections
Sql*loader
Pl/sql Stored
procedure
Standard concurrent
program
Payables open
interface import
If any error
Email Procedure :
We should use UTL_SMTP API to send a mail from pl/sql.
The main attributes are
UTL_SMTP.Connection
UTL_SMTP.open_connection(servername , port no)
UTL_SMTP.mail
UTL_SMTP.rcpt
UTL_SMTP.data (connection, message)
UTL_SMTP.quit (connection,variable)
The main exceptions are
1. UTL_SMTP.Invalid operation
2. UTL_SMTP.Transient_error
3. UTL_SMTP.Perminent_error
When error
Example:

21/02/2014

También podría gustarte