sales order life cycle

44
1. Order Management Overview 1.1. Enter Orders 1.1.1. Enter Header information Enter header level information like Customer name, Customer PO, Ship To, Bill To location, Price list, Sales rep and currency for the Order. Fig1.1 Order Entry Screen These field values can be set up to default from a variety of sources such as the Order Type, Customer or Customer address record. Defaulting rules can be set up to achieve this. All defaults can be overridden unless the business unit defines constraints preventing update. Enter Other Header information like sales channel, warehouse, payment term, ship method, Line set ( ship or Arrival), FOB, shipping and packing instructions, Tax exempt number and reason etc.

Upload: moin786mirza

Post on 28-Nov-2014

399 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Sales Order Life Cycle

1. Order Management Overview

1.1. Enter Orders

1.1.1. Enter Header information

Enter header level information like Customer name, Customer PO, Ship To, Bill To location, Price list, Sales rep and currency for the Order.

Fig1.1 Order Entry ScreenThese field values can be set up to default from a variety of sources such as the Order Type, Customer or Customer address record. Defaulting rules can be set up to achieve this. All defaults can be overridden unless the business unit defines constraints preventing update. Enter Other Header information like sales channel, warehouse, payment term, ship method, Line set ( ship or Arrival), FOB, shipping and packing instructions, Tax exempt number and reason etc.

Page 2: Sales Order Life Cycle

1.1.2. Order Actions

Page 3: Sales Order Life Cycle
Page 4: Sales Order Life Cycle

Fig 1.2 Additional Order InformationOther functions are available through the Actions button. The Actions include functions such as Additional order information, Copy, Cancel, Apply and Release Holds, Price Order, etc.

1.1.3. Enter Line information

Enter the line information like Item, Quantity, Request Date, Schedule Ship Date etc. Other line info like Line Type, Cancelled Qty, Shipped Qty, Sales Rep, Order Source, Tax code etc. get defaulted based on defaulting rules.

1.1.4. Line Shipping information

Page 5: Sales Order Life Cycle

Shipping tab shows info like warehouse, Receiving Org (for Drop ship orders), Schedule Ship date, schedule arrival date, Source type (External for Drop ship orders and Internal otherwise), Ship set, Arrival set, Shiping method, shipment priority, Freight terms, Shipping and Packing Instructions etc.

1.1.5. Line Pricing information

Pricing tab shows info like Unit Selling Price, Extended Price, Price List, List Price, Line Charges, Tax Amount, Payment terms, Pricing Agreement etc. In view price adjustments we will see the adjustments and charges applied on the list price, after applying all these the unit selling price is derived.

1.1.6. Order Architecture

OE_ORDER_HEADERS_ALLHEADER_ID ORDER_NUMBER ORG_ID ORDER_TYPE_ID VERSION_NUMBER ORDER_SOURCE_ID SOURCE_DOCUMENT_TYPE_IDORIG_SYS_DOCUMENT_REFSOURCE_DOCUMENT_ID ORDERED_DATE REQUEST_DATE PRICING_DATE SHIPMENT_PRIORITY_CODEDEMAND_CLASS_CODE PRICE_LIST_ID TAX_EXEMPT_FLAG TAX_EXEMPT_NUMBER PARTIAL_SHIPMENTS_ALLOWED

OE_ORDER_LINES_ALL LINE_ID ORG_ID HEADER_ID LINE_TYPE_ID LINE_NUMBER ORDERED_ITEM REQUEST_DATE PROMISE_DATE SCHEDULE_SHIP_DATE ORDER_QUANTITY_UOM PRICING_QUANTITY PRICING_QUANTITY_UOM CANCELLED_QUANTITY SHIPPED_QUANTITY ORDERED_QUANTITY FULFILLED_QUANTITY SHIPPING_QUANTITY SHIPPING_QUANTITY_UOM DELIVERY_LEAD_TIME TAX_EXEMPT_FLAG

RA_SALESREPSSALESREP_ID SALES_CREDIT_TYPE_ID NAME SALESREP_NUMBER STATUS START_DATE_ACTIVE END_DATE_ACTIVE SET_OF_BOOKS_ID ORG_ID EMAIL_ADDRESS ASSIGNED_TO_USER_ID COST_CENTER CHARGE_TO_COST_CENTER PERSON_ID TYPE COMMISSIONABLE_FLAG

OE_TRANSACTION_TYPES_TLTRANSACTION_TYPE_IDNAMEDESCRIPTION

OE_TRANSACTION_TYPES_ALLTRANSACTION_TYPE_ID TRANSACTION_TYPE_CODE ORDER_CATEGORY_CODE CUST_TRX_TYPE_ID COST_OF_GOODS_SOLD_ACCOUNT PRICE_LIST_ID WAREHOUSE_ID DEMAND_CLASS_CODE SHIPMENT_PRIORITY_CODE SHIPPING_METHOD_CODE FREIGHT_TERMS_CODE FOB_POINT_CODE SHIP_SOURCE_TYPE_CODE AGREEMENT_TYPE_CODE AGREEMENT_REQUIRED_FLAG PO_REQUIRED_FLAG INVOICING_RULE_ID ACCOUNTING_RULE_ID INVOICE_SOURCE_ID ORG_ID

Page 6: Sales Order Life Cycle

Query to find out the customer, line item, ordered qty and price info of the order :

Query to find customer, ship to and bill to information of an order :

set pages 500set lines 500set buffer 500col order_type form a16col customer_name form a30col segment1 form a16col sales_rep form a30select h.order_number, org.name customer_name, h.ordered_date order_date, ot.name order_type, s.name sales_rep, l.line_id, l.line_number, l.inventory_item_id, si.segment1, l.ordered_quantity, l.unit_selling_price, nvl(l.ordered_quantity,0) * nvl(l.unit_selling_price,0) amount, h.transactional_curr_code currency_codefrom ra_salesreps s, oe_transaction_types_tl ot, oe_sold_to_orgs_v org, mtl_system_items_vl si, oe_order_lines_all l, oe_order_headers_all h where h.order_number= 14463 and h.org_id = 204 and l.header_id = h.header_id and h.sold_to_org_id = org.organization_id and (h.cancelled_flag is null or h.cancelled_flag = 'N') and h.open_flag='Y' and l.open_flag = 'Y' and l.service_reference_line_id is null and l.inventory_item_id = si.inventory_item_id and nvl(si.organization_id,0) = 204 --Item master orgn and h.order_type_id = ot.transaction_type_id and h.salesrep_id=s.salesrep_id and h.org_id=s.org_id

col ship_address1 form a40col ship_address2 form a20col bill_address1 form a40col bill_address2 form a20col ship_country form a10col bill_country form a10col ship_location_code form a30col ship_state form a10col ship_zip form a10col bill_location_code form a30col customer_name form a30col freight_terms form a24col FOB form a16

