Wednesday, December 16, 2009
E-Mail using PLSQL
c UTL_SMTP.connection;
v_sent_date VARCHAR2 (30);
v_dns_name VARCHAR2 (100);
v_sender VARCHAR2 (100) := 'xxxxx@xxxx.com';
v_recepient VARCHAR2 (100) := 'xxxxx@xxxx.com';
v_subject VARCHAR2 (100) := 'TEST';
v_message VARCHAR2 (100) := NULL;
PROCEDURE send_header (
NAME IN VARCHAR2
,header IN VARCHAR2
) AS
BEGIN
UTL_SMTP.write_data (c, NAME
|| ': '
|| header
|| UTL_TCP.crlf);
END;
BEGIN
SELECT SYSDATE
INTO v_sent_date
FROM DUAL;
c := UTL_SMTP.open_connection ('xxx.xxx.xxx.xxx'); --server ip
UTL_SMTP.helo (c, 'XXXXXX'); --server name
UTL_SMTP.mail (c, v_sender);
UTL_SMTP.rcpt (c, v_recepient);
UTL_SMTP.rcpt (c, 'xxxxx@xxxx.com');
UTL_SMTP.open_data (c);
send_header ('From', v_sender);
send_header ('To', v_recepient);
send_header ('Subject', v_subject);
send_header ('Date', v_sent_date);
UTL_SMTP.write_data (c, UTL_TCP.crlf
|| v_message);
UTL_SMTP.close_data (c);
UTL_SMTP.quit (c);
EXCEPTION
WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
UTL_SMTP.quit (c);
raise_application_error (-20000
, 'Failed to send mail due to the following error: '
|| SQLERRM);
END plsql_mail_test;
/
Friday, December 11, 2009
Useful apps websites
http://www.oracleappshub.com/
http://www.oracle.com/technology/documentation/applications.html
Creating Custom View(Synonym) in R12
'Fine-Grained Access Control' security policy replace CLIENT_INFO(Org Context) of accessing Multi-Org data.
'Security Profile' and calls to MO_GLOBAL package can be used to initialize and obtain access to Operating Unit specific data. All custom forms, reports and packages need to be initialized and make appropriate call to secure access for operating unit specific data.
Metalink reference:
Note:420787.1
Note:414013.1
Example:
CREATE SYNONYM APPS.DPMI_SO_TEST FOR
DPMI_MFG.DPMI_SO_HEADERS_INTERFACE_ALL
begin
dbms_rls.add_policy ('apps',
'DPMI_SO_TEST', -- synonym name
'ORG_SEC', -- use 'ORG_SEC' here
'apps',
'MO_GLOBAL.ORG_SECURITY', -- Standard MO VPD
policy
'SELECT, INSERT, UPDATE, DELETE',
TRUE,
TRUE,
FALSE,
DBMS_RLS.SHARED_CONTEXT_SENSITIVE);
end;
Thursday, December 10, 2009
Ship To address and Bill to Address Qry
FROM hz_parties hp
,hz_party_sites site
,hz_locations loc
,hz_party_site_uses uses
,fnd_territories_vl terr
,hz_cust_site_uses hcsua
,hz_cust_acct_sites hcasa
WHERE site.party_id = hp.party_id
AND site.location_id = loc.location_id
AND site.party_site_id = uses.party_site_id(+)
AND loc.country = terr.territory_code
AND hp.status = 'A'
AND site.status = 'A'
AND hcsua.status = 'A'
AND uses.site_use_type = 'SHIP_TO'
AND NVL (uses.status, 'A') = 'A'
AND hcsua.cust_acct_site_id = hcasa.cust_acct_site_id
AND hcasa.party_site_id = site.party_site_id
AND hcsua.site_use_code = uses.site_use_type
AND hcsua.site_use_id = ol.ship_to_org_id
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT hp.party_name
FROM hz_parties hp
,hz_party_sites site
,hz_locations loc
,hz_party_site_uses uses
,fnd_territories_vl terr
,hz_cust_site_uses hcsua
,hz_cust_acct_sites hcasa
WHERE site.party_id = hp.party_id
AND site.location_id = loc.location_id
AND site.party_site_id = uses.party_site_id(+)
AND loc.country = terr.territory_code
AND hp.status = 'A'
AND site.status = 'A'
AND hcsua.status = 'A'
AND uses.site_use_type = 'BILL_TO'
AND NVL (uses.status, 'A') = 'A'
AND hcsua.cust_acct_site_id = hcasa.cust_acct_site_id
AND hcasa.party_site_id = site.party_site_id
AND hcsua.site_use_code = uses.site_use_type
AND hcsua.site_use_id = ol.invoice_to_org_id
Monday, December 7, 2009
ORDER MANAGEMENT BASICS
Interface Tables : OE_HEADERS_IFACE_ALL, OE_LINES_IFACE_ALL
OE_PRICE_ADJS_IFACE_ALL, OE_ACTIONS_IFACE_ALL
OE_CREDITS_IFACE_ALL (Order holds like credit check holds etc)
Base Tables : OE_ORDER_HEADERS_ALL: Order Header Information
OE_ORDER_LINES_ALL: Items Information
OE_PRICE_ADJUSTMENTS: Discounts Information
OE_SALES_CREDITS: Sales Representative Credits.
Shipping Tables :WSH_NEW_DELIVERIES, WSH_DELIVERY_DETAILS, WSH_DELIVERY_ASSIGNMENTS, WSH_DELIVERIES.
2) What is Order Import and What are the Setup's involved in Order Import?
A) Order Import is an open interface that consists of open interface tables and a set of API’s. It imports New, updated, or changed sales orders from other applications such as Legacy systems. Order Import features include validations, Defaulting, Processing Constraints checks, Applying and releasing of order holds, scheduling of shipments, then ultimately inserting, updating or deleting orders from the OM base tables. Order management checks all the data during the import process to ensure its validity with OM. Valid Transactions are then converted into orders with lines, reservations ,price adjustments, and sales credits in the OM base tables.
B) Setups:
· Setup every aspect of order management that we want to use with imported orders, including customers, pricing, items, and bills.
· Define and enable the order import sources using the order import source window.
3) Explain the Order Cycle?
i) Enter the Sales Order
ii) Book the Sales Order(SO will not be processed until booked(Inventory confirmation))
iii) Release sales order(Pickslip Report is generated and Deliveries are created)
(Deliveries – details about the delivery. Belongs to shipping module (wsh_deliveries, wsh_new_deliveries, wsh_delivery_assignments etc) they explain how many items are being shipped and such details.
iv) Transaction Move Order (creates reservations determines the source and transfers the inventory into the staging areas)
v) Launch Pick Release (
vi) Ship Confirm (Shipping Documents(Pickslip report, Performa Invoice, Shipping Lables))
4) Explain the Order to Cash Flow?
I. Enter the Sales Order
II. Book the Sales Order(SO will not be processed until booked(Inventory confirmation))
III. Release sales order(Pickslip Report is generated and Deliveries are created)
(Deliveries – details about the delivery. Belongs to shipping module (wsh_deliveries, wsh_new_deliveries, wsh_delivery_assignments etc) they explain how many items are being shipped and such details.
IV. Transaction Move Order (Selects the serial number of the product which has to be moved/ shipped)
V. Launch Pick Release
VI. Ship Confirm (Shipping Documents(Pickslip report, Performa Invoice, Shipping Lables))
VII. AutoInvoice (Creation of Invoice in Accounts Receivable Module)
VIII. Autolockbox ( Appling Receipts to Invoices In AR)
IX. Transfer to General Ledger ( Populates GL interface tables)
X. Journal Import ( Populates GL base tables)
XI. Posting ( Account Balances Updated).
5. What are the Process Constraints?
A. Process Constraints prevent users from adding updating, deleting, splitting lines and canceling order or return information beyond certain points in the order cycle. Oracle has provided certain process constraints which prevent data integrity violations.
Process constraints are defined for entities and attributes. Entities include regions on the sales order window such as order, line, order price adjustments, line price adjustments, order sales credits and line sales credits. Attributes include individual fields (of a particular entity) such as warehouse, shit to location, or agreement.
6. What are Validation Templates?
A) Validation Templates are used to define the validation conditions in process constraints. A validation template names a conditions and defines the semantic of how to validate that condition. These are used in processing constraints framework to specify the constraining conditions for a given constraint. These conditions are based on
Where the entity is in its work flow.
The state of attributes on an entity.
Any other validation condition that cannot be modeled using the above condition.
7. What are different types of Holds?
· GSA(General Services Administration) Violation Hold(Ensures that specific customers always get better pricing for example Govt. Customers)
· Credit Checking Hold( Used for credit checking feature Ex: Credit Limit)
· Configurator Validation Hold ( Cause: If we invalidate a configuration after booking)
8. What is Document Sequence?
A) Document sequence is defined to automatically generate numbers for your orders or returns as you enter them. Single / multiple document sequences can be defined for different order types.
Document sequences can be defined as three types Automatic (Does not ensure that the numbers are contiguous), Gapless (Ensures that the numbering is contiguous), Manual Numbering. Order Management validates that the number specified is unique for order type.
9. What are Defaulting Rules?
A) A defaulting rule is a value that OM automatically places in an order field of the sales order window. Defaulting rules reduce the amount of information one must enter. A defaulting rule is a collection of defaulting sources for objects and their attributes.
It involves the following steps
· Defaulting Conditions - Conditions for Defaulting
· Sequence – Priority for search
· Source – Entity ,Attribute, Value
· Defaulting source/Value
10. When an order cannot be cancelled?
A) An order cannot be cancelled if,
· It has been closed
· It has already been cancelled
· A work order is open for an ATO line
· Any part of the line has been shipped or invoiced
· Any return line has been returned or credited.
11. When an order cannot be deleted?
A) you cannot delete an order line until there is a need for recording reason.
12. What is order type?
A) An order type is the classification of order. It controls the order work flow activity, order number sequence, credit check point and transaction type. Order Type is associated to a work flow process which drives the processing of the order.
13. What are primary and secondary price lists?
A) Every order is associated to a price list as each item on the order ought to have a price. A price list is contains basic list information and one or more pricing lines, pricing attributes, qualifiers, and secondary price lists. The price list that is primarily associated to an order is termed as Primary price list.
The pricing engine uses a Secondary Price list if it cannot determine the price of the item ordered in the Primary price list.
14. What is pick slip? Types?
A) It is an internal shipping document that pickers use to locate items to ship for an order.
· Standard Pick Slip – Each order will have its own pick slip with in each picking batch.
· Consolidated Pickslip – Pick slip will have all the orders released in the each picking batch.
15. What is packing slip?
A) It is an external shipping document that accompanies the shipment itemizing the contents of the shipment.
16. What are picking rules?
A) Picking rules define the sources and prioritization of sub inventories, lots, revisions and locators when the item is pick released by order management. They are user defined set of rules to define the priorities order management must use when picking items from finished goods inventory to ship to a customer.
17. Where do you find the order status column?
A) In the base tables, Order Status is maintained both at the header and line level. The field that maintains the Order status is FLOW_STATUS_CODE. This field is available in both the OE_ORDER_HEADERS_ALL and OE_ORDER_LINES_ALL.
18. When the order import program is run it validates and the errors occurred can be seen in?
A) Responsibility: Order Management Super User
Navigation: Order, Returns > Import Orders > Corrections
Friday, December 4, 2009
Changing Record group for LOV using CUSTOM.PLL
Definition: vrg_id recordgroup;
1) vrg_id := Find_Group( "tesT_new_record_grp" ); ...Generate a group id for the record group
--Delete group id
2)
IF NOT Id_Null(vrg_id) THEN
Delete_Group( vrg_id);
END IF;
3) Now create a SQL for new record group which will be attached to LOV. But creation of new record group has its limitations, this process allows to change the tables and WHERE conditions used to generate the LOV, it won't allow to change the number of columns or their alias.Because here we are changing only record group , LOV cannot be modified in CUSTOM.pll
So make sure number of columns in select statement and their aliases match actual record group
Example:
Actual record group:
select col1, col2, col3
from tbl1,tbl2
where tbl1.x = tbl2.y
New record group:
vlv_sql = 'select tbl1111.123 col1,'
|| 'tbl1111.234 col2,'
|| 'tbl1111.xyz col3'
|| 'from tbl1111,tbl22222'
|| 'where tbl1111.xx = tbl22222.yy ';
(only tables and where condition are changed)
4) vrg_id := CREATE_GROUP_FROM_QUERY (vrg_name_new, vlv_sql);
--creating the new record group
5) SET_LOV_PROPERTY ('XXXXX' --LOV name
,group_name
,vrg_name_new
);
--Assign the newly created record group to existing LOV
Thursday, December 3, 2009
Internal orders
DYNAMIC CURSOR
To import a routing with operations and resource
- 1 - Pending
- 2 - Assigned Succeeded
- 3 - Assign/Validation Failed
- 4 - Validation Succeeded
- 7 - Import Succeeded
Wednesday, December 2, 2009
Order To Cash Techinical Overview
Enter order à Book Order à Pick Release à Pick Slip à Confirm Shipment à Generate Invoice à Customer follow up à Receipt à [Final Reconciliation]
Steps in Cycle:
1. Order Entry
This is first stage, when the order is entered in the system; it creates a record in order headers and Order Lines table.
- Enter header details: Once you enter details on the order header and save it or move it to lines, record goes to one table OE_ORDER_HEADERS_ALL
BOOKED_FLAG = N),
Primary key=HEADER_ID
No record exists in any other table for this order till now.
- Enter Line details for this order: Enter different item numbers, quantity and other details in line tab. When the record gets saved, it goes to one table. Order header details will be linked with line details by order HEADER_ID.
OE_ORDER_LINES_ALL
FLOW_STATUS_CODE = ENTERED,
BOOKED_FLAG = N,
OPEN_FLAG = Y
Primary key= LINE_ID
2. Order Booking
This is next stage, when Order is booked then the Flow status changed from Entered to Booked.At this stage, these below table get affected.
- OE_ORDER_HEADERS_ALL (FLOW_STATUS_CODE as BOOKED, BOOKED_FLAG updated to Y)
- OE_ORDER_LINES_ALL (FLOW_STATUS_CODE as AWAITING_SHIPPING, BOOKED_FLAGupdated Y)
- WSH_DELIVERY_DETAILS (DELIVERY_DETAIL_ID is assigned here, RELEASED_STATUS ‘R’ ready to release, LINE_ID comes as SOURCE_LINE_ID)
- WSH_DELIVERY_ASSIGNMENTS (DELIVERY_ASSIGNMENT_ID is assigned for DELIVERY_DETAIL_ID present in WSH_DELIVERY_DETAILS, DELIVERY_ID remains blank till this stage)
In shipping transaction form order status remains "Ready to Release".
This step is required for doing reservations SCHEDULE ORDER PROGRAM runs in the background and quantities are reserved. Once these programs get successfully get completed.
- MTL_DEMAND andMTL_RESERVATIONS table get updated. LINE_ID gets updated in DEMAND_SOURCE_LINE_ID in both the tables.
Pick Release is the process of putting reservation on on-hand quantity available in the inventory and pick them for particular sales order.
Pick release can be done from 'Release Sales Order' form or 'Pick release SRS' program can be scheduled in background. In both of these cases all lines of the order gets pick released depending on the Picking rule used. If specific line/s needs to be pick release it can be done from 'Shipping Transaction form. For this case Pick Release is done from 'Release Sales Order' form with Pick Confirm=NO.
Once pick release is done these are the tables get affected:
· If step 3 is not done then MTL_RESERVATIONS gets updated now.
· WSH_NEW_DELIVERIES (one record gets inserted with SOURCE_HEADER_ID= order header ID, STATUS_CODE=OP =>open)
· WSH_DELIVERY_ASSIGNMENTS (DELIVERY_ID gets assigned which comes from WSH_NEW_DELIVERIES)
· WSH_DELIVERY_DETAILS (RELEASED_STATUS ‘S’ ‘submitted for release’)
· MTL_TXN_REQUEST_HEADERS
· MTL_TXN_REQUEST_LINES (LINE_ID goes as TXN_SOURCE_LINE_ID)
· (move order tables. Here request is generated to move item from Source (RM or FG) sub-inventory to staging sub-inventory)
· MTL_MATERIAL_TRANSACTIONS_TEMP (link to above tables through MOVE_ORDER_HEADER_ID/LINE_ID, this table holds the record temporally)
· MTL_SERIAL_NUMBERS_TEMP (if item is serial controlled at receipt then record goes in this table)
· MTL_SERIAL_NUMBERS (enter value in GROUP_MARK_ID )
*In shipping transaction form order status remains "Released to Warehouse" and all the material still remains in source sub-inventory. We need to do Move Order Transaction for this order. Till this no material transaction has been posted to MTL_MATERIAL_TRANSACTIONS
5. Pick Confirm/ Move Order Transaction
Items are transferred from source sub-inventory to staging Sub-inventory. Here material transaction occurs.
Order line status becomes 'Picked' on Sales Order and 'Staged/Pick Confirmed' on Shipping Transaction Form.
- MTL_MATERIAL_TRANSACTIONS_TEMP (Record gets deleted from here and gets posted to MTL_MATERIAL_TRANSACTIONS)
- OE_ORDER_LINES_ALL (FLOW_STATUS_CODE ‘PICKED’ )
- MTL_MATERIAL_TRANSACTIONS (LINE_ID goes as TXN_SOURCE_LINE_ID)
- MTL_TRANSACTION_ACCOUNTS
- WSH_DELIVERY_DETAILS (RELEASED_STATUS becomes ‘Y’ => ‘Released’ )
- WSH_DELIVERY_ASSIGNMENTS
- MTL_ONHAND_QUANTITIES
- MTL_SERIAL_NUMBERS_TEMP (record gets inserted after putting details for the item which are serial controlled at 'Sales order issue')
- MTL_SERIAL_NUMBERS (record gets inserted after putting details for the item which are serial controlled at 'Sales order issue')
* This step can be eliminated if we set Pick Confirm=YES at the time of Pick Release
6. Ship Confirm
Here is the ship confirm interface program runs in background. Data removed from
- WSH_NEW_DELIVERIES. The items on the delivery shipped to customer at this stage
- OE_ORDER_LINES_ALL (FLOW_STATUS_CODE ‘shipped’)
- WSH_DELIVERY_DETAILS (RELEASED_STATUS ‘C’ ‘Shipped’, SERIAL_NUMBER if quantity is ONE)
- WSH_SERIAL_NUMBERS (records gets inserted with the DELIVERY_DETAIL_ID reference, only in case of shipped quantity is two or more)
- MTL_TRANSACTION_INTERFACE
- MTL_MATERIAL_TRANSACTIONS (linked through Transaction source header id)
- MTL_TRANSACTION_ACCOUNTS
- Data deleted from MTL_DEMAND, MTL_RESERVATIONS
- Item deducted from MTL_ONHAND_QUANTITIES
- MTL_SERIAL_NUMBERS_TEMP (records gets deleted from this table)
- MTL_SERIAL_NUMBERS (Serial number stauts gets updated CURRENT_STATUS=4 , 'Issued out of store')
After shipping the order, order lines are eligible to transfer to RA_INTERFACE_LINES_ALL. Workflow background engine picks those records and post it to RA_INTERFACE_LINES_ALL. This is also called Receivable interface, this mean information moved to accounting area for invoicing details. Invoicing workflow activity transfers shipped item information to Oracle Receivables. At the same time records also goes in the table RA_INTERFACE_SALESCREDITS_ALL which hold details of sales credit for the particular order
- RA_INTERFACE_LINES_ALL (interface table into which the data is transferred from order management) Then Autoinvoice program imports data from this table which get affected into this stage are receivables base table. At the same time records goes in
- RA_CUSTOMER_TRX_ALL (CUST_TRX_ID is primary key to link it to TRX_LINES table and TRX_NUMBER is the invoice number)
- RA_CUSTOMER_TRX_LINES_ALL (LINE_ATTRIBUTE_1 and LINE_ATTRIBUTE_6 are linked to order number and LINE_ID of the orders)
In this stage order line level table get updated with Flow status and open flag.
- OE_ORDER_LINES_ALL (FLOW_STATUS_CODE ‘shipped’, OPEN_FLAG “N”)
This is last step of Order Processing. In this stage only OE_ORDER_LINES_ALL table get updated. These are the table get affected in this step.
OE_ORDER_LINES_ALL (FLOW_STATUS_CODE ‘closed’, OPEN_FLAG “N”)