select oelines.sold_to_org_id,
oelines.ship_to_org_id ship_to_org_id3,
nvl(oelines.intmed_ship_to_org_id, -1) intmed_ship_to_org_id,
oelines.ship_from_org_id,
oelines.inventory_item_id,
oelines.ordered_item_id,
&LP_Q1_COL1 requirement_date,
&LP_Q1_COL2 firm_status,
oelines.demand_bucket_type_code,
&LP_Q1_COL17 schedule_type,
to_number(&LP_Q1_COL3) order_number,
to_number(&LP_Q1_COL4) line_number,
&LP_Q1_COL5 cust_po_number,
to_number(&LP_Q1_COL6) ordered_quantity,
&LP_Q1_COL7 order_quantity_uom,
to_number(&LP_Q1_COL8) shipped_quantity,
&LP_Q1_COL9 shipping_quantity_uom,
to_number(&LP_Q1_COL10) fulfilled_quantity,
&LP_Q1_COL11 fulfilled_quantity_uom,
&LP_Q1_COL12 schedule_reference_num,
&LP_Q1_COL13 customer_job,
&LP_Q1_COL14 planning_sequence,
&LP_Q1_COL15 cust_model_serial_number,
&LP_Q1_COL16 customer_record_year,
RLM_RLMDMSIQ_XMLP_PKG.customer_nameformula(oelines.sold_to_org_id) customer_name,
RLM_RLMDMSIQ_XMLP_PKG.customer_numberformula(oelines.sold_to_org_id) customer_number,
RLM_RLMDMSIQ_XMLP_PKG.intmed_ship_to_locationformul(nvl ( oelines.intmed_ship_to_org_id , - 1 )) intmed_ship_to_location,
RLM_RLMDMSIQ_XMLP_PKG.intmed_ship_to_nameformula(nvl ( oelines.intmed_ship_to_org_id , - 1 )) intmed_ship_to_name,
RLM_RLMDMSIQ_XMLP_PKG.ship_to_locationformula(oelines.ship_to_org_id) ship_to_location,
RLM_RLMDMSIQ_XMLP_PKG.ship_to_nameformula(oelines.ship_to_org_id) ship_to_name,
RLM_RLMDMSIQ_XMLP_PKG.ship_from_codeformula(oelines.ship_from_org_id) ship_from_code,
RLM_RLMDMSIQ_XMLP_PKG.ship_from_nameformula(oelines.ship_from_org_id) ship_from_name,
RLM_RLMDMSIQ_XMLP_PKG.concatenated_segmentsformula(oelines.inventory_item_id, oelines.ship_from_org_id) concatenated_segments,
RLM_RLMDMSIQ_XMLP_PKG.descriptionformula(oelines.inventory_item_id, oelines.ship_from_org_id) description,
RLM_RLMDMSIQ_XMLP_PKG.customer_item_numberformula(oelines.ordered_item_id) customer_item_number,
RLM_RLMDMSIQ_XMLP_PKG.customer_item_descformula(oelines.ordered_item_id) customer_item_desc,
RLM_RLMDMSIQ_XMLP_PKG.bucket_type_codeformula(oelines.demand_bucket_type_code) bucket_type_code,
RLM_RLMDMSIQ_XMLP_PKG.cf_sched_type(&LP_Q1_COL17) CF_sched_type
from oe_order_lines_all oelines,
oe_order_headers_all oeheaders,
rlm_schedule_lines_all schlines,
rlm_schedule_headers schheaders
where
oelines.header_id = oeheaders.header_id
and oelines.authorized_to_ship_flag = 'Y'
and oelines.source_document_id = schlines.header_id
and oelines.source_document_line_id = schlines.line_id
and schlines.header_id = schheaders.header_id
and oelines.item_identifier_type = 'CUST'
and schheaders.org_id = schlines.org_id
and schheaders.org_id = oeheaders.org_id
and schheaders.org_id = oelines.org_id
&LP_Q1_LINES
&P_WHERE_CLAUSE1
&P_WHERE_CLAUSE2
&LP_Q1_GROUP_BY
ORDER BY 1 ASC,3 ASC,2 ASC,4 ASC,6 ASC,5 ASC |