select h.order_number, c.name customer_name, lk1.meaning Freight_Terms, lk2.meaning FOB, s.location_code ship_location_code, s.address_line_1 ship_address1, s.address_line_2 ship_address2, s.state ship_state, s.postal_code ship_zip, s.country ship_country, b.location_code bill_location_code, b.address_line_1 bill_address1, b.address_line_2 bill_address2, b.country bill_countryfrom ar_lookups lk2, oe_lookups lk1, oe_sold_to_orgs_v c, oe_invoice_to_orgs_v b, oe_ship_to_orgs_v s, oe_order_headers_all h where h.order_number= 14463 and h.org_id = 204 and h.ship_to_org_id = s.organization_id and h.invoice_to_org_id = b.organization_id and h.sold_to_org_id = c.organization_id and h.freight_terms_code = lk1.lookup_code(+)

Page 7: Sales Order Life Cycle

order by l.line_id/a: Oe_sold_to_orgs_v is a view based on hz_parties and hz_cust_accounts.b: Ra_salesreps is a view based on JTF_RS_SALESREPS and JTF_RS_RESOURCE_EXTNS_VL.

You must set the org context for the views to function properly as..begin fnd_client_info.set_org_context('204');end;

and lk1.lookup_type(+) = 'FREIGHT_TERMS' and lk2.lookup_code(+) = h.fob_point_code and lk2.lookup_type(+) = 'FOB' /a: The oe_ship_to_orgs_v and oe_invoice_to_orgs_v views are based on HZ_CUST_SITE_USES_ALL, HZ_CUST_ACCT_SITES_ALL, HZ_PARTY_SITES and HZ_LOCATIONS.b: Oe_lookups and ar_lookups are views based on fnd_lookup_values.

OE_ORDER_HOLDS_ALLORDER_HOLD_ID HOLD_SOURCE_ID HOLD_RELEASE_ID HEADER_ID LINE_ID ORG_ID RELEASED_FLAG

OE_HOLD_DEFINITIONSHOLD_ID NAME TYPE_CODE DESCRIPTION START_DATE_ACTIVE END_DATE_ACTIVE ITEM_TYPE HOLD_INCLUDED_ITEMS_FLAGAPPLY_TO_ORDER_AND_LINE_FLAG

OE_HOLD_SOURCES_ALLHOLD_SOURCE_ID HOLD_ID HOLD_ENTITY_CODE HOLD_ENTITY_ID HOLD_ENTITY_CODE2 HOLD_ENTITY_ID2 HOLD_UNTIL_DATE RELEASED_FLAG HOLD_COMMENT ORG_IDHOLD_RELEASE_ID

OE_HOLD_RELEASESHOLD_RELEASE_ID HOLD_SOURCE_ID RELEASE_REASON_CODE RELEASE_COMMENT ORDER_HOLD_ID

Query to find out order and line hold information :

col ordered_item form a32col hold_name form a24col hold_comment form a32select ho.name hold_name, hs.hold_until_date, hs.hold_comment, h.order_number, oh.header_id, oh.line_id, oh.order_hold_id, l.item_identifier_type, l.inventory_item_id, l.ordered_itemfrom oe_order_holds_all oh, oe_order_lines_all l, oe_order_headers_all h, oe_hold_definitions ho, oe_hold_sources_all hs where h.order_number= 14463

Page 8: Sales Order Life Cycle

and oh.header_id = h.header_id and (h.cancelled_flag is null or h.cancelled_flag = 'N') and h.open_flag='Y' and oh.hold_source_id = hs.hold_source_id and hs.hold_id = ho.hold_id and h.header_id = l.header_id(+) and l.open_flag = 'Y' and l.line_id = nvl(oh.line_id,l.line_id) and l.service_reference_line_id is null and oh.hold_release_id is null and nvl(h.org_id,0) = 204 and nvl(l.org_id,0) = nvl(h.org_id,0)order by ho.name,h.order_number/

WSH_CARRIERS_VCARRIER_IDFREIGHT_CODE CURRENCY_CODE CARRIER_NAME ACTIVE SCAC_CODE MANIFESTING_ENABLED_FLAG

WSH_CARRIER_SHIP_METHODS_VCARRIER_SHIP_METHOD_ID CARRIER_ID SHIP_METHOD_CODE SERVICE_LEVEL ENABLED_FLAG FREIGHT_CODE ORGANIZATION_ID ORGANIZATION_CODE CARRIER_SITE_ID WEB_ENABLED START_DATE_ACTIVE END_DATE_ACTIVE

Query to find freight related info of order viz: freight carrier, ship method and service level :

col shipping_method_code form a32col carrier_name form a24

select h.order_number, h.shipping_method_code, wc.carrier_name, wcsm.SERVICE_LEVEL , wcsm.freight_codefrom wsh_carrier_ship_methods_v wcsm, wsh_carriers_v wc, oe_order_headers_all h where h.order_number= 14463 and h.org_id = 204 and h.shipping_method_code = wcsm.ship_method_code(+)

Page 9: Sales Order Life Cycle

and nvl(wcsm.organization_id(+),0) = 204 --Master Organization and wcsm.freight_code = wc.freight_code(+)order by h.order_number

1.2. View Order Charges & Adjustments

1.2.1. View List Price Adjustments

Fig1.1 Order Entry ScreenThe list price is derived from the price list and the selling price is calculated taking into account other adjustments and charges info.Go to line price adjustments thru’ the actions LOV. The modifier details like rate of adjustment, adjusted amount and extended price will appear.

Page 10: Sales Order Life Cycle
Page 11: Sales Order Life Cycle

1.2.2. View Adjustment Atributes

Page 12: Sales Order Life Cycle

Click on adjustment attributes to find the Pricing and Qualifier attributes and their values, which were satisfied for the previously mentioned modifier to be applied on this Order line.

1.2.3. View Charges

Page 13: Sales Order Life Cycle

The charges and freight costs can be defined in Adv Pricing and automatically applied to the Order line based on business rules.Click on actions button and choose charges from the LOV. For a charge click on attributes button to view the pricing and qualifier attributes.

Page 14: Sales Order Life Cycle

1.2.4. Order Adjustment Architecture

Page 15: Sales Order Life Cycle

OE_PRICE_ADJUSTMENTS PRICE_ADJUSTMENT_ID REQUEST_ID HEADER_ID DISCOUNT_ID DISCOUNT_LINE_ID AUTOMATIC_FLAG PERCENT LINE_ID ORIG_SYS_DISCOUNT_REF CHANGE_SEQUENCE LIST_HEADER_ID LIST_LINE_ID LIST_LINE_TYPE_CODE MODIFIED_FROM MODIFIED_TO MODIFIER_MECHANISM_TYPE_CODE UPDATED_FLAG APPLIED_FLAG OPERAND ARITHMETIC_OPERATOR

