0% found this document useful (1 vote)
144 views

06 - CONVERSION - Oracle Outbound Interface Process With Example

This document outlines the steps to create a concurrent program that generates an output file with item on-hand quantity details from the apps schema tables. It involves: 1. Creating an output directory and file. 2. Defining a procedure to query the data, write headers and records to the output file, and log details. 3. Creating an executable and concurrent program associated with the procedure. 4. Assigning the program to a request group and responsibility to enable running the program.

Uploaded by

jaish2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
144 views

06 - CONVERSION - Oracle Outbound Interface Process With Example

This document outlines the steps to create a concurrent program that generates an output file with item on-hand quantity details from the apps schema tables. It involves: 1. Creating an output directory and file. 2. Defining a procedure to query the data, write headers and records to the output file, and log details. 3. Creating an executable and concurrent program associated with the procedure. 4. Assigning the program to a request group and responsibility to enable running the program.

Uploaded by

jaish2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

XXCUST_ITEM_ONHAND_QTY - XXCUST INV Item On-Hand Quantity Details Program

Step1: Create the outbound folder in server in custom bin folder

Step2: Create the directory in server for outbound files


CREATE DIRECTORY XXCUST_ITEM_QTY AS '/u02/E-BIZ/apps/apps_st/appl/XXCUST/12.0.0/bin/outbound';

Step3: Create the procedure and compile in apps schema


CREATE OR REPLACE PROCEDURE XXCUST_ITEM_ONHAND_QTY_PROC
(out_chr_errbuf OUT NUMBER,
out_chr_retcode OUT VARCHAR2
)
AS

/* *************************************************************************************
-- Package : XXCUST_ITEM_ONHAND_QTY_PROC
-- Script : XXCUST_ITEM_ONHAND_QTY_PROC.sql
-- Short Name : XXCUST_ITEM_ONHAND_QTY
-- Program : XXCUST INV Item On-Hand Quantity Details Program
************************************************************************************** */
g_num_user_id NUMBER := fnd_global.user_id;
g_num_login_id NUMBER := fnd_global.conc_login_id;
g_num_conc_req_id NUMBER := fnd_global.conc_request_id;
g_num_org_id NUMBER := fnd_global.org_id;
l_cur_row_count NUMBER := 0;
l_chr_program_name VARCHAR2(100);
--l_inv_count NUMBER;

l_output_file UTL_FILE.FILE_TYPE;

CURSOR qty_cur
IS
SELECT moq.organization_id,
ood.organization_name org_name,
mc.segment1 || ',' || mc.segment2 item_Cat,
msi.segment1 item_num,
msi.description item_des,
SUM (moq.transaction_quantity) qty
FROM apps.mtl_onhand_quantities moq,
inv.mtl_system_items_b msi,
org_organization_definitions ood,
mtl_item_categories mic,
mtl_categories mc
WHERE msi.inventory_item_id = moq.inventory_item_id(+)
AND msi.organization_id = moq.organization_id(+)
AND msi.organization_id = ood.organization_id
AND msi.inventory_item_id = mic.inventory_item_id
AND msi.organization_id = mic.organization_id
AND mic.category_id = mc.category_id
AND msi.purchasing_item_flag = 'Y'
AND mc.segment1 || ',' || mc.segment2 = 'MISC,MISC'
AND moq.organization_id = 204
GROUP BY moq.organization_id,
msi.segment1,

RAJU CHINTHAPATLA
msi.description,
ood.organization_name,
mc.segment1,
mc.segment2
UNION
SELECT mmt.organization_id,
ood.organization_name org_name,
mc.segment1 || ',' || mc.segment2 item_Cat,
msi.segment1 item_num,
msi.description item_des,
SUM (mmt.transaction_quantity)
FROM apps.mtl_material_transactions mmt,
inv.mtl_system_items_b msi,
org_organization_definitions ood,
mtl_item_categories mic,
mtl_categories mc
WHERE msi.inventory_item_id = mmt.inventory_item_id(+)
AND msi.organization_id = mmt.organization_id(+)
AND msi.organization_id = ood.organization_id
AND msi.inventory_item_id = mic.inventory_item_id
AND msi.organization_id = mic.organization_id
AND mic.category_id = mc.category_id
AND msi.purchasing_item_flag = 'Y'
AND mc.segment1 || ',' || mc.segment2 = 'MISC,MISC'
AND mmt.organization_id = 204
GROUP BY mmt.organization_id,
msi.segment1,
msi.description,
ood.organization_name,
mc.segment1,
mc.segment2;

l_count NUMBER(5) DEFAULT 0;

BEGIN

out_chr_retcode := 0;
out_chr_errbuf := '';

-- To Find the Concurrent Program Name


BEGIN
SELECT user_concurrent_program_name
INTO l_chr_program_name
FROM fnd_concurrent_programs_tl
WHERE concurrent_program_id = fnd_global.conc_program_id
and language= USERENV('LANG');
EXCEPTION
WHEN OTHERS
THEN l_chr_program_name := NULL;
END;

--> CREATE DIRECTORY XXCUST_ITEM_QTY AS '/u02/E-BIZ/apps/apps_st/appl/XXCUST/12.0.0/bin/outbound';


-- select * from v$parameter where name like '%utl_file%'

