Wednesday, 24 August 2011

Order Management(OM) Integration Options

Order Management(OM) Integration Options

OM is one of the most complex modules in EBS, and in typical complex business model, the integration of other product or third party can't be denied. Processing an Order requires integration with many other business areas. Most integration points with other Oracle products are implemented via PL/SQL-based APIs.Here is brief discussion for Order Management EBS Integration points.

OM Integration

double-arrowHow Order Management integrated with iStore?

OM records customer orders placed via iStore, Order Capture and other CRM applications. It validates setup for shipping and payment options along with providing order status and the shipping information to customers. Once the quote is converted into an order, you can only make changes to the order through Order Management, prior to booking.

double-arrowHow Order Management integrated with Telesales?

Telesales' eBusiness Center has several integrations with Order Management. There is an Order tab to view order history and create new orders.

double-arrowHow Order Management integrated with Cost Management?

OM call the the Cost Management CST_COST_API to obtain cost from cst_item_costs or cst_quantity_layers when the Gross Margin feature of OM is enabled.

double-arrowHow Order Management integrated with Field Service?

Field Service Report requires specifically that you setup Price Lists, Units of Measure (UOM), and two Inventory Item Attributes in Order Management. Price Lists contain the list price for an item. Items could be material, but also labor and expenses like units of driving distance. Once material, expense and labor transactions for a task have been taken down on the Field Service Debrief, this information is updated to Charges. In Charges the list price for the item is received from Order Management and is used to generate an invoice for a customer.

double-arrowHow Order Management integrated with Depot Repair?

This is used by Depot Repair to create RMA and Sales Orders, validate customer accounts, and invoice customers for repairs.

double-arrowHow Order Management integrated with Install Base?

Information about Install Base trackable items is interfaced to Install Base in the following ways:

  • Shippable Items: For both orders and returns, information is interfaced to Install Base via Inventory Interface.
  • Non-Shippable Items: For both order and returns, information is interfaced to Install Base via the Order Management Fulfillment workflow activity Install Base also supports Internal Sales Order transactions by appropriately creating /updating item instances as a result of transactions between internal organizations such as pick transactions, shipments, and receipts.

double-arrowHow Order Management integrated with Service Contracts?

Service Contracts need to pulls information from the Install Base newly created customer records and creates an ownership record.

  • Warranty: A Warranty contract is created when a Serviceable product is shipped.
  • Extended Warranty: An Extended Warranty contract is created when an Extended Warranty is sold on a sales order. Oracle EAM & OM integration
  • Subscription: Fulfillment starts after the contract approval process.
  • RMA: Service Contracts sends Order Management RMA information

double-arrowHow Order Management integrated with Advanced Planning System/Global Order Promising/ ASCP?

Order Management uses Advanced Supply Chain Planning's Global Order Promising functionality to check the availability of ordered items and to schedule order lines.Scheduled Order Lines are viewed as demand by the Advanced Planning System.

double-arrowHow Order Management integrated with Purchasing?

Order Management integrates with Oracle Purchasing in the following functional areas:

  • Return Receipts: Order Management uses the Oracle Purchasing Receipt functionality to handle Return receipts. When an item is received, Purchasing calls Order Management to indicate delivery and to get COGS information.
  • Internal Orders: Oracle Purchasing uses Order Import to create internal orders.
  • Drop-Ship Orders: Order Management integrates with Purchasing to fulfill drop-ship orders. It populates the PO requisitions interface table with information for order lines that need to be fulfilled via an external source.

double-arrowHow Order Management integrated with Bills of Material ?

This is integrated with BOM when models and kits are entered on sales orders.Normally OM uses the Bill of Material defined for the model or kit or explode the model into its components, for the purpose of the user selecting options and for shipping purposes.

double-arrowHow Order Management integrated with Workflow ?