OE_PRICE_ADJ_ATTRIBSPRICE_ADJUSTMENT_ID

PRICING_CONTEXT PRICING_ATTRIBUTE PRICING_ATTR_VALUE_FROM PRICING_ATTR_VALUE_TO COMPARISON_OPERATOR FLEX_TITLE PRICE_ADJ_ATTRIB_ID LOCK_CONTROL

OE_CHARGE_LINES_V HEADER_ID LINE_ID CHARGE_ID CHARGE_NAME CHARGE_AMOUNT CURRENCY_CODE INVOICED_FLAG INTERCO_INVOICED_FLAG ORG_ID SOURCE_SYSTEM_CODE ESTIMATED_FLAG INVOICED_AMOUNT

QP_LIST_HEADERS_VLLIST_HEADER_ID NAME DESCRIPTION AUTOMATIC_FLAG LIST_TYPE_CODE TERMS_ID ROUNDING_FACTOR PRORATE_FLAG SOURCE_SYSTEM_CODE ASK_FOR_FLAG

Query to find price discounts and surcharges on order lines :

Query to find freight charges on order lines :

col list_line_type_code form a12col arithmetic_operator form a12

Select h.order_number, l.line_number, pa.list_line_type_code, pa.arithmetic_operator, pa.operand, DECODE(PA.MODIFIER_LEVEL_CODE,'ORDER', L.UNIT_LIST_PRICE*L.ORDERED_QUANTITY *PA.OPERAND * SIGN(PA.ADJUSTED_AMOUNT)/100, (PA.ADJUSTED_AMOUNT* NVL(L.ORDERED_QUANTITY,0) )) DISCOUNT_AMTFrom qp_list_headers_vl lh, oe_price_adjustments pa, oe_order_lines_all l, oe_order_headers_all hWhere h.order_number = 14463 and h.header_id = l.header_id and h.org_id = l.org_id and h.header_id = pa.header_id and l.line_id = pa.line_id(+) and pa.list_header_id = lh.list_header_id AND ( PA.LIST_LINE_TYPE_CODE = 'DIS' OR PA.LIST_LINE_TYPE_CODE = 'SUR' OR PA.LIST_LINE_TYPE_CODE = 'PBH' ) AND PA.APPLIED_FLAG='Y'

col charge_name form a24col source_system_code form a12

select HEADER_ID , LINE_ID , CHARGE_ID , CHARGE_NAME , CHARGE_AMOUNT , CURRENCY_CODE , INVOICED_FLAG , INTERCO_INVOICED_FLAG , ORG_ID , SOURCE_SYSTEM_CODE , ESTIMATED_FLAG , INVOICED_AMOUNTfrom OE_CHARGE_LINES_Vwhere header_id= (select header_id from oe_order_headers_all where order_number=14463)order by line_id/a: The OE_CHARGE_LINES_V view is based on oe_price_adjustments, oe_

Page 16: Sales Order Life Cycle

AND NOT EXISTS (SELECT 'X' FROM OE_PRICE_ADJ_ASSOCS PAS, OE_PRICE_ADJUSTMENTS PA1 WHERE PAS.RLTD_PRICE_ADJ_ID = PA.PRICE_ADJUSTMENT_ID AND PA1.PRICE_ADJUSTMENT_ID= PAS.PRICE_ADJUSTMENT_ID AND PA1.LIST_LINE_TYPE_CODE ='PBH')Order by l.line_id/a: Qp_list_headers_vl is view based on qp_list_headers_b and qp_list_headers_tl tables.

1.3. View Tax

1.3.1. View Line Tax

The tax amount appears while entering the order. The tax method, rate or amount of tax is decided by the Receivables system options.

Page 17: Sales Order Life Cycle

Oracle Receivables system option determines tax method.. i• Sales Tax ii• Value Added Tax (VAT). For value added tax, taxes are based on tax rates assigned to user- defined codes. For Sales tax location based tax is used as maintained below..

Page 18: Sales Order Life Cycle

Here tax rates are maintained at state and zip code level. Usually third party softwares like Taxware keeps updating the tax rates time to time.

Page 19: Sales Order Life Cycle

Tax calculation in OM can occur at Entry, Booking or Invoicing which can only be controlled at the order level. In "Tax event", you specify when to calculate the tax . The default value for Tax Calculation Event Code is null which is same as Entry. The Receivables Transaction Type associated here decides whether the order is taxable.

Page 20: Sales Order Life Cycle

The tax calculation flag associated with the previous Receivables Transaction Type will determine if tax is required on an order.

1.2.4. Sales Tax Architecture

AR_LOCATION_COMBINATIONSLOCATION_ID LOCATION_STRUCTURE_ID ENABLED_FLAG LOCATION_ID_SEGMENT_1 LOCATION_ID_SEGMENT_2 LOCATION_ID_SEGMENT_3 LOCATION_ID_SEGMENT_4 LOCATION_ID_SEGMENT_5 LOCATION_ID_SEGMENT_6 LOCATION_ID_SEGMENT_7 LOCATION_ID_SEGMENT_8 LOCATION_ID_SEGMENT_9 LOCATION_ID_SEGMENT_10

AR_LOCATION_VALUESLOCATION_SEGMENT_ID LOCATION_STRUCTURE_ID LOCATION_SEGMENT_QUALIFIER LOCATION_SEGMENT_VALUE LOCATION_SEGMENT_DESCRIPTIONPARENT_SEGMENT_ID LOCATION_SEGMENT_USER_VALUE TAX_ACCOUNT_CCID ORG_ID INTERIM_TAX_CCID ADJ_CCID EDISC_CCID UNEDISC_CCID

AR_LOCATION_RATES LOCATION_RATE_ID LOCATION_SEGMENT_ID TAX_RATE OVERRIDE_STRUCTURE_ID FROM_POSTAL_CODE TO_POSTAL_CODE START_DATE END_DATE REQUEST_ID PROGRAM_APPLICATION_ID PROGRAM_ID PROGRAM_UPDATE_DATE LAST_UPDATE_LOGIN OVERRIDE_RATE1~10

AR_SALES_TAXSALES_TAX_IDLOCATION_IDTAX_RATELOCATION1_RATELOCATION2_RATELOCATION3_RATEATTRIBUTE_CATEGORYATTRIBUTE1~10RATE_CONTEXTENABLED_FLAGSTART_DATEEND_DATEFROM_POSTAL_CODETO_POSTAL_CODETAX_ACCOUNT

Query to find location based Sales tax :

For sales tax location structure of State.county.city, At first tax for these individual segment values are found as

Page 21: Sales Order Life Cycle