l_output_file :=
UTL_FILE.FOPEN('XXCUST_ITEM_QTY','XXCUST_ITEM_ONHAND_QTY_'||TO_CHAR(SYSDATE,'YYMMDD:MISS')||'.txt', 'w');
-- l_output_file:=utl_file.fopen('/u01/E-
BIZ/db/tech_st/11.2.0.2/appsutil/outbound/VIS_aabc2018a','XXCUST_ITEM_ONHAND_QTY_'||TO_CHAR(SYSDATE,'YYMMDD
')||'.txt','W');

RAJU CHINTHAPATLA
--> Concurrent Program Output File
FND_FILE.PUT_LINE(fnd_file.output,'"Item Number","Item Id","Item Desc","UOM","Org Name","Org ID","Category"');
utl_file.put_line(l_output_file,'"Item Number","Item Id","Item Desc","UOM","Org Name","Org ID","Category"');

FOR x1 IN qty_cur
LOOP
BEGIN
l_count := l_count+1;
fnd_file.put_line(fnd_file.output, '"'||x1.org_name ||'","'|| x1.item_Cat ||'","'|| x1.item_num ||'","'||
x1.item_des ||'","'|| x1.qty||'"');
utl_file.put_line(l_output_file,'"'||x1.org_name ||'","'|| x1.item_Cat ||'","'|| x1.item_num ||'","'||
x1.item_des ||'","'|| x1.qty||'"');
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.log,'ERROR CODE: '||SQLCODE);
fnd_file.put_line (fnd_file.log,'ERROR MESSAGE: '||SQLERRM);
fnd_file.put_line (fnd_file.log,'Exception: OTHERS While Printing');
-- fnd_file.put_line (fnd_file.output,'Exception: OTHERS While Printing');
END;

END LOOP;
utl_file.fclose(l_output_file);

IF l_count = 0
THEN
fnd_file.new_line (fnd_file.output, 1);
fnd_file.put_line (fnd_file.output,'********************* No Data Found*********************');
fnd_file.new_line (fnd_file.output, 1);
fnd_file.put_line (fnd_file.output,'Record Count: '||l_count);
fnd_file.put_line (fnd_file.output, 'For Given Parameters combination, there are no records found/Invalid
parameter combination');
fnd_file.put_line (fnd_file.log, 'For Given Parameters combination, there are no records found/Invalid
parameter combination');
out_chr_retcode := 1;
END IF;

--> Concurrent Program Log File


fnd_file.put_line (fnd_file.log,' ');
fnd_file.put_line (fnd_file.log,' ');
fnd_file.put_line (fnd_file.log,'+---------------------------------------------------------------------------+');
fnd_file.put_line (fnd_file.log,'+------------------ Start of the Log File of the Request -------------------+');
fnd_file.put_line (fnd_file.log,'+---------------------------------------------------------------------------+');
fnd_file.put_line (fnd_file.log,'Concurrent Program Name : ' || l_chr_program_name);
fnd_file.put_line (fnd_file.log,'Submitted By the User Name : ' || fnd_global.user_name);
fnd_file.put_line (fnd_file.log,'Submitted Responsibility Name : ' || Fnd_profile.value('RESP_NAME'));
fnd_file.put_line (fnd_file.log,'Concurrent Program request ID : ' || g_num_conc_req_id);
fnd_file.put_line (fnd_file.log,'Concurrent Program Submitted on : ' || TO_CHAR (SYSDATE,'DD-Mon-YYYY
HH24:MI:SS'));
fnd_file.put_line (fnd_file.log,'No of Records Transfered to File : ' || l_count);
fnd_file.put_line (fnd_file.log,'No of Records Displyed in Output File : ' || l_cur_row_count);
fnd_file.put_line (fnd_file.log,'+---------------------------------------------------------------------------+');
fnd_file.put_line (fnd_file.log,' ');
fnd_file.put_line (fnd_file.log,' ');

EXCEPTION
WHEN utl_file.invalid_operation

RAJU CHINTHAPATLA
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 XXCUST_ITEM_ONHAND_QTY_PROC;

Step4: Create the Executable with above package


Nav : Application Developer Concurrent Executable

Enter the below values:


Field Value
Executable XXCUST_ITEM_ONHAND_QTY
Short Name XXCUST_ITEM_ONHAND_QTY
Application Custom Development

RAJU CHINTHAPATLA
Execution Method PL/SQL Stored Procedure
Execution File Name XXCUST_ITEM_ONHAND_QTY_PROC

Step 5: Create the Concurrent Program with above Executable


Nav : Application Developer Concurrent Program

Enter the below values:


Field Value
Program XXCUST INV Item On-Hand Quantity Details Program
Short Name XXCUST_ITEM_ONHAND_QTY
Application Custom Development
Executable Name XXCUST_ITEM_ONHAND_QTY
Parameters We are not passing any parameters

RAJU CHINTHAPATLA
Step6: Assign the concurrent program to Request group
Nav : System Administrator Security Responsibility Request

RAJU CHINTHAPATLA
Query the request group : All Inclusive GUI and add the concurrent program

Field Value
Group All Inclusive GUI
Application Inventory
Program XXCUST INV Item On-Hand Quantity Details Program

Step7: Goto the Inventory responsibility and run the submit the concurrent program to validate the data and insert into
interface table
Nav : Inventory, Vision Operations (USA)  View Requests Submit New Request Single Request

RAJU CHINTHAPATLA
Step 8: Once the program is completed, File will create in server location

RAJU CHINTHAPATLA

You might also like