Oracle Workflow is heavily used in EBS and specially to manage Order and Line processing. These PL/SQL based Workflow is a natural replacement for Order Cycles functionality. It provides a Graphical User Interfaces for defining activities, notifications, flows and viewing flow status.

double-arrowHow Order Management integrated with Advanced Pricing ?

OM is tightly integrated with Advance Pricing which includes price lists, modifiers, and agreements. Order Management, through its Sales Agreement functionality, creates price lists and pushes them into the Advanced Pricing tables. Order Management calls the Pricing Engine to make pricing requests during the processing of orders, and receives pricing information back from Advanced Pricing.

double-arrowHow Order Management integrated with Configurator ?

Order Management integrates with Oracle Configurator to support ordering and validation of configurations. The Configurator window is a Java Applet that can be launched from the Sales Order form.

double-arrowHow Order Management integrated with Oracle Payment ?

As we know Oracle payment is new product and OM accepts Credit Card information when entered on orders. It integrates with Oracle Payment to validate this information and get Credit Card authorizations. This information is then interfaced to Receivables.

double-arrowHow Order Management integrated with Receivables ?

Order Management integrates with Oracle Receivables in the following function areas:

  • Invoice Interface: Order Management sends invoices and credit memos to Receivables via the Invoice Interface workflow activity. The seeded Invoice Interface - Line workflow sub-process populates the Receivables interface table.
  • Receipts: Order Management calls Receivables' Receipt API to create receipts for prepaid credit card orders. Order Management receives a payment-set id from AR when the receipt is created, and then passes that id back to AR in the autoinvoice tables at invoicing time so that the invoice can be matched to the receipt.
  • Tax: Order Management calls the Global Tax Engine APIs to default the Tax Code (ARP_TAX.GET_DEFAULT_TAX_CODE) and to calculate estimated tax (ARP_PROCESS_TAX.SUMMARY) for the order Line. The estimated tax value is now stored on the line and re-calculated only when any of the attributes affecting tax change. Information about the tax value is also stored as Line Price Adjustments.
  • Credit Management: If the Credit Management product is installed, notifications are sent to it by Order Management when an order or line goes on credit hold, to initiate a credit review. If the credit review results in a decision to approve the order, a business event is posted which OM subscribes to and then releases the credit hold.

double-arrowHow Order Management integrated with Payables ?

OM accesses the AP Bank Accounts table to populate the Credit Card LOV when an order is being entered with a payment type of Credit Card. Additionally, if a new credit card number is entered and the authorization of that card through iPayment is successful, Order Management calls an AR API to create a new bank account record for the customer in the Bank Accounts table.

double-arrowHow Order Management integrated with Inventory Management ?

  • Order Management integrates with Oracle Inventory Management through Managing Reservations.
  • You can create reservations to on-hand quantities from the Sales Orders form.

double-arrowHow Order Management integrated with Trade Management ?

Order Management can receive RMA orders and lines from Oracle Trade Management as part of its dispute handling functionality.


--


Oracle General Ledger Integration

Oracle General Ledger Integration

Oracle General Ledger is one of the core product of EBS suite, and this is Integrated with almost every segment within EBS.Here is a list of just some of the Financial ,manufacturing and Human Resource Management products that integrate with General Ledger. Typically the integration of General ledger in EBS can be best understood as:

GL Integration

The integration data information can be best understood as below:

double-arrowOracle Financial

  • Oracle Payables sends invoices, payments, realized gain and loss on foreign currency, and invoice price variance to GL.
  • Oracle Receivables sends invoices, payments, adjustments, debit memos, credit memos, cash, chargebacks, and realized gain and loss on foreign currency to GL.
  • Oracle Assets sends capital and construction in process asset additions, cost adjustments, transfers, retirements, depreciation, and reclassifications to GL.
  • Oracle Purchasing sends accruals or receipts not invoiced, purchase orders, final closes, and cancellations to GL.
  • Oracle Projects sends cost distribution of labor and non-labor costs, and project revenue to GL.
  • Oracle Treasury sends revaluation and accrual entries to GL.
  • Oracle Property Manager sends revenues and expenses related to real estate to GL.
  • Oracle Lease Management sends accounting distributions related to leases, such as bookings of contracts, accruals, asset dispositions, terminations, and adjustments for multi-GAAP contracts to GL.