mentioned below. Then all taxes are added up and applied to the sales order line.

Sales tax rate for State 'CA' :

select distinct lv.parent_segment_id,lc.location_id_segment_1, location_segment_user_value ,lr.from_postal_code,lr.to_postal_code, location_segment_value, lr.tax_ratefrom ar_location_rates lr, ar_location_combinations lc, ar_location_values lvwhere lv.location_segment_user_value='CA' --State nameand lv.location_segment_id=lc.location_id_segment_1and lv.location_structure_id= lc.location_structure_idand lc.location_structure_id=101and lv.location_segment_id=lr.location_segment_idorder by 1/

Sales tax rate for County 'Santa Clara' :

select distinct lv.parent_segment_id,lc.location_id_segment_2, location_segment_user_value , location_segment_value, lr.from_postal_code,lr.to_postal_code,lr.tax_ratefrom ar_location_rates lr, ar_location_combinations lc, ar_location_values lvwhere lv.location_segment_user_value='Santa Clara' --County nameand lv.location_segment_id=lc.location_id_segment_2and lv.location_structure_id= lc.location_structure_idand lc.location_structure_id=101and lv.location_segment_id=lr.location_segment_idorder by 1/

Sales tax rate for city 'San Jose' :

select lv.parent_segment_id,lc.location_id_segment_3, location_segment_user_value , location_segment_value, lr.tax_ratefrom ar_location_rates lr, ar_location_combinations lc, ar_location_values lvwhere lv.location_segment_user_value='San Jose' --City nameand lv.location_segment_id=lc.location_id_segment_3and lv.location_structure_id= lc.location_structure_idand lc.location_structure_id=101and lv.location_segment_id=lr.location_segment_idorder by 1/

Table ar_sales_tax contains location wise total tax- rates with tax break up ..select distinct location_id, rate_context, tax_rate, location1_rate, location2_rate, location3_rate, from_postal_code, to_postal_codefrom ar_sales_taxwhere location_id=1000and enabled_flag='Y'/

1.4. Order Management APIs

1.4.1. Create Order API

Creating a new order with 2 lines and 1 line adjustment and the adjustment belongs to the second line.

Declarel_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC; -- Required attributes (e.g. Order Type and Customer)l_header_rec.order_type_id := 1000;l_header_rec.sold_to_org_id := 100;l_header_rec.price_list_id := 10;l_header_rec.freight_term_code = NULL;l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;-- FIRST LINE RECORD. Initialize record to missingl_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;l_line_tbl(1).inventory_item_id := 311;l_line_tbl(1).ordered_quantity := 1;

Page 22: Sales Order Life Cycle

l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;-- SECOND LINE RECORDl_line_tbl(2) := OE_ORDER_PUB.G_MISS_LINE_REC;l_line_tbl(2)inventory_item_id := 312;l_line_tbl(2).ordered_quantity := 2;l_line_tbl(2).operation := OE_GLOBALS.G_OPR_CREATE;-- LINE ADJUSTMENT RECORDl_line_adj_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;l_line_adj_tbl(1).discount_id := 1;l_line_adj_tbl(1).percent := 5;l_line_adj_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;-- Indicator that this adjustment belongs to the second linel_line_adj_tbl(1).line_index := 2;

-- CALL TO PROCESS ORDEROE_Order_PUB.Process_Order(p_header_rec => l_header_recp_line_tbl=> l_line_tblp_line_adj_tbl=> l_line_adj_tbl-- OUT variablesx_header_rec=> l_header_recx_header_scredit_tbl=> l_header_scr_tblx_header_adj_tbl=> l_header_adj_tblx_line_tbl=> l_line_tblx_line_scredit_tbl=> l_line_scredit_tblx_line_adj_tbl=> l_line_adj_tbl................x_return_status=> l_return_statusx_msg_count=> l_msg_countx_msg_data=> l_msg_data);if l_msg_count > 0 thenfor l_index in 1..l_msg_count loopl_msg_data := oe_msg_pub.get(p_msg_index => l_index, p_encoded => ‘F’);end loop;end if;-- Check the return statusif x_return_status = FND_API.G_RET_STS_SUCCESS then success;Else failure;end if;End;

1.4.2. Create New Line

Inserting a new line into an existing order.

-- NEW LINE RECORDl_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;l_line_tbl(1).header_id := 1000;l_line_tbl(1).inventory_item_id := 311;l_line_tbl(1).ordered_quantity := 1;l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;

OE_ORDER_PUB.Process_Order(........p_line_tbl=> l_line_tbl

Page 23: Sales Order Life Cycle

......);

1.4.3. Update an existing Line

Updating the bill to organization and order quantity on an order line.

-- LINE RECORD WITH THE CHANGESl_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC.l_line_tbl(1).invoice_to_org_id := 322;l_line_tbl(1).ordered_quantity := 2;l_line_tbl(1).line_id := 1000;l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;

OE_ORDER_PUB.Process_Order(........p_line_tbl=> l_line_tbl........);

1.4.4. Delete an Order

Deleting an order.

l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;l_header_rec.header_id:=1000;l_header_rec.operation := OE_GLOBALS.G_OPR_DELETE;

OE_ORDER_PUB.Process_Order(p_header_rec=> l_header_rec........);

1.4.5. Apply Line Hold API

Apply a hold to an order line due to a defective item.

-- ACTION REQUEST RECORDl_request_rec.entity := OE_GLOBALS.G_ENTITY_LINE; -- Indicates that it is a line level actionl_request_rec.entity_id := 100; -- Line Idl_request_rec.request_name := OE_GLOBALS.G_APPLY_HOLD;l_request_rec.param1 := 4; --Hold ID to identify the type of hold applied. (HOLD_ID from OE_HOLD_DEFINITIONS)l_request_rec.param2 = ‘I’; -- indicator that it is an item hold l_request_rec.param3 := 3214; -- Inv_item_Id of the item since it is an Item holdl_action_request_tbl := l_request_rec;

Apply Hold action record fields and their valid values.

request_typeentity_codeentity_idparam1param2

OE_GLOBALS.G_APPLY_HOLDOE_GLOBALS.G_ENTITY_ORDER for order or OE_ID of the order or line to be heldHold ID to identify the type of hold that should be applied. (HOLD_ID from OE_HOLD_DEFINITIONS)Hold entity code for the hold source to be createdviz:

Page 24: Sales Order Life Cycle

param3

param4 date_param1 parm6-param20

C: Customer hold sourceS: Bill To or Ship To hold sourceI: Item hold sourceO: Order hold sourceW: Warehouse Hold SourceHold entity ID viz:C, B, or S: for Org IDO: Header IDI: Inventory Item IDHold commentHold Until DateAttribute1-15 of the descriptive flexfield associatedwith the hold source record.

