Thursday, October 14, 2010

Sales Order Headers and Line datails

CREATE OR REPLACE FORCE VIEW APPS.OE_ORDER_LINES_V
(
ROW_ID,
LINE_ID,
ORG_ID,
HEADER_ID,
LINE_TYPE_ID,
LINE_NUMBER,
ORDERED_ITEM,
REQUEST_DATE,
PROMISE_DATE,
SCHEDULE_ARRIVAL_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,
AUTO_SELECTED_QUANTITY,
TAX_EXEMPT_FLAG,
TAX_EXEMPT_NUMBER,
TAX_EXEMPT_REASON_CODE,
CUST_PO_NUMBER,
SHIP_TOLERANCE_ABOVE,
SHIP_TOLERANCE_BELOW,
DEMAND_BUCKET_TYPE_CODE,
RLA_SCHEDULE_TYPE_CODE,
CUSTOMER_DOCK_CODE,
CUSTOMER_JOB,
CUSTOMER_PRODUCTION_LINE,
CUST_MODEL_SERIAL_NUMBER,
PROJECT_ID,
TASK_ID,
END_ITEM_UNIT_NUMBER,
SOLD_TO_ORG_ID,
SHIP_FROM_ORG_ID,
SHIP_TO_ORG_ID,
DELIVER_TO_ORG_ID,
INTMED_SHIP_TO_ORG_ID,
INVOICE_TO_ORG_ID,
SHIP_TO_CONTACT_ID,
DELIVER_TO_CONTACT_ID,
INTMED_SHIP_TO_CONTACT_ID,
INVOICE_TO_CONTACT_ID,
INVENTORY_ITEM_ID,
TAX_DATE,
TAX_CODE,
TAX_RATE,
DEMAND_CLASS_CODE,
SCHEDULE_STATUS_CODE,
SOURCE_TYPE_CODE,
PRICE_LIST_ID,
PRICING_DATE,
SHIPMENT_NUMBER,
AGREEMENT_ID,
SHIPMENT_PRIORITY_CODE,
SHIPPING_METHOD_CODE,
FREIGHT_TERMS_CODE,
FREIGHT_CARRIER_CODE,
FOB_POINT_CODE,
TAX_POINT_CODE,
PAYMENT_TERM_ID,
INVOICING_RULE_ID,
ACCOUNTING_RULE_ID,
ACCOUNTING_RULE_DURATION,
SOURCE_DOCUMENT_TYPE_ID,
ORIG_SYS_DOCUMENT_REF,
SOURCE_DOCUMENT_ID,
ORIG_SYS_LINE_REF,
SOURCE_DOCUMENT_LINE_ID,
REFERENCE_LINE_ID,
REFERENCE_TYPE,
REFERENCE_HEADER_ID,
ITEM_REVISION,
LINE_CATEGORY_CODE,
CUSTOMER_TRX_LINE_ID,
RETURN_CONTEXT,
RETURN_ATTRIBUTE1,
RETURN_ATTRIBUTE2,
RETURN_ATTRIBUTE3,
RETURN_ATTRIBUTE4,
RETURN_ATTRIBUTE5,
RETURN_ATTRIBUTE6,
RETURN_ATTRIBUTE7,
RETURN_ATTRIBUTE8,
RETURN_ATTRIBUTE9,
RETURN_ATTRIBUTE10,
RETURN_ATTRIBUTE11,
RETURN_ATTRIBUTE12,
RETURN_ATTRIBUTE13,
RETURN_ATTRIBUTE14,
RETURN_ATTRIBUTE15,
REF_ORDER_NUMBER,
REF_LINE_NUMBER,
REF_SHIPMENT_NUMBER,
REF_OPTION_NUMBER,
REF_INVOICE_NUMBER,
REFERENCE_CUSTOMER_TRX_LINE_ID,
REF_INVOICE_LINE_NUMBER,
UNIT_SELLING_PRICE,
UNIT_LIST_PRICE,
TAX_VALUE,
CONTEXT,
ATTRIBUTE1,
ATTRIBUTE2,
ATTRIBUTE3,
ATTRIBUTE4,
ATTRIBUTE5,
ATTRIBUTE6,
ATTRIBUTE7,
ATTRIBUTE8,
ATTRIBUTE9,
ATTRIBUTE10,
ATTRIBUTE11,
ATTRIBUTE12,
ATTRIBUTE13,
ATTRIBUTE14,
ATTRIBUTE15,
ATTRIBUTE16,
ATTRIBUTE17,
ATTRIBUTE18,
ATTRIBUTE19,
ATTRIBUTE20,
GLOBAL_ATTRIBUTE_CATEGORY,
GLOBAL_ATTRIBUTE1,
GLOBAL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TRIBUTE24,
INDUSTRY_ATTRIBUTE25,
INDUSTRY_ATTRIBUTE26,
INDUSTRY_ATTRIBUTE27,
INDUSTRY_ATTRIBUTE28,
INDUSTRY_ATTRIBUTE29,
INDUSTRY_ATTRIBUTE30,
TP_CONTEXT,
TP_ATTRIBUTE1,
TP_ATTRIBUTE2,
TP_ATTRIBUTE3,
TP_ATTRIBUTE4,
TP_ATTRIBUTE5,
TP_ATTRIBUTE6,
TP_ATTRIBUTE7,
TP_ATTRIBUTE8,
TP_ATTRIBUTE9,
TP_ATTRIBUTE10,
TP_ATTRIBUTE11,
TP_ATTRIBUTE12,
TP_ATTRIBUTE13,
TP_ATTRIBUTE14,
TP_ATTRIBUTE15,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_LOGIN,
PROGRAM_APPLICATION_ID,
PROGRAM_ID,
PROGRAM_UPDATE_DATE,
REQUEST_ID,
SHIP_MODEL_COMPLETE_FLAG,
ATO_LINE_ID,
CONFIGURATION_ID,
TOP_MODEL_LINE_ID,
LINK_TO_LINE_ID,
EXPLOSION_DATE,
COMPONENT_SEQUENCE_ID,
COMPONENT_CODE,
CONFIG_DISPLAY_SEQUENCE,
SORT_ORDER,
ITEM_TYPE_CODE,
OPTION_NUMBER,
COMPONENT_NUMBER,
MODEL_GROUP_NUMBER,
OPTION_FLAG,
DEP_PLAN_REQUIRED_FLAG,
VISIBLE_DEMAND_FLAG,
ACTUAL_ARRIVAL_DATE,
ACTUAL_SHIPMENT_DATE,
EARLIEST_ACCEPTABLE_DATE,
LATEST_ACCEPTABLE_DATE,
LINE_TYPE,
AGREEMENT,
PRICE_LIST,
ROUNDING_FACTOR,
ACCOUNTING_RULE,
INVOICING_RULE,
TERMS,
COMMITMENT,
SOLD_TO,
CUSTOMER_NUMBER,
SHIP_FROM,
SUBINVENTORY,
SHIP_FROM_LOCATION,
SHIP_TO,
SHIP_TO_LOCATION,
SHIP_TO_ADDRESS1,
SHIP_TO_ADDRESS2,
SHIP_TO_ADDRESS3,
SHIP_TO_ADDRESS4,
SHIP_TO_ADDRESS5,
DELIVER_TO,
DELIVER_TO_LOCATION,
DELIVER_TO_ADDRESS1,
DELIVER_TO_ADDRESS2,
DELIVER_TO_ADDRESS3,
DELIVER_TO_ADDRESS4,
INTMED_SHIP_TO,
INTMED_SHIP_TO_LOCATION,
INTMED_SHIP_TO_ADDRESS1,
INTMED_SHIP_TO_ADDRESS2,
INTMED_SHIP_TO_ADDRESS3,
INTMED_SHIP_TO_ADDRESS4,
INVOICE_TO,
INVOICE_TO_LOCATION,
INVOICE_TO_ADDRESS1,
INVOICE_TO_ADDRESS2,
INVOICE_TO_ADDRESS3,
INVOICE_TO_ADDRESS4,
INVOICE_TO_ADDRESS5,
SHIP_TO_CONTACT,
INTMED_SHIP_TO_CONTACT,
INVOICE_TO_CONTACT,
DELIVER_TO_CONTACT,
SOURCE_DOCUMENT_TYPE,
ORDER_NUMBER,
QUOTE_NUMBER,
VERSION_NUMBER,
ORDER_TYPE_ID,
ORDER_TYPE,
ORDERED_DATE,
HEADER_ROW_ID,
ORDER_SOURCE_ID,
SALESREP_ID,
RETURN_REASON_CODE,
SPLIT_FROM_LINE_ID,
LINE_SET_ID,
SPLIT_BY,
CUST_PRODUCTION_SEQ_NUM,
AUTHORIZED_TO_SHIP_FLAG,
VEH_CUS_ITEM_CUM_KEY_ID,
INVOICE_INTERFACE_STATUS_CODE,
OVER_SHIP_REASON_CODE,
OVER_SHIP_RESOLVED_FLAG,
SHIP_SET_ID,
ARRIVAL_SET_ID,
ARRIVAL_SET,
SHIP_SET,
OVER_SHIP_REASON,
ORDERED_ITEM_ID,
ITEM_IDENTIFIER_TYPE,
COMMITMENT_ID,
SHIPPING_INTERFACED_FLAG,
CREDIT_INVOICE_LINE_ID,
FIRST_ACK_CODE,
FIRST_ACK_DATE,
LAST_ACK_CODE,
LAST_ACK_DATE,
CREDIT_INVOICE_NUMBER,
PLANNING_PRIORITY,
CONFIG_HEADER_ID,
CONFIG_REV_NBR,
BOOKED_FLAG,
CANCELLED_FLAG,
OPEN_FLAG,
SOLD_FROM_ORG_ID,
FULFILLED_FLAG,
PROJECT_NUMBER,
TASK_NUMBER,
SHIPPING_INSTRUCTIONS,
PACKING_INSTRUCTIONS,
INVOICED_QUANTITY,
SERVICE_TXN_REASON_CODE,
SERVICE_TXN_COMMENTS,
SERVICE_DURATION,
SERVICE_PERIOD,
SERVICE_START_DATE,
SERVICE_END_DATE,
SERVICE_COTERMINATE_FLAG,
UNIT_SELLING_PERCENT,
UNIT_LIST_PERCENT,
UNIT_PERCENT_BASE_PRICE,
SERVICE_NUMBER,
SERVICE_REFERENCE_TYPE_CODE,
SERVICE_REFERENCE_LINE_ID,
SERVICE_REFERENCE_SYSTEM_ID,
FLOW_STATUS_CODE,
MODEL_REMNANT_FLAG,
FULFILLMENT_METHOD_CODE,
CALCULATE_PRICE_FLAG,
REVENUE_AMOUNT,
FULFILLMENT_DATE,
PREFERRED_GRADE,
ORDERED_QUANTITY2,
ORDERED_QUANTITY_UOM2,
SHIPPED_QUANTITY2,
CANCELLED_QUANTITY2,
SHIPPING_QUANTITY2,
SHIPPING_QUANTITY_UOM2,
FULFILLED_QUANTITY2,
UPGRADED_FLAG,
LOCK_CONTROL,
UNIT_SELLING_PRICE_PER_PQTY,
UNIT_LIST_PRICE_PER_PQTY,
CUSTOMER_LINE_NUMBER,
CUSTOMER_SHIPMENT_NUMBER,
CUSTOMER_ITEM_NET_PRICE,
CUSTOMER_PAYMENT_TERM_ID,
ORIGINAL_INVENTORY_ITEM_ID,
ORIGINAL_ITEM_IDENTIFIER_TYPE,
ORIGINAL_ORDERED_ITEM_ID,
ORIGINAL_ORDERED_ITEM,
ITEM_SUBSTITUTION_TYPE_CODE,
LATE_DEMAND_PENALTY_FACTOR,
OVERRIDE_ATP_DATE_CODE,
UNIT_COST,
USER_ITEM_DESCRIPTION,
ITEM_RELATIONSHIP_TYPE,
BLANKET_NUMBER,
BLANKET_LINE_NUMBER,
BLANKET_VERSION_NUMBER,
FIRM_DEMAND_FLAG,
EARLIEST_SHIP_DATE,
TRANSACTION_PHASE_CODE,
SOURCE_DOCUMENT_VERSION_NUMBER,
MINISITE_ID,
END_CUSTOMER_ID,
END_CUSTOMER_CONTACT_ID,
END_CUSTOMER_SITE_USE_ID,
END_CUSTOMER_NAME,
END_CUSTOMER_NUMBER,
END_CUSTOMER_CONTACT,
END_CUSTOMER_LOCATION,
END_CUSTOMER_ADDRESS1,
END_CUSTOMER_ADDRESS2,
END_CUSTOMER_ADDRESS3,
END_CUSTOMER_ADDRESS4,
END_CUSTOMER_ADDRESS5,
IB_OWNER,
IB_CURRENT_LOCATION,
IB_INSTALLED_AT_LOCATION,
RETROBILL_REQUEST_ID,
ORIGINAL_LIST_PRICE,
SERVICE_CREDIT_ELIGIBLE_CODE,
ORDER_FIRMED_DATE,
ACTUAL_FULFILLMENT_DATE,
ORIG_SYS_SHIPMENT_REF,
CHARGE_PERIODICITY_CODE
)
AS
SELECT L.ROWID ROW_ID,
L.LINE_ID,
L.ORG_ID,
L.HEADER_ID,
L.LINE_TYPE_ID,
L.LINE_NUMBER,
L.ORDERED_ITEM,
L.REQUEST_DATE,
L.PROMISE_DATE,
L.SCHEDULE_ARRIVAL_DATE,
L.SCHEDULE_SHIP_DATE,
L.ORDER_QUANTITY_UOM,
L.PRICING_QUANTITY,
L.PRICING_QUANTITY_UOM,
L.CANCELLED_QUANTITY,
L.SHIPPED_QUANTITY,
L.ORDERED_QUANTITY,
L.FULFILLED_QUANTITY,
L.SHIPPING_QUANTITY,
L.SHIPPING_QUANTITY_UOM,
L.DELIVERY_LEAD_TIME,
L.AUTO_SELECTED_QUANTITY,
L.TAX_EXEMPT_FLAG,
L.TAX_EXEMPT_NUMBER,
L.TAX_EXEMPT_REASON_CODE,
L.CUST_PO_NUMBER,
L.SHIP_TOLERANCE_ABOVE,
L.SHIP_TOLERANCE_BELOW,
L.DEMAND_BUCKET_TYPE_CODE,
L.RLA_SCHEDULE_TYPE_CODE,
L.CUSTOMER_DOCK_CODE,
L.CUSTOMER_JOB,
L.CUSTOMER_PRODUCTION_LINE,
L.CUST_MODEL_SERIAL_NUMBER,
L.PROJECT_ID,
L.TASK_ID,
L.END_ITEM_UNIT_NUMBER,
L.SOLD_TO_ORG_ID,
L.SHIP_FROM_ORG_ID,
L.SHIP_TO_ORG_ID,
L.DELIVER_TO_ORG_ID,
L.INTMED_SHIP_TO_ORG_ID,
L.INVOICE_TO_ORG_ID,
L.SHIP_TO_CONTACT_ID,
L.DELIVER_TO_CONTACT_ID,
L.INTMED_SHIP_TO_CONTACT_ID,
L.INVOICE_TO_CONTACT_ID,
L.INVENTORY_ITEM_ID,
L.TAX_DATE,
L.TAX_CODE,
L.TAX_RATE,
L.DEMAND_CLASS_CODE,
L.SCHEDULE_STATUS_CODE,
L.SOURCE_TYPE_CODE,
L.PRICE_LIST_ID,
L.PRICING_DATE,
L.SHIPMENT_NUMBER,
L.AGREEMENT_ID,
L.SHIPMENT_PRIORITY_CODE,
L.SHIPPING_METHOD_CODE,
L.FREIGHT_TERMS_CODE,
L.FREIGHT_CARRIER_CODE,
L.FOB_POINT_CODE,
L.TAX_POINT_CODE,
L.PAYMENT_TERM_ID,
L.INVOICING_RULE_ID,
L.ACCOUNTING_RULE_ID,
L.ACCOUNTING_RULE_DURATION,
L.SOURCE_DOCUMENT_TYPE_ID,
L.ORIG_SYS_DOCUMENT_REF,
L.SOURCE_DOCUMENT_ID,
L.ORIG_SYS_LINE_REF,
L.SOURCE_DOCUMENT_LINE_ID,
L.REFERENCE_LINE_ID,
L.REFERENCE_TYPE,
L.REFERENCE_HEADER_ID,
L.ITEM_REVISION,
L.LINE_CATEGORY_CODE,
L.CUSTOMER_TRX_LINE_ID,
L.RETURN_CONTEXT,
L.RETURN_ATTRIBUTE1,
L.RETURN_ATTRIBUTE2,
L.RETURN_ATTRIBUTE3,
L.RETURN_ATTRIBUTE4,
L.RETURN_ATTRIBUTE5,
L.RETURN_ATTRIBUTE6,
L.RETURN_ATTRIBUTE7,
L.RETURN_ATTRIBUTE8,
L.RETURN_ATTRIBUTE9,
L.RETURN_ATTRIBUTE10,
L.RETURN_ATTRIBUTE11,
L.RETURN_ATTRIBUTE12,
L.RETURN_ATTRIBUTE13,
L.RETURN_ATTRIBUTE14,
L.RETURN_ATTRIBUTE15,
NULL REF_ORDER_NUMBER,
NULL REF_LINE_NUMBER,
NULL REF_SHIPMENT_NUMBER,
NULL REF_OPTION_NUMBER,
NULL REF_INVOICE_NUMBER,
L.reference_customer_trx_line_id REFERENCE_CUSTOMER_TRX_LINE_ID,
NULL REF_INVOICE_LINE_NUMBER,
L.UNIT_SELLING_PRICE,
L.UNIT_LIST_PRICE,
L.TAX_VALUE,
L.CONTEXT,
L.ATTRIBUTE1,
L.ATTRIBUTE2,
L.ATTRIBUTE3,
L.ATTRIBUTE4,
L.ATTRIBUTE5,
L.ATTRIBUTE6,
L.ATTRIBUTE7,
L.ATTRIBUTE8,
L.ATTRIBUTE9,
L.ATTRIBUTE10,
L.ATTRIBUTE11,
L.ATTRIBUTE12,
L.ATTRIBUTE13,
L.ATTRIBUTE14,
L.ATTRIBUTE15,
L.ATTRIBUTE16,
L.ATTRIBUTE17,
L.ATTRIBUTE18,
L.ATTRIBUTE19,
L.ATTRIBUTE20,
L.GLOBAL_ATTRIBUTE_CATEGORY,
L.GLOBAL_ATTRIBUTE1,
L.GLOBAL_ATTRIBUTE2,
L.GLOBAL_ATTRIBUTE3,
L.GLOBAL_ATTRIBUTE4,
L.GLOBAL_ATTRIBUTE5,
L.GLOBAL_ATTRIBUTE6,
L.GLOBAL_ATTRIBUTE7,
L.GLOBAL_ATTRIBUTE8,
L.GLOBAL_ATTRIBUTE9,
L.GLOBAL_ATTRIBUTE10,
L.GLOBAL_ATTRIBUTE11,
L.GLOBAL_ATTRIBUTE12,
L.GLOBAL_ATTRIBUTE13,
L.GLOBAL_ATTRIBUTE14,
L.GLOBAL_ATTRIBUTE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P_ATTRIBUTE2,
L.TP_ATTRIBUTE3,
L.TP_ATTRIBUTE4,
L.TP_ATTRIBUTE5,
L.TP_ATTRIBUTE6,
L.TP_ATTRIBUTE7,
L.TP_ATTRIBUTE8,
L.TP_ATTRIBUTE9,
L.TP_ATTRIBUTE10,
L.TP_ATTRIBUTE11,
L.TP_ATTRIBUTE12,
L.TP_ATTRIBUTE13,
L.TP_ATTRIBUTE14,
L.TP_ATTRIBUTE15,
L.CREATION_DATE,
L.CREATED_BY,
L.LAST_UPDATE_DATE,
L.LAST_UPDATED_BY,
L.LAST_UPDATE_LOGIN,
L.PROGRAM_APPLICATION_ID,
L.PROGRAM_ID,
L.PROGRAM_UPDATE_DATE,
L.REQUEST_ID,
L.SHIP_MODEL_COMPLETE_FLAG,
L.ATO_LINE_ID,
L.CONFIGURATION_ID,
L.TOP_MODEL_LINE_ID,
L.LINK_TO_LINE_ID,
L.EXPLOSION_DATE,
L.COMPONENT_SEQUENCE_ID,
L.COMPONENT_CODE,
L.CONFIG_DISPLAY_SEQUENCE,
L.SORT_ORDER,
L.ITEM_TYPE_CODE,
L.OPTION_NUMBER,
L.COMPONENT_NUMBER,
L.MODEL_GROUP_NUMBER,
L.OPTION_FLAG,
L.DEP_PLAN_REQUIRED_FLAG,
L.VISIBLE_DEMAND_FLAG,
L.ACTUAL_ARRIVAL_DATE,
L.ACTUAL_SHIPMENT_DATE,
L.EARLIEST_ACCEPTABLE_DATE,
L.LATEST_ACCEPTABLE_DATE,
lt.name LINE_TYPE,
NULL AGREEMENT,
PL.NAME PRICE_LIST,
-PL1.ROUNDING_FACTOR ROUNDING_FACTOR,
ACCRULE.NAME ACCOUNTING_RULE,
INVRULE.NAME INVOICING_RULE,
TERM.NAME TERMS,
NULL COMMITMENT,
PARTY.PARTY_NAME SOLD_TO,
CUST_ACCT.ACCOUNT_NUMBER CUSTOMER_NUMBER,
ship_from_org.organization_code SHIP_FROM,
L.SUBINVENTORY SUBINVENTORY,
NULL SHIP_FROM_LOCATION,
ship_su.location SHIP_TO,
ship_su.location SHIP_TO_LOCATION,
ship_loc.address1 SHIP_TO_ADDRESS1,
ship_loc.address2 SHIP_TO_ADDRESS2,
ship_loc.address3 SHIP_TO_ADDRESS3,
ship_loc.address4 SHIP_TO_ADDRESS4,
DECODE (ship_loc.city, NULL, NULL, ship_loc.city || ', ')
|| DECODE (ship_loc.state,
NULL, ship_loc.province || ', ',
ship_loc.state || ', ')
|| DECODE (ship_loc.postal_code,
NULL, NULL,
ship_loc.postal_code || ', ')
|| DECODE (ship_loc.country, NULL, NULL, ship_loc.country)
SHIP_TO_ADDRESS5,
NULL DELIVER_TO,
NULL DELIVER_TO_LOCATION,
NULL DELIVER_TO_ADDRESS1,
NULL DELIVER_TO_ADDRESS2,
NULL DELIVER_TO_ADDRESS3,
NULL DELIVER_TO_ADDRESS4,
NULL INTMED_SHIP_TO,
NULL INTMED_SHIP_TO_LOCATION,
NULL INTMED_SHIP_TO_ADDRESS1,
NULL INTMED_SHIP_TO_ADDRESS2,
NULL INTMED_SHIP_TO_ADDRESS3,
NULL INTMED_SHIP_TO_ADDRESS4,
bill_su.location INVOICE_TO,
bill_su.location INVOICE_TO_LOCATION,
bill_loc.address1 INVOICE_TO_ADDRESS1,
bill_loc.address2 INVOICE_TO_ADDRESS2,
bill_loc.address3 INVOICE_TO_ADDRESS3,
bill_loc.address4 INVOICE_TO_ADDRESS4,
DECODE (bill_loc.city, NULL, NULL, bill_loc.city || ', ')
|| DECODE (bill_loc.state,
NULL, bill_loc.province || ', ',
bill_loc.state || ', ')
|| DECODE (bill_loc.postal_code,
NULL, NULL,
bill_loc.postal_code || ', ')
|| DECODE (bill_loc.country, NULL, NULL, bill_loc.country)
INVOICE_TO_ADDRESS5,
ship_party.PERSON_LAST_NAME
|| DECODE (ship_party.PERSON_FIRST_NAME,
NULL, NULL,
', ' || ship_party.PERSON_FIRST_NAME)
|| DECODE (ship_arl.meaning, NULL, NULL, ' ' || ship_arl.meaning)
SHIP_TO_CONTACT,
NULL INTMED_SHIP_TO_CONTACT,
invoice_party.PERSON_LAST_NAME
|| DECODE (invoice_party.PERSON_FIRST_NAME,
NULL, NULL,
', ' || invoice_party.PERSON_FIRST_NAME)
|| DECODE (invoice_arl.meaning,
NULL, NULL,
' ' || invoice_arl.meaning)
INVOICE_TO_CONTACT,
NULL DELIVER_TO_CONTACT,
NULL SOURCE_DOCUMENT_TYPE,
H.order_number ORDER_NUMBER,
H.quote_number QUOTE_NUMBER,
H.version_number VERSION_NUMBER,
H.order_type_id,
NULL ORDER_TYPE,
H.ordered_date ORDERED_DATE,
H.ROWID HEADER_ROW_ID,
L.order_source_id,
L.salesrep_id,
L.return_reason_code,
L.split_from_line_id,
L.Line_set_id,
L.Split_by,
L.cust_production_seq_num,
L.authorized_to_ship_flag,
L.veh_cus_item_cum_key_id,
L.invoice_interface_status_code,
L.over_ship_reason_code,
L.over_ship_resolved_flag,
L.ship_set_id,
L.arrival_set_id,
NULL ARRIVAL_SET,
NULL SHIP_SET,
NULL over_ship_reason,
L.ordered_item_id,
L.item_identifier_type,
L.commitment_id,
L.shipping_interfaced_flag,
L.credit_invoice_line_id,
L.FIRST_ACK_CODE,
L.FIRST_ACK_DATE,
L.LAST_ACK_CODE,
L.LAST_ACK_DATE,
NULL credit_invoice_number,
L.planning_priority,
L.config_header_id,
L.config_rev_nbr,
L.booked_flag,
L.cancelled_flag,
L.open_flag,
l.sold_from_org_id,
l.fulfilled_flag,
NULL project_number,
NULL task_number,
l.shipping_instructions,
l.packing_instructions,
l.invoiced_quantity,
l.service_txn_reason_code,
l.service_txn_comments,
l.service_duration,
l.service_period,
l.service_start_date,
l.service_end_date,
l.service_coterminate_flag,
l.unit_selling_percent,
l.unit_list_percent,
l.unit_percent_base_price,
l.service_number,
l.service_reference_type_code,
l.service_reference_line_id,
l.service_reference_system_id,
l.flow_status_code,
l.Model_Remnant_Flag,
l.fulfillment_method_code,
l.Calculate_price_flag,
l.Revenue_Amount,
l.fulfillment_date,
l.preferred_grade,
l.ordered_quantity2,
l.ordered_quantity_uom2,
l.shipped_quantity2,
l.cancelled_quantity2,
l.shipping_quantity2,
l.shipping_quantity_uom2,
l.fulfilled_quantity2,
l.upgraded_flag,
l.lock_control,
l.unit_selling_price_per_pqty,
l.unit_list_price_per_pqty,
l.customer_line_number,
l.customer_shipment_number,
l.customer_item_net_price,
l.customer_payment_term_id,
l.Original_Inventory_Item_Id,
l.Original_item_identifier_Type,
l.Original_ordered_item_id,
l.Original_ordered_item,
l.Item_substitution_type_code,
l.Late_demand_penalty_factor,
l.Override_atp_date_code,
l.unit_cost,
l.user_item_description,
l.item_relationship_type,
l.blanket_number,
l.blanket_line_number,
l.blanket_version_number,
l.firm_demand_flag,
l.earliest_ship_date,
l.transaction_phase_code,
l.source_document_version_number,
l.minisite_id,
l.end_customer_id,
l.end_customer_contact_id,
l.end_customer_site_use_id,
NULL end_customer_name,
NULL end_customer_number,
NULL end_customer_contact,
NULL end_customer_location,
NULL end_customer_address1,
NULL end_customer_address2,
NULL end_customer_address3,
NULL end_customer_address4,
NULL end_customer_address5,
l.ib_owner,
l.ib_current_location,
l.ib_installed_at_location,
l.retrobill_request_id,
l.Original_list_price,
l.SERVICE_CREDIT_ELIGIBLE_CODE,
l.ORDER_FIRMED_DATE,
l.ACTUAL_FULFILLMENT_DATE,
l.orig_sys_shipment_ref,
l.CHARGE_PERIODICITY_CODE
FROM mtl_parameters ship_from_org,
hz_cust_site_uses_all ship_su,
hz_party_sites ship_ps,
hz_locations ship_loc,
hz_cust_acct_sites_all ship_cas,
hz_cust_site_uses_all bill_su,
hz_party_sites bill_ps,
hz_locations bill_loc,
hz_cust_acct_sites_all bill_cas,
hz_parties party,
hz_cust_accounts cust_acct,
hz_cust_account_roles ship_roles,
hz_parties ship_party,
hz_org_contacts ship_cont,
hz_relationships ship_rel,
hz_cust_accounts ship_acct,
ar_lookups ship_arl,
hz_cust_account_roles invoice_roles,
hz_parties invoice_party,
hz_org_contacts invoice_cont,
hz_relationships invoice_rel,
hz_cust_accounts invoice_acct,
ar_lookups invoice_arl,
oe_order_headers_all H,
oe_order_lines_all L,
qp_list_headers_tl PL,
qp_list_headers_b PL1,
RA_RULES ACCRULE,
RA_RULES INVRULE,
RA_TERMS_TL TERM,
OE_TRANSACTION_TYPES_TL lt
WHERE L.line_type_id = LT.transaction_type_id
AND LT.language = USERENV ('LANG')
AND L.PRICE_LIST_ID = PL.list_header_id(+)
AND PL.language(+) = USERENV ('LANG')
AND PL.list_header_id = PL1.list_header_id(+)
AND L.ACCOUNTING_RULE_ID = ACCRULE.RULE_ID(+)
AND L.INVOICING_RULE_ID = INVRULE.RULE_ID(+)
AND L.PAYMENT_TERM_ID = TERM.TERM_ID(+)
AND TERM.Language(+) = USERENV ('LANG')
AND L.sold_to_org_id = cust_acct.cust_account_id(+)
AND CUST_ACCT.PARTY_ID = PARTY.PARTY_ID(+)
AND L.ship_from_org_id = ship_from_org.organization_id(+)
AND l.ship_to_org_id = ship_su.site_use_id(+)
AND ship_su.cust_acct_site_id = ship_cas.cust_acct_site_id(+)
AND ship_cas.party_site_id = ship_ps.party_site_id(+)
AND ship_loc.location_id(+) = ship_ps.location_id
AND l.invoice_to_org_id = bill_su.site_use_id(+)
AND bill_su.cust_acct_site_id = bill_cas.cust_acct_site_id(+)
AND bill_cas.party_site_id = bill_ps.party_site_id(+)
AND bill_loc.location_id(+) = bill_ps.location_id
AND l.ship_to_contact_id = ship_roles.cust_account_role_id(+)
AND ship_roles.party_id = ship_rel.party_id(+)
AND ship_roles.role_type(+) = 'CONTACT'
AND ship_cont.party_relationship_id(+) = ship_rel.relationship_id
AND ship_rel.subject_id = ship_party.party_id(+)
AND ship_roles.cust_account_id = ship_acct.cust_account_id(+)
AND NVL (ship_rel.object_id, -1) = NVL (ship_acct.party_id, -1)
AND ship_arl.lookup_type(+) = 'CONTACT_TITLE'
AND ship_arl.lookup_code(+) = ship_party.person_pre_name_adjunct
AND l.invoice_to_contact_id =
invoice_roles.cust_account_role_id(+)
AND invoice_roles.party_id = invoice_rel.party_id(+)
AND invoice_roles.role_type(+) = 'CONTACT'
AND invoice_cont.party_relationship_id(+) =
invoice_rel.relationship_id
AND invoice_rel.subject_id = invoice_party.party_id(+)
AND invoice_roles.cust_account_id =
invoice_acct.cust_account_id(+)
AND NVL (invoice_rel.object_id, -1) =
NVL (invoice_acct.party_id, -1)
AND invoice_arl.lookup_type(+) = 'CONTACT_TITLE'
AND invoice_arl.lookup_code(+) =
invoice_party.person_pre_name_adjunct
AND L.header_id = H.header_id;

No comments:

Post a Comment