double-arrowOracle HRMS and Payroll

  • Oracle HR shares employee information with GL.
  • Oracle Payroll sends salary, deductions, and tax information to GL.

double-arrowOracle Manufacturing:

In terms of manufacturing this is Integrated as:

  • Oracle Inventory sends cycle counts, physical inventory adjustments, receiving transactions, delivery transactions, intercompany transfers, sales order issues, internal requisitions, sub-inventory transfers, and Cost of Goods Sold (COGS) to GL.
  • Work In Process(WIP) sends material issues or backflush from WIP to GL, along with completions, returns, resource and overhead transactions, and cost updates.
  • Oracle Labor Distribution normally sends salary costs to GL.

double-arrowOther Products

Oracle GL not only integrated with Application product, it does have capability to integrate with other products which is used for adhoc cum management Reporting, these tools are mostly.

  1. Business Intelligence/Analytic Solutions
  2. Enterprise Planning and Budgeting (EPB)
  3. Oracle Financial Services Applications (OFSA)
  4. Daily Business Intelligence (DBI)
  5. Activity-Based Management (OABM)
  • General Ledger's integration with Oracle Enterprise Planning and Budgeting (EPB)allows us to easily identify, analyze, model, budget, forecast, and report on information stored in our general ledger. Using Oracle GL to maintain and report on account balances throughout the accounting period, and use Financial Analyzer to analyze financial data, such as actual and budget balances, which is after closing the period. We can automatically transfer actual, budget, or encumbrance data, as well as functional, statistical, and foreign entered data from General Ledger to Financial Analyzer, which is on of requirement if company does have different management reporting approach. With financial Analyzer, we can perform sophisticated budgeting and modeling, make changes to budgets and write back budget data to a new budget in GL or to several budget versions for comparative reporting. We would also drill directly from EPB balances to balances and transactions in Oracle General Ledger. With this extended functionality your EPB users with immediate and direct access to GL data without having to run reports or account inquiries in GL, that makes process efficient without any extra step.
  • Oracle Financial Services Applications (OFSA) is a product suite that helps financial services institutions assess enterprise performance. This integration allows the transfer of General Ledger balances to OFSA to reconcile OFSA instrument tables, calculate transfer pricing of non-interest balance sheet items, or perform allocations. The results of OFSA allocation and transfer pricing results can then be transferred back to GL for posting and reporting.
  • The integration with Oracle Daily Business Intelligence (DBI) allows us to get a daily snapshot of company's financial picture through its E-Business Suite Portals. This is achieved by over 200 pre-inbuilt Portals provide every user in the enterprise with the right information that they need, about every aspect of their business. This makes a centralized place to see the information spans across multiple applications in real time basis.
  • The integration with Oracle Activity Based Management (OABM) allows you to perform complex analysis on costs that are collected in General Ledger in a separate analysis environmentâ€"apart from your GL data. OABM is optimized to support multi-layer complex cost assignment rules, activity hierarchies, and complex product and service definitions in terms of activities with complete activity definitions.
--


ORACLE APPS MIGRATION PROJECT :

ORACLE APPS MIGRATION PROJECT :

Things to take care in a migration project..
These are all my personal observations if any one has anything new to add plz put out a mail i will incorporate them also..

Now a days we are coming across many migration projects..comparitviely these are supposed to be easy and straight forward..
But if we take care of few more things..it would be even smoother...

What is a migration project.??
It is moving from a product of lower version to a product of higher version(the other way is also called migration only)