1.4.6. Other APIs

Other OM APIs available are Release Hold, Book Order and for ATO models Delink Config and Match & Reserve APIs are available.

1.5. Order Scheduling

Scheduling determines the source (warehouse) for an order line. If the warehouse is already entered on the line, the scheduling action uses the requested warehouse to determine the scheduled ship date, scheduled arrival date etc. If the warehouse is blank, the scheduling action determines the best warehouse based on the sourcing rules.

1.5.1. Scheduling Features :

• Calculating Available-to-Promise (ATP)• Scheduling• Reserving

1.5.2. Scheduling

Scheduling determines the schedule ship date, the schedule arrival date, the delivery lead time and the shipping method. It makes the line visible to the planning applications and consumes supply for the item. When a line is successfully scheduled the VISIBLE_DEMAND_FLAG is set to Yes. If the reservation time fence is set and the schedule ship date is within the reservation time fence, automatically reserves the line.

1.5.2.1. Autoschedule

The sales order line is scheduled when it is saved, if either the Autoschedule check box on the order transaction type is checked or the OM: Autoschedule profile option is Yes. You can turn Autoschedule on or off from the sales order window by going to the Tools menu. Note that if autoschedule is turned on the availability window is automatically displayed when the sales

Page 25: Sales Order Life Cycle

order window is opened. You can close the availability window, but the lines will still be autoscheduled unless the autoschedule check box on the tools menu is unchecked.

1.5.3. Reserving

You can reserve on-hand inventory to a sales order. Reserved inventory cannot be used for any other purpose. The reserved quantity for a sales order line is displayed on the shipping tab. You may reserve part or all of the ordered quantity. A line must be scheduled before it can be reserved. If you try to reserve an unscheduled line, the system will first try to schedule the line. If the line is successfully scheduled then the system will try to reserve it.There are two ways to reserve manually from the sales order window.• Select reserve from the scheduling option under the tools menu• Select reserve from the scheduling sub menu which is displayed when you select the context menu.If you are on an order line the line will be reserved. If you are on the header, all the lines will be reserved.

Manual reservations are affected by a scheduling parameter that lets you control whether to apply a partial reservation manually. If 9 out of 10 are available, and if you have set the parameters to allow partials, you can right mouse click to bring up the context menu and select Reserve to reserve the 9.

1.5.4. Order Scheduling Transaction

WSH_DELIVERY_DETAILSDELIVERY_DETAIL_ID SOURCE_CODE SOURCE_HEADER_ID SOURCE_LINE_ID SOURCE_HEADER_TYPE_ID SOURCE_HEADER_TYPE_NAME CUST_PO_NUMBER CUSTOMER_ID INVENTORY_ITEM_ID ITEM_DESCRIPTION

For each order line scheduled, one record is created in wsh_delivery_details referencing the line as source_line_id.

2.1. Release Sales Order

Once the order is scheduled and booked then we need to release the order to warehouse for shipping.

Page 26: Sales Order Life Cycle

Pick release the order from Release Sales Orders window. Enter the order number and clear out the default scheduled ship date and requested date.

Page 27: Sales Order Life Cycle

Make sure to include a Warehouse, based on this the order lines available on the order will be filtered. Choose Auto Allocate as "Yes" such that the system will suggest from which sibinventory or locator the goods can be shipped.

Page 28: Sales Order Life Cycle

Set Autocreate delivery to Yes, such that a shipper/Delivery is automatically created.Check Auto Pick Confirm box for accepting the suggestions given by system and staging the goods at staging subinventory. If you don't want to use the suggestions made by the system then say Auto pick confirm as "No". Then you need to go to Transact move order screen in Inventory and modify the suggestions made by the system and thus manually pick confirm.

2.1.1. Pick Release Transactions

WSH_PICKING_BATCHESBATCH_ID NAME TRIP_ID TRIP_STOP_ID DELIVERY_ID DELIVERY_DETAIL_ID BACKORDERS_ONLY_FLAG DOCUMENT_SET_ID EXISTING_RSVS_ONLY_FLAG SHIPMENT_PRIORITY_CODE SHIP_METHOD_CODE CARRIER_ID CUSTOMER_ID SHIP_TO_LOCATION_ID ORDER_HEADER_ID

ORDER_LINE_ID

WSH_NEW_DELIVERIESDELIVERY_ID NAME PLANNED_FLAG STATUS_CODE INITIAL_PICKUP_DATE INITIAL_PICKUP_LOCATION_ID ULTIMATE_DROPOFF_LOCATION_ID ULTIMATE_DROPOFF_DATE CUSTOMER_ID INTMED_SHIP_TO_LOCATION_ID POOLED_SHIP_TO_LOCATION_ID FREIGHT_TERMS_CODE FOB_CODE FOB_LOCATION_ID WAYBILL

WSH_DELIVERY_ASSIGNMENTSDELIVERY_ASSIGNMENT_ID DELIVERY_ID DELIVERY_DETAIL_ID PARENT_DELIVERY_ID PARENT_DELIVERY_DETAIL_ID

ACTIVE_FLAG

Page 29: Sales Order Life Cycle

Query to find out the shipper info : Query to find out shipper detail info :

select wnd.delivery_id delivery_id, substrb(party.party_name,1,50) customer, wpb.name batch_name, wsh_util_core.get_location_description( wnd.INITIAL_PICKUP_LOCATION_ID, 'NEW UI CODE') ship_from, wsh_util_core.get_location_description( wnd.ULTIMATE_DROPOFF_LOCATION_ID, 'NEW UI CODE') ship_to, wnd.INITIAL_PICKUP_DATE pickup_date, wnd.ULTIMATE_DROPOFF_DATE dropoff_date, lv.meaning ship_method, wnd.WAYBILL waybill, wnd.GROSS_WEIGHT gross_weight, wnd.WEIGHT_UOM_CODE uom, wnd.status_code, we.messagefrom wsh_new_deliveries wnd, wsh_picking_batches wpb, wsh_exceptions we, fnd_lookup_values_vl lv, hz_cust_accounts cust_acct, hz_parties partywhere wnd.delivery_id = 12814and wpb.batch_id = wnd.batch_id and we.delivery_id(+) = wnd.delivery_id and we.exception_name(+) = 'WSH_BATCH_MESSAGE' and lv.lookup_code(+) = wpb.ship_method_code and lv.lookup_type(+) = 'SHIP_METHOD' and lv.view_application_id(+) = 3 and cust_acct.cust_account_id (+)=wnd.customer_idand party.party_id(+) = cust_acct.party_id /

