Thursday, 2 February 2017

Interfaces

Interface is one of the PL/SQL program, which will be used to transfer the files from Legacy System to Oracle Application or from Oracle Applications to Legacy System. There are two types of interfaces in oracle apps.

 1. Inbound Interface.
 2. Outbound Interface.

Inbound Interface: To transfer the data from legacy system to oracle applications base tables is called inbound interface. In inbound interface we use SQL * Loader, External Tables,

Example: If the client is using the one or more applications like .net, SAP, java along with oracle applications. We need to develop inbound interface program to transfer other applications data to Oracle Applications.

Following are the steps used at inbound interface program development.

1. First we receive a flat file (data file) from client.
2. We will create staging/temp table based on the flat file structure (Columns).
3. By using SQL * Loader program, we will upload the data from flat file to staging table.
4. We will create a PL/SQL Package to validate the staging data and insert the valid data to oracle interface tables.
5. Run the Oracle Standard Import program to transfer the data from interface table to base tables in oracle.

Outbound Interface: To transfer the data from oracle applications to legacy system is called outbound interface. In outbound interface we use UTL_FILE package to extract the data from oracle apps base tables and will generate flat file.

Example: If the client is implemented two different application modules like HRMS and Financials. We have to transfer the HRMS data to financial modules.

Following are the steps used at outbound interface program development.

 1. Write the cursor to retrieve the required columns data from database tables
 2. Define the file using UTL_FILE.FOPEN().
 3. Open the cursor for loop and write all the records information to a file by using  UTL_FILE.PUT_LINE().
 4. Close the cursor and close the file by using UTL_FILE.FCLOSE().
 5. Create a package with above steps and register it as a concurrent program in oracle apps.

To find utl_file directory:-

Select * from V$Parameter where name like ‘%UTL_FILE%’;

Example:-

Create or Replace Procedure Supp_interface ( errbuf  out varchar2
  , retcode out varchar2)
As
Cursor c1 
   is
     SELECT  Pv.venodr_id   Vid
   , Pv.vendor_name Vname
, Pvs.vendor_site_code  Vsite
, Pvs.address_line1         Vaddress
, Pvs.City                        Vcity
  FROM   Po_vendors pv
   , po_vendor_sites_all pvs
  WHERE  Pv.vendor_id  =  pvs.venodr_id;

V_File    UTL_FILE.file_type;
V_Count   NUMBER (10) := 0;

Begin
 
v_file := UTL_FILE,fopen(‘d:\Oracle\Proddb\8.1.7\pl/Sql\temp’,’suppliers.dat’,’w’);

for c2 in c1
Loop
   v_count := v_count+1
UTL_FILE.PUT_LINE (v_file, C2.Vid ||’,’||
    C2.Vname ||’,’||
  C2.Address ||’,’||
  C2.Vcity);
End loop;

UTL_FILE.fclose (V_file);

FND_FILE.put_line (FND_FILE.output, ’Number of Records Transferred  =’||V_count);

Exception

  WHEN utl_file.invalid_operation THEN
   fnd_file.put_line(fnd_File.log,'invalid operation');
utl_file.fclose_all;
  WHEN utl_file.invalid_path THEN
fnd_file.put_line(fnd_File.log,'invalid path');
utl_file.fclose_all;
  WHEN utl_file.invalid_mode THEN
fnd_file.put_line(fnd_File.log,'invalid mode');
     utl_file.fclose_all;
  WHEN utl_file.invalid_filehandle THEN
   fnd_file.put_line(fnd_File.log,'invalid filehandle');
utl_file.fclose_all;
  WHEN utl_file.read_error THEN
   fnd_file.put_line(fnd_File.log,'read error');
utl_file.fclose_all;
  WHEN utl_file.internal_error THEN
   fnd_file.put_line(fnd_File.log,'internal error');
utl_file.fclose_all;
  WHEN OTHERS THEN
   fnd_file.put_line(fnd_File.log,'other error');
utl_file.fclose_all;

End Supp_interface;
FNDLOAD Commands:

1. Lookups
-- -------------
FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_CUSTOM_LKP.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="XXCUST" LOOKUP_TYPE="XX_LOOKUP_TYPE"

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_CUSTOM_LKP.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

2. Concurrent Program
-- -----------------------------
FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CUSTOM_CP.ldt PROGRAM APPLICATION_SHORT_NAME="XXCUST" CONCURRENT_PROGRAM_NAME="XX_CONCURRENT_PROGRAM"

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CUSTOM_CP.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

3. Profile
-- ---------
FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct XX_CUSTOM_PRF.ldt PROFILE PROFILE_NAME="XX_PROFILE_NAME" APPLICATION_SHORT_NAME="XXCUST"

$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct XX_CUSTOM_PRF.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE


4. Request Set and Link
-- ------------------------------
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct XX_CUSTOM_RS.ldt REQ_SET REQUEST_SET_NAME='REQUEST_SET_NAME'

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct  XX_CUSTOM_RS.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

5. FND Message
-- ---------------------
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_CUSTOM_MESG.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME="XXCUST" MESSAGE_NAME="MESSAGE_NAME%"

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_CUSTOM_MESG.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

6. D2K FORMS
-- ------------------
$FND_TOP/bin/FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FRM.ldt FORM FORM_NAME="FORM_NAME"
     
$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FRM.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

7. Form Function
-- ---------------------
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FUNC.ldt FUNCTION FUNCTION_NAME="FORM_FUNCTION_NAME"

$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FUNC.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

8. Alerts
-- ---------
FNDLOAD apps/apps 0 Y DOWNLOAD $ALR_TOP/patch/115/import/alr.lct XX_CUSTOM_ALR.ldt ALR_ALERTS APPLICATION_SHORT_NAME=XXCUST ALERT_NAME="XX - Alert Name"

FNDLOAD apps/apps 0 Y UPLOAD $ALR_TOP/patch/115/import/alr.lct XX_CUSTOM_ALR.ldt CUSTOM_MODE=FORCE

9. Value Set
-- --------------
$FND_TOP/bin/FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct XX_CUSTOM_VS.ldt VALUE_SET FLEX_VALUE_SET_NAME="XX Value Set Name"

$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afffload.lct XX_CUSTOM_VS.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

10. Data Definition and Associated Template
--- ----------------------------------------------------------
FNDLOAD apps/apps O Y DOWNLOAD  $XDO_TOP/patch/115/import/xdotmpl.lct XX_CUSTOM_DD.ldt XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME='XXCUST' DATA_SOURCE_CODE='XX_SOURCE_CODE' TMPL_APP_SHORT_NAME='XXCUST' TEMPLATE_CODE='XX_SOURCE_CODE'

FNDLOAD apps/apps O Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct XX_CUSTOM_DD.ldt