700: Set Order Realtionships
701: the p_order_relationship argument take the
702: following enumerated Constant value:
703: Values: Meaning:
704: XDP_TYPES.IS_PREREQUISITE_OF Related order will not get executed
705: until the current order is
706: completed. If the current order is
707: canceled, the related order will
708: also be canceled.
706: completed. If the current order is
707: canceled, the related order will
708: also be canceled.
709:
710: XDP_TYPES.COMES_BEFORE Related order will not get executed
711: until the current order is
712: completed or the current order is
713: canceled.
714:
711: until the current order is
712: completed or the current order is
713: canceled.
714:
715: XDP_TYPES.COMES_AFTER Current order will not get executed
716: until the related order is
717: completed or the related order is
718: canceled.
719:
716: until the related order is
717: completed or the related order is
718: canceled.
719:
720: XDP_TYPES.IS_CHILD_OF Current order is the child order of
721: the related order.
722:
723: *******************************************************************/
724: Procedure Set_Order_Relationships(
743: select status_code into lv_rel_state
744: from xdp_order_headers
745: where order_id = p_related_sdp_order_id;
746:
747: IF p_order_relationship = XDP_TYPES.IS_PREREQUISITE_OF OR
748: p_order_relationship = XDP_TYPES.COMES_BEFORE
749: THEN
750: IF lv_curr_state IN ('CANCELED','ABORTED','SUCCESS','SUCCESS_WITH_OVERRIDE') THEN
751: return_code := -191283;
744: from xdp_order_headers
745: where order_id = p_related_sdp_order_id;
746:
747: IF p_order_relationship = XDP_TYPES.IS_PREREQUISITE_OF OR
748: p_order_relationship = XDP_TYPES.COMES_BEFORE
749: THEN
750: IF lv_curr_state IN ('CANCELED','ABORTED','SUCCESS','SUCCESS_WITH_OVERRIDE') THEN
751: return_code := -191283;
752: FND_MESSAGE.SET_NAME('XDP', 'XDP_ORDER_RELATION_ERROR');
777: IF return_code <> 0 THEN
778: return;
779: END IF;
780:
781: if p_order_relationship = XDP_TYPES.IS_PREREQUISITE_OF THEN
782: lv_relation := 'IS_PREREQUISITE_OF';
783: else
784: lv_relation := 'COMES_BEFORE';
785: end if;
873: IF return_code <> 0 THEN
874: return;
875: END IF;
876:
877: if p_order_relationship = XDP_TYPES.IS_PREREQUISITE_OF THEN
878: lv_relation := 'IS_PREREQUISITE_OF';
879: else
880: lv_relation := 'COMES_BEFORE';
881: end if;
967: error_description := FND_MESSAGE.GET;
968: return;
969: END IF;
970:
971: ELSIF p_order_relationship = XDP_TYPES.COMES_AFTER THEN
972: IF lv_curr_state IN ('CANCELED','ABORTED','SUCCESS','SUCCESS_WITH_OVERRIDE') THEN
973: return_code := -191283;
974: FND_MESSAGE.SET_NAME('XDP', 'XDP_ORDER_RELATION_ERROR');
975: FND_MESSAGE.SET_TOKEN('ORDER_ID', p_curr_sdp_order_id);
1183: END IF;
1184:
1185: null;
1186:
1187: ELSIF p_order_relationship = XDP_TYPES.IS_CHILD_OF THEN
1188: lv_relation := 'IS_CHILD_OF';
1189: BEGIN
1190: select 'Y' into lv_exists
1191: from dual
1256: the p_wi_relationship argument take the
1257: following enumerated Constant value:
1258:
1259: Values: Meaning:
1260: XDP_TYPES.MERGED_INTO Related workitem is merged into the
1261: current workitem. If the current
1262: workitem is completed, then the
1263: related workitem is completed.
1264: */
1288: into lv_rel_state,lv_rel_order_id
1289: from XDP_FULFILL_WORKLIST
1290: where workitem_instance_id = p_related_wi_instance_id;
1291:
1292: IF p_wi_relationship = XDP_TYPES.MERGED_INTO THEN
1293: IF lv_curr_state IN ('CANCELED','ABORTED','SUCCESS','SUCCESS_WITH_OVERRIDE') THEN
1294: return_code := -191286;
1295: FND_MESSAGE.SET_NAME('XDP', 'XDP_WI_RELATION_ERROR');
1296: FND_MESSAGE.SET_TOKEN('WORK_ITEM_ID', p_curr_wi_instance_id);
1433: /*
1434: Get the order header information for a giving order
1435: */
1436: FUNCTION Get_Order_Header(p_sdp_order_id IN NUMBER)
1437: return XDP_TYPES.ORDER_HEADER
1438: IS
1439: lv_header XDP_TYPES.ORDER_HEADER;
1440: BEGIN
1441: select
1435: */
1436: FUNCTION Get_Order_Header(p_sdp_order_id IN NUMBER)
1437: return XDP_TYPES.ORDER_HEADER
1438: IS
1439: lv_header XDP_TYPES.ORDER_HEADER;
1440: BEGIN
1441: select
1442: order_id,
1443: external_order_number,
1493: /*
1494: Get all the line items for a given line item id
1495: */
1496: FUNCTION Get_Order_Lines( p_sdp_order_id IN NUMBER)
1497: return XDP_TYPES.ORDER_LINE_LIST
1498: IS
1499: lv_line_list XDP_TYPES.ORDER_LINE_LIST;
1500: CURSOR lc_line IS
1501: select *
1495: */
1496: FUNCTION Get_Order_Lines( p_sdp_order_id IN NUMBER)
1497: return XDP_TYPES.ORDER_LINE_LIST
1498: IS
1499: lv_line_list XDP_TYPES.ORDER_LINE_LIST;
1500: CURSOR lc_line IS
1501: select *
1502: from xdp_order_line_items
1503: where order_id = p_sdp_order_id and
1536: /*
1537: Get all the line item for a given line_item_id
1538: */
1539: FUNCTION Get_LineRec( p_line_item_id IN NUMBER)
1540: return XDP_TYPES.LINE_ITEM
1541: IS
1542: lv_line XDP_TYPES.LINE_ITEM;
1543: CURSOR lc_line IS
1544: select *
1538: */
1539: FUNCTION Get_LineRec( p_line_item_id IN NUMBER)
1540: return XDP_TYPES.LINE_ITEM
1541: IS
1542: lv_line XDP_TYPES.LINE_ITEM;
1543: CURSOR lc_line IS
1544: select *
1545: from xdp_order_line_items
1546: where line_item_id = p_line_item_id;
1573: /*
1574: Get all the workitems for a given workitem instance id
1575: */
1576: FUNCTION Get_WorkitemRec( p_wi_instance_id IN NUMBER)
1577: return XDP_TYPES.workitem_rec
1578: IS
1579: lv_wi XDP_TYPES.Workitem_rec;
1580: lv_count number := 0;
1581: CURSOR lc_wi IS
1575: */
1576: FUNCTION Get_WorkitemRec( p_wi_instance_id IN NUMBER)
1577: return XDP_TYPES.workitem_rec
1578: IS
1579: lv_wi XDP_TYPES.Workitem_rec;
1580: lv_count number := 0;
1581: CURSOR lc_wi IS
1582: select
1583: workitem_instance_id,
1615: /*
1616: Get all the workitems for a given line item id
1617: */
1618: FUNCTION Get_Order_Workitems( p_sdp_order_id IN NUMBER)
1619: return XDP_TYPES.Workitem_List
1620: IS
1621: lv_wi_list XDP_TYPES.Workitem_List;
1622: lv_count number := 0;
1623: CURSOR lc_wi IS
1617: */
1618: FUNCTION Get_Order_Workitems( p_sdp_order_id IN NUMBER)
1619: return XDP_TYPES.Workitem_List
1620: IS
1621: lv_wi_list XDP_TYPES.Workitem_List;
1622: lv_count number := 0;
1623: CURSOR lc_wi IS
1624: select
1625: workitem_instance_id,
1668: Note: The user must omit the key word WHERE in the argument p_where
1669: */
1670: PROCEDURE Find_Orders(
1671: p_where IN OUT NOCOPY Varchar2,
1672: p_order_list OUT NOCOPY XDP_TYPES.ORDER_HEADER_LIST,
1673: return_code OUT NOCOPY number,
1674: error_description OUT NOCOPY varchar2)
1675: IS
1676: lv_plsql varchar2(32000);
1801: */
1802: PROCEDURE Find_Lines(
1803: p_sdp_order_id IN NUMBER,
1804: p_where IN OUT NOCOPY Varchar2,
1805: p_order_line_list OUT NOCOPY XDP_TYPES.ORDER_LINE_LIST,
1806: return_code OUT NOCOPY number,
1807: error_description OUT NOCOPY varchar2)
1808: IS
1809: lv_plsql varchar2(32000);
1923: */
1924: PROCEDURE Find_Workitems(
1925: p_sdp_order_id IN NUMBER,
1926: p_where IN OUT NOCOPY Varchar2,
1927: p_workitem_list OUT NOCOPY XDP_TYPES.Workitem_LIST,
1928: return_code OUT NOCOPY number,
1929: error_description OUT NOCOPY varchar2)
1930: IS
1931: lv_plsql varchar2(32000);
2041: */
2042: PROCEDURE Copy_Line(
2043: p_src_sdp_order_id IN NUMBER,
2044: p_src_line_item_id IN NUMBER,
2045: p_copy_mode IN BINARY_INTEGER default XDP_TYPES.APPEND_TO,
2046: p_order_line_list IN OUT NOCOPY XDP_TYPES.ORDER_LINE_LIST,
2047: p_line_parameter_list IN OUT NOCOPY XDP_TYPES.LINE_PARAM_LIST,
2048: return_code OUT NOCOPY NUMBER,
2049: error_description OUT NOCOPY VARCHAR2)
2042: PROCEDURE Copy_Line(
2043: p_src_sdp_order_id IN NUMBER,
2044: p_src_line_item_id IN NUMBER,
2045: p_copy_mode IN BINARY_INTEGER default XDP_TYPES.APPEND_TO,
2046: p_order_line_list IN OUT NOCOPY XDP_TYPES.ORDER_LINE_LIST,
2047: p_line_parameter_list IN OUT NOCOPY XDP_TYPES.LINE_PARAM_LIST,
2048: return_code OUT NOCOPY NUMBER,
2049: error_description OUT NOCOPY VARCHAR2)
2050: IS
2043: p_src_sdp_order_id IN NUMBER,
2044: p_src_line_item_id IN NUMBER,
2045: p_copy_mode IN BINARY_INTEGER default XDP_TYPES.APPEND_TO,
2046: p_order_line_list IN OUT NOCOPY XDP_TYPES.ORDER_LINE_LIST,
2047: p_line_parameter_list IN OUT NOCOPY XDP_TYPES.LINE_PARAM_LIST,
2048: return_code OUT NOCOPY NUMBER,
2049: error_description OUT NOCOPY VARCHAR2)
2050: IS
2051: lv_src_found BOOLEAN := FALSE;
2064:
2065: BEGIN
2066:
2067: return_code := 0;
2068: IF p_copy_mode = XDP_TYPES.OVERRIDE THEN
2069: p_order_line_list.DELETE;
2070: p_line_parameter_list.DELETE;
2071: ELSIF p_copy_mode = XDP_TYPES.APPEND_TO THEN
2072: IF p_order_line_list.COUNT > 0 THEN
2067: return_code := 0;
2068: IF p_copy_mode = XDP_TYPES.OVERRIDE THEN
2069: p_order_line_list.DELETE;
2070: p_line_parameter_list.DELETE;
2071: ELSIF p_copy_mode = XDP_TYPES.APPEND_TO THEN
2072: IF p_order_line_list.COUNT > 0 THEN
2073: lv_index := p_order_line_list.FIRST;
2074: FOR lv_count IN 1..p_order_line_list.COUNT LOOP
2075: lv_line_num_list(p_order_line_list(lv_index).line_number) := 1;