SELECT wnd.delivery_id, wnd.name delivery_name, wdd.source_header_number so_order_number, oola.line_number so_line_number, wdd.source_header_id so_header_id, wdd.source_line_id so_line_id, wdd.shipping_instructions, wdd.inventory_item_id, wdd.requested_quantity_uom, msi.description item_description, msi.revision_qty_control_code , wdd.ship_method_code carrier, wdd.shipment_priority_code priority, wdd.organization_id, wnd.initial_pickup_location_id, wdd.released_status, wdd.source_code FROM mtl_system_items_vl msi, oe_order_lines_all oola, wsh_delivery_details wdd, wsh_delivery_assignments wda, wsh_new_deliveries wnd WHERE wnd.delivery_id =18910 AND wda.delivery_id = wnd.delivery_id(+) AND wdd.delivery_detail_id = wda.delivery_detail_id AND wdd.inventory_item_id = msi.inventory_item_id(+) AND wdd.organization_id = msi.organization_id(+) AND wdd.source_line_id = oola.line_id AND wdd.source_header_id = oola.header_id/

2.2. Order Pick Confirm

Navigate to Transact Move Orders window in Inventory.

Page 30: Sales Order Life Cycle

Search the Sales order with order type, Order number and source as ‘ORDER ENTRY’. You can also search using the Picking batch number.

Page 31: Sales Order Life Cycle

After finding the Move order, click on view/update allocation to update the system generated inventory allocations.

Page 32: Sales Order Life Cycle

View the allocation done by the system. You can change the subinventory and quantity and click on transact.View the status of the order line in Shipping transactions window. The status shoud be changed to Staged/Pick confirmed.

2.1.1. Pick Confirm Transactions

MTL_TXN_REQUEST_HEADERSHEADER_ID REQUEST_NUMBER TRANSACTION_TYPE_ID MOVE_ORDER_TYPE ORGANIZATION_ID DESCRIPTION DATE_REQUIRED FROM_SUBINVENTORY_CODETO_SUBINVENTORY_CODE TO_ACCOUNT_ID HEADER_STATUS STATUS_DATE GROUPING_RULE_ID SHIP_TO_LOCATION_ID FREIGHT_CODE SHIPMENT_METHOD AUTO_RECEIPT_FLAG REFERENCE_ID REFERENCE_DETAIL_ID

ASSIGNMENT_ID

MTL_TXN_REQUEST_LINES LINE_ID HEADER_ID LINE_NUMBER ORGANIZATION_ID INVENTORY_ITEM_ID REVISION FROM_SUBINVENTORY_CODE FROM_LOCATOR_ID TO_SUBINVENTORY_CODE TO_LOCATOR_ID LOT_NUMBER SERIAL_NUMBER_START SERIAL_NUMBER_END UOM_CODE QUANTITY QUANTITY_DELIVERED QUANTITY_DETAILED DATE_REQUIRED REASON_ID REFERENCE

Page 33: Sales Order Life Cycle

Query to find out Move order line details :

SELECT wnd.delivery_id, wnd.name delivery_name, wnd.initial_pickup_location_id, mtrh.request_number mo_number, mtrl.line_number mo_line_number, mtrl.line_id mo_line_id, mtrl.from_subinventory_code, mtrl.to_subinventory_code, mtrl.lot_number, mtrl.serial_number_start, mtrl.serial_number_end, mtrl.uom_code, mtrl.quantity, mtrl.quantity_delivered, mtrl.quantity_detailed, wdd.source_header_number so_order_number, oola.line_number so_line_number, wdd.source_header_id so_header_id, wdd.source_line_id so_line_id, wdd.shipping_instructions, wdd.inventory_item_id, wdd.requested_quantity_uom, msi.description item_description, msi.revision_qty_control_code , wdd.ship_method_code carrier, wdd.shipment_priority_code priority, wdd.organization_id, wdd.released_status, wdd.source_code FROM mtl_system_items_vl msi, oe_order_lines_all oola, mtl_txn_request_lines mtrl, mtl_txn_request_headers mtrh, wsh_delivery_details wdd, wsh_delivery_assignments wda, wsh_new_deliveries wnd WHERE wnd.delivery_id =18910 AND wda.delivery_id = wnd.delivery_id(+) AND wdd.delivery_detail_id = wda.delivery_detail_id AND wdd.move_order_line_id = mtrl.line_id AND mtrl.header_id = mtrh.header_id AND wdd.inventory_item_id = msi.inventory_item_id(+) AND wdd.organization_id = msi.organization_id(+) AND wdd.source_line_id = oola.line_id AND wdd.source_header_id = oola.header_id /

2.3. Order Ship Confirm

Page 34: Sales Order Life Cycle

Navigate to Shipping Transactions Form and query the order. All non-shipped lines will appear. Click on the details button to see detailed line information.

Here, you can enter the actual quantity to be shipped.

Page 35: Sales Order Life Cycle

Click on the Delivery tab and the details button to see detailed delivery information. You can enter the waybill number & additional info etc. here.To ship confirm the order, select the Actions list in the Delivery Tab, choose Ship Confirm and GO.

The ship confirmation window will appear and give you the options to backorder, ship all or ship partial quantities and set user defined shipping documents to print. Enter the trip creation options viz: Ship method, departure date, close trip and defer interface.The ship confirm process triggers the inventory interface automatically to update quantities, and triggers the Order Management Interface to update the status of the order lines.

Page 36: Sales Order Life Cycle

Invoicing the order: Once the Fulfillment activity completes, a Background Workflow Process processes the order line(s) to the Invoice Interface activity. The invoice interface activity places the information from the sales order line into the Receivables Interface tables. The invoice is not generated until the Autoinvoice program in Receivables has been run. The invoice will then be viewable in the Sales Orders window. The line will be eligible to close after the Invoice interface workflow is run.

2.3.1. Ship Confirm Transactions

WSH_NEW_DELIVERIESDELIVERY_ID NAME PLANNED_FLAG STATUS_CODE INITIAL_PICKUP_DATE INITIAL_PICKUP_LOCATION_ID ULTIMATE_DROPOFF_LOCATION_ID ULTIMATE_DROPOFF_DATE CUSTOMER_ID INTMED_SHIP_TO_LOCATION_ID POOLED_SHIP_TO_LOCATION_ID FREIGHT_TERMS_CODE FOB_CODE FOB_LOCATION_ID

WSH_DELIVERY_DETAILSDELIVERY_DETAIL_ID SOURCE_CODE SOURCE_HEADER_ID SOURCE_LINE_ID SOURCE_HEADER_TYPE_ID SOURCE_HEADER_TYPE_NAME CUST_PO_NUMBER CUSTOMER_ID INVENTORY_ITEM_ID ITEM_DESCRIPTION

Page 37: Sales Order Life Cycle

WAYBILL