What will the customer expect??
He expects a higer performance from the system
Added new Functionality
Better support from oracle
The system is supposed to work the same way as it operates..But look and feel might be a bit different..Functionality should remain intact

What are the major challenges for it?
1.The amout of customization in the legacy system
2.Type of Customization--whether custom built modules /Standard process customised
3.Integration with other systems
4.Support of new environments
5.Amount of change in the product from old to new version
6.Whether Standards Followed while customising the standard obejcts like (standard reports,standard forms,workflow..)

What are different phases in it?
1.MIgration phase..First we will take a clone of the instance migrate the applications to the new version with the old data)
Oracle provide the scripts to migrate the data and the software will install the new application objects.
2.Optimised migration--We redo the migration phase again in short span of time to calculate the exact cut over time
3.MTP--Movement to production

What all we need to take care???

Environmental change: some time the old systems might be in a different environment and new system will be on a different environment.
like old one in AIX and new ones in red hat linux.
One of the problem to expect is some commands in AIX might not work in Linux environments.
So if we have shell scripts in or host script files..those need to be checked and changed for the new environment

Database Layer Change:As the product is migrated there might be a database change happend like new not null columns getting added up
so incase you have any direct inserts happening into the oracle tables even interfaces they might need to be corrected 
and values need to be populated to the new not null columns

Standard Report Modifications:Because the upgrade will get new application objects any modification done to the standard report objects will be lost. 
it is better to rename those objects and re-register them to keep intact the object for future migration

Custom reports migration :For reports we need to just open the report in the new version of the report builder in case the report builder version difference exists
use shift+cntrl+k to compile the objects and save it.This should make the reports work.
But from my personal experience we need to run all the reports and data validation should be done for all..
This might be tedious task if there are huge number of reports ,But it has to be done.
Project plan should include the testing of each and every report(Just data level validation)
One more important thing i heard the compilation of the report builder will not validate the query ..
so any column changes will not get reflected at migration time they can only be find out at run time 
Standard Form object migration: Migration will take care of the upgradation of standard objects. Hope that there are no customisation at 
the code level for the standard objects.In case if there are any try to redo the customisation using the new feautures 
like forms personalizations,custom.pll.One more important thing is before doing the customisation check whether those are really required 
in the new system also..Even the customer process also might have changed ..so check with the customer 
also before redoiing them . 

Custom Form Objects Migration:This is not as simple as the reports..There is a FLINT60(upto 11.5.10.2) or Corresponding utility available to 
upgrade the forms from the previous version to the new version.The major road block is if the forms are not developed 
as per oracle application standards.Like property paletter not defined,seperate button to popup lov's
and other..In that case the form has to migrated using the flint60 utility and manually changes need to be made to have 
the same look and feel of the new version. 
For detailed steps of using flint60 and custom form migration check my blog http://oracleappstechnicalworld.blogspot.com/ 

Legacy Sytem Integration:This will be one of the big task..The first step we need to do is figure out how the legacy systems are integrated
1.Through File system
2.Through DB Links 
3.Third party softwares 
1.For file system integration check the directory permission and UTL_DIR_PATH variables in the legacy and new system
2.For dblinks one check whether the dblinks can be created between the new database version and the database version of the legacy system.Better to confirm at the assesment stage itself in case not, time need to be allocated for alternative solution implementation
3.Check througthly the compatabilities in case some thing like this exists

Pro*c Programs : The pro*c files need to be recompiled on the new instance.Pro*C Environment need to be set on the new application .If there any custom pro*c programs Pro*c enviromental 
setup should be a task in the migration.process.


General Observations: One important thing to remember is the migration will get overwrite all the standard objects and standard application data ex:FND Messages.Suppose in the old instance you have changed the standard message text , then that change will be lost in the migration process.Those changes has to be redone.


--


Oracle E-Business Suite 12.1 available now

Oracle E-Business Suite 12.1 available now