WSH_DELIVERY_LEGSDELIVERY_LEG_ID DELIVERY_ID PICK_UP_STOP_ID DROP_OFF_STOP_ID SEQUENCE_NUMBER LOADING_ORDER_FLAG GROSS_WEIGHT NET_WEIGHT WEIGHT_UOM_CODE VOLUME VOLUME_UOM_CODE LOAD_TENDER_STATUS SHIPPER_TITLE SHIPPER_PHONE

WSH_TRIPSTRIP_ID NAME PLANNED_FLAG ARRIVE_AFTER_TRIP_ID STATUS_CODE VEHICLE_ITEM_ID VEHICLE_NUMBER CARRIER_ID SHIP_METHOD_CODE ROUTE_ID ROUTING_INSTRUCTIONS VEHICLE_ORGANIZATION_ID

WSH_TRIP_STOPSSTOP_ID TRIP_ID STOP_LOCATION_ID STATUS_CODE STOP_SEQUENCE_NUMBER PLANNED_ARRIVAL_DATE PLANNED_DEPARTURE_DATE ACTUAL_ARRIVAL_DATE ACTUAL_DEPARTURE_DATE DEPARTURE_GROSS_WEIGHT DEPARTURE_NET_WEIGHT WEIGHT_UOM_CODE DEPARTURE_VOLUME

Query to find Bill of Lading info of the Delivery :

Query to find delivery leg and pick up stop info :

select wnd.delivery_id delivery_id, wdi.sequence_number bol_number, wdi.bol_notify_party, wdi.port_of_loading, wdi.port_of_discharge, wnd.WAYBILL waybill, wnd.GROSS_WEIGHT gross_weight, wnd.WEIGHT_UOM_CODE uom, wnd.status_codefrom wsh_new_deliveries wnd, wsh_delivery_legs wdl, wsh_document_instances wdiwhere wnd.delivery_id =12784and wnd.delivery_id = wdl.delivery_id (+)and wdi.entity_id (+) = wdl.delivery_leg_idAND wdi.entity_name (+) = 'WSH_DELIVERY_LEGS' AND wdi.document_type (+) = 'BOL'AND wdi.status (+) <> 'CANCELLED'/

SELECT wt.trip_id, wt.name, wt.STATUS_CODE, wt.VEHICLE_ITEM_ID, wt.VEHICLE_NUMBER, wt.CARRIER_ID, wt.SHIP_METHOD_CODE, wts.STOP_ID, wts.STOP_LOCATION_ID, wts.STATUS_CODE, wts.STOP_SEQUENCE_NUMBER, wts.PLANNED_ARRIVAL_DATE, wts.PLANNED_DEPARTURE_DATE, wts.ACTUAL_ARRIVAL_DATE, wts.ACTUAL_DEPARTURE_DATE, wts.DEPARTURE_NET_WEIGHT, wts.WEIGHT_UOM_CODE, wdl.DELIVERY_LEG_ID, wdl.DELIVERY_ID, wdl.PICK_UP_STOP_ID, wdl.DROP_OFF_STOP_ID, wdl.SEQUENCE_NUMBER, wdl.LOADING_ORDER_FLAG, wdl.SHIPPER_TITLE, wdl.SHIPPER_PHONEFROM wsh_trips wt ,wsh_trip_stops wts ,wsh_delivery_legs wdlWHERE wdl.delivery_id =12814 AND wts.stop_id = wdl.pick_up_stop_id AND wts.trip_id = wt.trip_id;

2.4. Shipping APIs

2.4.1. Shipping Transaction Form(STF) actions and APIs mapping

Page 38: Sales Order Life Cycle

A sample list of STF actions and their equivalent APIs are given here. These are used in a customization scenario given below.

STF Action API API Action code

Auto create Delivery WSH_DELIVERY_DETAILS_PUB. AUTOCREATE_DELIVERIES

-

Pick Release Delivery WSH_DELIVERIES_PUB. DELIVERY_ACTION PICK-RELEASE

Update actual shippedquantities

WSH_DELIVERY_DETAILS_PUB. UPDATE_SHIPPING_ATTRIBUTES

UPDATE

Ship confirm delivery WSH_DELIVERIES_PUB. DELIVERY_ACTION CONFIRM

2.4.1.1 Scenario 1Assume a scenario where an Enterprise uses a legacy system to ship the goods and then need to synchronize the Oracle EBS with actual shipment data.We will use the above APIs and keep Oracle tables in sync with the legacy system.

At first the actual shipment data is staged in a temporary table. You need to identify the actual delivey details shipment and call "Auto-create delivery" API which will group the delivery details and create the Delivery in Oracle. Then call "Pick release Delivery" API to pick the delivery. Now your delivery deails are staged/pick confirmed for the whole ordered quantity. Now call "Update actual shipped qty" API to update the actual shipped quantities as per legacy information. Next you need to call "Ship confirm Delivery" API to confirm the Shipper. This completes the shipment synchronization process with Oracle.

2.4.1.2 Scenario 2An example of how to ship confirm a delivery consisting of delivery details that have already been pick released and assigned to a delivery..

Call WSH_DELIVERY_DETAILS_PUB.Update_Shipping_Attributes API to update the corresponding delivery details to ship all quantities in the first delivery detail; to back order all in the second; to stage all in the third delivery detail.Call WSH_FREIGHT_COSTS_PUB.Create_Update_Freight_Costs API to create freight costs for the delivery that the details have been assigned to.Call WSH_CONTAINER_PUB.Auto_Pack to pack the delivery lines into a container.Call WSH_DELIVERIES_PUB.Delivery_Action API to ship confirm the delivery.

Procedure SHIP_CONFIRM1::::::::::::changed_attributes WSH_DELIVERY_DETAILS_PUB.ChangedAttributeTabType;p_entity_tab WSH_UTIL_CORE.id_tab_type;

p_group_id_tab WSH_UTIL_CORE.id_tab_type;

Page 39: Sales Order Life Cycle

p_pack_cont_flag varchar2(30);

x_cont_inst_tab WSH_UTIL_CORE.id_tab_type;

--Parameters for WSH_FREIGHT_COSTS_PUB.Create_Update_Freight_Costs.

action_code VARCHAR2(15);

pub_freight_costs WSH_FREIGHT_COSTS_PUB.PubFreightCostRecType;

freight_cost_id NUMBER;

--Parameters for WSH_DELIVERIES_PUB.Delivery_Action.

p_action_code VARCHAR2(15);

p_delivery_id NUMBER;

p_delivery_name VARCHAR2(30);

p_asg_trip_id NUMBER;

::::::::::::::::::::::::::::::::::::::::::::::::::

/*Handle exceptions*/

fail_api EXCEPTION;

BEGIN

FND_GLOBAL.APPS_INITIALIZE(user_id => 1001594

,resp_id =>52892

,resp_appl_id =>660);