Oracle announced today the general availability of Oracle E-Business Suite 12.1. Since the the press release link on www.oracle.com is not yet working, I copied the press release in this article. Apart from that (?), this morning I found the Release Content Documents for Release 12.1.1 on Metalink (last updated on 28-APR-09), including theFinancial Management RCD in PDF format.

Anyway, this is the announcement:


Oracle(R) E-Business Suite Release 12.1 Now Available to Help Organizations Achieve Better Business Value with New Products and Functionality

Latest Release of the Oracle E-Business Suite Provides Rapid Value Solutions, Global Enterprise Platform and Industry-Specific Capabilities

ORLANDO, Fla., May 4 /PRNewswire-FirstCall/ -- COLLABORATE 2009 --

News Facts

  • Oracle today announced general availability of the Oracle(R) E-Business Suite Release 12.1 to help companies and organizations more effectively compete in today's economy.
  • This latest release of the Oracle E-Business Suite provides product enhancements across human resources, supply chain management, procurement, projects, master data management, customer relationship management and financials.
  • With the Oracle E-Business Suite Release 12.1, organizations can achieve rapid value today, as well as standardize and simplify their infrastructure and business processes for long-term results.
  • The Oracle E-Business Suite Release 12.1 also features industry specific features and solutions that help drive greater value across the enterprise. Industries with significant new functionality advancements include Wholesale Distribution, Public Sector, High Technology, Engineering & Construction, Life Sciences, Retail, Professional Services, Communications, Consumer Goods and Utilities.

Oracle E-Business Suite Release 12.1 Details and Features

  • The Oracle E-Business Suite Release 12.1 helps companies achieve rapid value by offering stand-alone solutions that complement existing Oracle E-Business Suite 11i or Release 12 environments. Customers can take advantage of rapid value solutions without having to upgrade to this latest release.
  • New customers can take advantage of a global business platform that will help drive standardization and simplification throughout their enterprises for long-term benefits.
    • Key features of the Oracle E-Business Suite Release 12.1 include an integrated talent management solution with enhancements to Recruiting, Succession Planning, and Performance and Learning Management.
    • A new product called Oracle Landed Cost Management will give organizations financial visibility into their extended supply chain costs.
    • Companies can increase agility by leveraging pre-built, sustainable integrations that enable reduced implementation risk and cost with Oracle Application Integration Architecture for the Oracle E-Business Suite.
  • This latest release of the Oracle E-Business Suite includes several rich industry-specific solutions that help companies strengthen their position in the market.
    • Distributors will benefit from greater visibility into ROI of promotional funds, accrued assets, the effect of supplier price changes and related liabilities with Oracle Supplier Ship and Debit and Oracle Price Protection for Wholesale Distribution.
    • Oracle Site Hub helps organizations centralize information to help eliminate the problems associated with fragmented, incomplete and inconsistent site data resulting from rapid business expansion or mergers and acquisitions.
    • Retail businesses can leverage Oracle Product Information Management for Retail (PIM for Retail) to centralize product information from heterogeneous systems into a single view that can be used across all functional departments.
    • Oracle E-Business Suite Release 12.1 provides out of the box Federal accounting support with Project Accounting for automating funds consumption and billing in compliance with funding rules, supporting advance processing and ultimately helping to reduce overhead.
    • Oracle Subcontractor Payments for Engineering & Construction helps owners and general contractors manage cash flow and ensure their subcontractors are satisfying contract deliverables by controlling the payment of subcontractor invoices.{/info}

--


Monday, 22 August 2011

R12 - FND - Script to add responsibility using fnd_user_pkg with validation


Some times we don't have the access to add the responsibility to the user using the the Create User form. So for this Oracle is having one API fnd_user_pkg.addresp which can do the job without using the Create User Form.

R12 - FND - Script to add responsibility using fnd_user_pkg with validation


DECLARE

v_user_name VARCHAR2 (10) := '&Enter_User_Name';
v_resp_name VARCHAR2 (50) := '&Enter_Existing_Responsibility_Name';
v_req_resp_name VARCHAR2 (50) := '&Enter_required_Responsibility_Name';
v_user_id NUMBER (10);
v_resp_id NUMBER (10);
v_appl_id NUMBER (10);
v_count NUMBER (10);
v_resp_app VARCHAR2 (50);
v_resp_key VARCHAR2 (50);
v_description VARCHAR2 (100);
RESULT BOOLEAN;

BEGIN

SELECT fu.user_id, frt.responsibility_id, frt.application_id
INTO v_user_id, v_resp_id, v_appl_id
FROM fnd_user fu,
fnd_responsibility_tl frt,
fnd_user_resp_groups_direct furgd
WHERE fu.user_id = furgd.user_id
AND frt.responsibility_id = furgd.responsibility_id
AND frt.LANGUAGE = 'US'
AND fu.user_name = v_user_name
AND frt.responsibility_name = v_resp_name;
fnd_global.apps_initialize (v_user_id, v_resp_id, v_appl_id);

SELECT COUNT (*)
INTO v_count
FROM fnd_user fu,
fnd_responsibility_tl frt,
fnd_user_resp_groups_direct furgd
WHERE fu.user_id = furgd.user_id
AND frt.responsibility_id = furgd.responsibility_id
AND frt.LANGUAGE = 'US'
AND fu.user_name = v_user_name
AND frt.responsibility_name = v_req_resp_name;

IF v_count = 0 THEN

SELECT fa.application_short_name, frv.responsibility_key,
frv.description
INTO v_resp_app, v_resp_key,
v_description
FROM fnd_responsibility_vl frv, fnd_application fa
WHERE frv.application_id = fa.application_id
AND frv.responsibility_name = v_req_resp_name;

fnd_user_pkg.addresp (
username => v_user_name,
resp_app => v_resp_app,
resp_key => v_resp_key,
security_group => 'STANDARD',
description => v_description,
start_date => SYSDATE - 1,
end_date => NULL);

RESULT :=
fnd_profile.SAVE (x_name => 'APPS_SSO_LOCAL_LOGIN',
x_value => 'BOTH',
x_level_name => 'USER',
x_level_value => v_user_id
);

RESULT :=
fnd_profile.SAVE (x_name => 'FND_CUSTOM_OA_DEFINTION',
x_value => 'Y',
x_level_name => 'USER',
x_level_value => v_user_id
);

RESULT :=
fnd_profile.SAVE (x_name => 'FND_DIAGNOSTICS',
x_value => 'Y',
x_level_name => 'USER',
x_level_value => v_user_id
);

RESULT :=
fnd_profile.SAVE (x_name => 'DIAGNOSTICS',
x_value => 'Y',
x_level_name => 'USER',
x_level_value => v_user_id
);

RESULT :=
fnd_profile.SAVE (x_name => 'FND_HIDE_DIAGNOSTICS',
x_value => 'N',
x_level_name => 'USER',
x_level_value => v_user_id
);

DBMS_OUTPUT.put_line ( 'The responsibility added to the user '
v_user_name
' is '
v_req_resp_name);

COMMIT;

ELSE

DBMS_OUTPUT.put_line
('The responsibility has already been added to the user');

END IF;

END;

Sample Procedure for removing end date from Responsibilities given to Users

Sample Procedure for removing end date from Responsibilities given to Users:
--------------------------------------------------------------------------------------------
Sometimes while working on a support projects, we used to have access to the read only responsibilities ,or though we have given the access to the super users initially, but those accesses might have revoked after system went live. But in test environment, we may require those accesses back so as to fix the bugs or to test the functionality.
The removing of end date from a responsibility which is already assigned to a user, can be done using fnd_user_resp_groups_api API.

-------------------------------------------------------------------------------------------------------------------------
DECLARE