/* Values for updating delivery details to ship all quantities in the first line, stage everything in the second line, and back order all in the third. It is assumed that the user knows the quantities in each line. */

source_code := 'OE'; -- The only source code that should be used by the API

changed_attributes(1).delivery_detail_id := 13431; -- Ship All quantities in this detail.

changed_attributes(1).shipped_quantity := 1;

changed_attributes(2).source_line_id := 13432; -- Back Order All in this detail.

changed_attributes(2).shipped_quantity := 0;

changed_attributes(2).cycle_count_quantity := 2;

Page 40: Sales Order Life Cycle

changed_attributes(3).source_line_id := 13433; -- Stage All in this detail.

changed_attributes(3).shipped_quantity := 0;

changed_attributes(3).cycle_count_quantity := 0;

WSH_DELIVERY_DETAILS_PUB.Update_Shipping_Attributes(

:::::::::::::

p_changed_attributes => changed_attributes,

p_source_code => source_code);

if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) then

raise fail_api;

end if;

/* Values for creating freight costs for the delivery created for the above delivery details. The delivery can be queried for the respective delivery detail through wsh_delivery_assignments. */

pub_freight_costs.freight_cost_type_id := 1;

pub_freight_costs.unit_amount := 20;

pub_freight_costs.currency_code := 'USD';

pub_freight_costs.delivery_id := 5341;

WSH_FREIGHT_COSTS_PUB.Create_Update_Freight_Costs(

::::::::::

p_pub_freight_costs => pub_freight_costs,

p_action_code => 'CREATE',

x_freight_cost_id => freight_cost_id);

if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) then

raise fail_api;

end if;

/* Values for autopacking the delivery details to a container. */

p_entity_tab(1) := 13431;

p_entity_tab(2) := 13432;

p_entity_tab(3) := 13434;

Page 41: Sales Order Life Cycle

WSH_CONTAINER_PUB.Auto_Pack(

p_api_version => 1.0,

p_init_msg_list => init_msg_list,

p_commit => p_commit,

p_validation_level => p_validation_level,

x_return_status => x_return_status,

x_msg_count => x_msg_count,

x_msg_data => x_msg_data,

p_entity_tab => p_entity_tab,

p_entity_type => 'L',

p_group_id_tab => p_group_id_tab,

p_pack_cont_flag => p_pack_cont_flag,

x_cont_inst_tab => x_cont_inst_tab);

if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) then

raise fail_api;

end if;

/* Values for Ship Confirming the delivery.*/

p_action_code := 'CONFIRM'; -- The action code for ship confirm

p_delivery_id := 5341; -- The delivery that needs to be confirmed

p_delivery_name := '5341'; -- The delivery name,

p_sc_action_flag := 'S'; -- Ship entered quantity.

p_sc_close_trip_flag := 'Y'; -- Close the trip after ship confirm

p_sc_trip_ship_method := 'GROUND'; -- The ship method code

WSH_DELIVERIES_PUB.Delivery_Action(

p_action_code => p_action_code,

p_delivery_id => p_delivery_id,

p_delivery_name => p_delivery_name,

Page 42: Sales Order Life Cycle

p_sc_action_flag => p_sc_action_flag,

p_sc_close_trip_flag => p_sc_close_trip_flag,

p_sc_report_set_name => p_sc_report_set_name,

p_wv_override_flag => p_wv_override_flag,

x_trip_id => x_trip_id,

::::::::::::

if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) then

raise fail_api;

end if;

exception

when fail_api then

WSH_UTIL_CORE.get_messages('Y', x_msg_summary, x_msg_details, x_msg_count);

if x_msg_count > 1 then

x_msg_data := x_msg_summary || x_msg_details;

else

x_msg_data := x_msg_summary;

end if;

END SHIP_CONFIRM1;

2.4.1.2. Scenario 3Ship confirm delivery details that have originally not been assigned to a delivery.Call WSH_DELIVERIES_PUB.CREATE_UPDATE_DELIVERY to create a new delivery.Call WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery to assign the delivery details to the new delivery.Call WSH_DELIVERIES_PUB.Delivery_Action to ship confim.

Procedure SHIP_CONFIRM2::::::::::::::::::BeginFND_GLOBAL.APPS_INITIALIZE(user_id => 1001594,resp_id =>52892,resp_appl_id =>660);::::::::::-- Values for WSH_DELIVERIES_PUB.CREATE_UPDATE_DELIVERY to create a new deliverydelivery_info.initial_pickup_location_id := 204;delivery_info.ultimate_dropoff_location_id := 840;

Page 43: Sales Order Life Cycle

delivery_info.gross_weight := 10;delivery_info.ship_method_code := 'UPS';p_action_code := 'CREATE';

WSH_DELIVERIES_PUB.CREATE_UPDATE_DELIVERY(p_api_version_number => 1.0,::::::::::::::::::p_action_code => p_action_code,p_delivery_info => delivery_info,x_delivery_id => delivery_id::::::::::::

if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) thenraise fail_api;end if;p_delivery_id := delivery_id;pub_freight_costs.delivery_id := delivery_id;

-- Call Detail_to_Delivery with an action code of ASSIGN to assign details to a delivery.p_TabOfDelDets(1) := 13463;p_TabOfDelDets(2) := 13464;p_action := 'ASSIGN';

WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery(p_api_version => 1.0,::::::::::::::::::::::::::::p_TabOfDelDets => p_TabOfDelDets,p_action => p_action,p_delivery_id => p_delivery_id,:::::::::::::if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) thenraise fail_api;end if;

-- Values for Ship Confirming the delivery.p_action_code := 'CONFIRM'; -- The action code for ship confirmp_delivery_id := 5341; -- The delivery that needs to be confirmedp_delivery_name := '5341'; -- The delivery name,p_sc_action_flag := 'S'; -- Ship entered quantity.p_sc_close_trip_flag := 'Y'; -- Close the trip after ship confirmp_sc_trip_ship_method := 'UPS'; -- The ship method code

WSH_DELIVERIES_PUB.Delivery_Action(p_api_version_number => 1.0,::::::::::::::::::p_action_code => p_action_code,p_delivery_id => p_delivery_id,p_delivery_name => p_delivery_name,

Page 44: Sales Order Life Cycle

p_sc_action_flag => p_sc_action_flag,p_sc_close_trip_flag => p_sc_close_trip_flag,p_sc_trip_ship_method => p_sc_trip_ship_method::::::::::::::::::

if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) thenraise fail_api;end if;exceptionwhen fail_api thenWSH_UTIL_CORE.get_messages('Y', x_msg_summary, x_msg_details, x_msg_count);if x_msg_count > 1 thenx_msg_data := x_msg_summary || x_msg_details;elsex_msg_data := x_msg_summary;end if;END;