p_user_name VARCHAR2 (50) := 'A42485';
p_resp_name VARCHAR2 (50) := 'Order Management Super User';
v_user_id NUMBER (10) := 0;
v_responsibility_id NUMBER (10) := 0;
v_application_id NUMBER (10) := 0;

BEGIN

BEGIN
SELECT user_id
INTO v_user_id
FROM fnd_user
WHERE UPPER (user_name) = UPPER (p_user_name);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line ('User not found');
RAISE;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error finding User.');
RAISE;
END;

BEGIN
SELECT application_id, responsibility_id
INTO v_application_id, v_responsibility_id
FROM fnd_responsibility_vl
WHERE UPPER (responsibility_name) = UPPER (p_resp_name);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line ('Responsibility not found.');
RAISE;
WHEN TOO_MANY_ROWS
THEN
DBMS_OUTPUT.put_line
('More than one responsibility found with this name.');
RAISE;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error finding responsibility.');
RAISE;
END;

BEGIN

DBMS_OUTPUT.put_line ('Initializing The Application');

fnd_global.apps_initialize (user_id => v_user_id,
resp_id => v_responsibility_id,
resp_appl_id => v_application_id
);

DBMS_OUTPUT.put_line
('Calling FND_USER_RESP_GROUPS_API API To Insert/Update Resp');

fnd_user_resp_groups_api.update_assignment
(user_id => v_user_id,
responsibility_id => v_responsibility_id,
responsibility_application_id => v_application_id,
security_group_id => 0,
start_date => SYSDATE,
end_date => NULL,
description => NULL
);

DBMS_OUTPUT.put_line
('The End Date has been removed from responsibility');
COMMIT;

EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error calling the API');
RAISE;
END;
END;

Alternative Way of Deleting an Incomplete Purchase Order

Alternative Way of Deleting an Incomplete Purchase Order
************************************************************

Before approving the Purchase Order & when the PO is in INCOMPLETE status, Oracle allows us to delete the same from the Purchase Order Form. The same can be achieved using the following mentioned API.

But we need to remember few points before using this API for deleting Incomplete PO.

- The PO Should be INCOMPLETE & Should not be Approved Once.
- Once the PO is approved, records gets inserted into mtl_supply & all the archive tables.
This API never deletes the records from the mtl_supply & archive tables and only deletes the
records from the base tables.

-- Sample Script to Delete Incomplete PO Using 'PO_HEADERS_SV1'

--=================================================

DECLARE


l_deleted BOOLEAN;


CURSOR c_po_det IS

SELECT po_header_id, segment1,org_id
FROM po.po_headers_all pha
WHERE 1 = 1
AND segment1 = '11170002356'
AND org_id = 308
AND NVL (approved_flag, 'N') <> 'Y'
AND NVL (cancel_flag, 'N') = 'N'
AND type_lookup_code = 'STANDARD'
AND authorization_status = 'INCOMPLETE'
AND NOT EXISTS ( SELECT 1
FROM po_headers_archive_all a
WHERE pha.po_header_id = a.po_header_id
AND pha.org_id = a.org_id)
AND NOT EXISTS ( SELECT 1
FROM mtl_supply b WHERE pha.po_header_id = b.po_header_id AND
supply_type_code = 'PO');

BEGIN

FOR c1 IN c_po_det LOOP

DBMS_OUTPUT.put_line ( 'Calling PO_HEADERS_SV1 API To Delete PO');
DBMS_OUTPUT.put_line ( '==========================');

l_deleted := po_headers_sv1.delete_po (c1.po_header_id, 'STANDARD');


IF l_deleted = TRUE
THEN
COMMIT;
DBMS_OUTPUT.put_line ( 'Successfully Deleted the PO');
ELSE
ROLLBACK;
DBMS_OUTPUT.put_line ( 'Failed to Delete the PO');
END IF;
END LOOP;

END;