31:
32: TYPE repair_attrib_cache is table of repair_caching_rec index by binary_integer;
33: g_repair_attrib_cache repair_attrib_cache;
34:
35: g_approval_required_flag varchar2(1) := fnd_profile.value('CSD_CUST_APPROVAL_REQD');
36: g_install_site_use_id number;
37: g_severity_id number;
38: g_contract_id number;
39: g_bill_to_use_id number;
259: x_msg_data OUT NOCOPY VARCHAR2)
260: IS
261: lc_api_version CONSTANT NUMBER := 1.0;
262: lc_api_name CONSTANT VARCHAR2(80) := 'CSD_REPAIR_MANAGER_UTIL.create_internal_orders';
263: l_source_ou NUMBER := fnd_profile.value('ORG_ID');
264: l_source_org NUMBER := fnd_profile.value('CSD_DEF_REP_INV_ORG');
265: l_dest_ou NUMBER := fnd_profile.value('ORG_ID');
266: l_dest_org NUMBER;
267: l_dest_loc_id NUMBER;
260: IS
261: lc_api_version CONSTANT NUMBER := 1.0;
262: lc_api_name CONSTANT VARCHAR2(80) := 'CSD_REPAIR_MANAGER_UTIL.create_internal_orders';
263: l_source_ou NUMBER := fnd_profile.value('ORG_ID');
264: l_source_org NUMBER := fnd_profile.value('CSD_DEF_REP_INV_ORG');
265: l_dest_ou NUMBER := fnd_profile.value('ORG_ID');
266: l_dest_org NUMBER;
267: l_dest_loc_id NUMBER;
268: TYPE l_prod_txn_tbl_type IS TABLE OF CSD_PRODUCT_TRANSACTIONS%ROWTYPE INDEX BY BINARY_INTEGER;
261: lc_api_version CONSTANT NUMBER := 1.0;
262: lc_api_name CONSTANT VARCHAR2(80) := 'CSD_REPAIR_MANAGER_UTIL.create_internal_orders';
263: l_source_ou NUMBER := fnd_profile.value('ORG_ID');
264: l_source_org NUMBER := fnd_profile.value('CSD_DEF_REP_INV_ORG');
265: l_dest_ou NUMBER := fnd_profile.value('ORG_ID');
266: l_dest_org NUMBER;
267: l_dest_loc_id NUMBER;
268: TYPE l_prod_txn_tbl_type IS TABLE OF CSD_PRODUCT_TRANSACTIONS%ROWTYPE INDEX BY BINARY_INTEGER;
269: l_prod_txn_tbl l_prod_txn_tbl_type;
1532: l_repair_line_ids.EXTEND;
1533: l_repair_line_ids(i) := x_repair_line_id;
1534:
1535: end loop;
1536: IF NVL(fnd_profile.value('CSD_AUTO_CREATE_INT_ORDER'),'N') = 'Y'
1537: THEN
1538: create_internal_orders(p_api_version => 1.0,
1539: p_init_msg_list => fnd_api.g_true,
1540: p_commit => fnd_api.g_false,
1671: select primary_uom_code
1672: into l_repln_tbl(i).unit_of_measure
1673: from mtl_system_items_b
1674: where inventory_item_id = l_repln_tbl(i).inventory_item_id
1675: and organization_id = fnd_profile.value('CSD_DEF_REP_INV_ORG');
1676: end if;
1677: else
1678: -- the record is not eligible for the RO creation.
1679: update csd_repairs_interface set processing_phase = 3
1715: l_repair_line_ids(i) := x_repair_line_id;
1716:
1717: end loop;
1718:
1719: IF NVL(fnd_profile.value('CSD_AUTO_CREATE_INT_ORDER'),'N') = 'Y'
1720: THEN
1721: create_internal_orders(p_api_version => 1.0,
1722: p_init_msg_list => fnd_api.g_true,
1723: p_commit => fnd_api.g_false,
1786: l_approval_required varchar2(1);
1787: l_repair_mode varchar2(10);
1788: l_instance_id number;
1789: l_owner_party_id number;
1790: l_crt_inst_party_relation VARCHAR2(30) := fnd_profile.value('CSD_DEF_INST_PTY_RELTN');
1791: l_relationship VARCHAR2(30);
1792: l_create_tca_rel_in CSD_IB_CHOWN_CUHK.CREATE_TCA_REL_IN_REC_TYPE;
1793: l_create_tca_rel_out CSD_IB_CHOWN_CUHK.CREATE_TCA_REL_OUT_REC_TYPE;
1794: x_relationship_created VARCHAR2(1);
1870: -- assign and initialize service request rec.
1871: l_service_request_rec.request_date := sysdate;
1872:
1873: if p_sr_rec.sr_type_id is null then
1874: l_service_request_rec.type_id := fnd_profile.value('CSD_BLK_RCV_DEFAULT_SR_TYPE');
1875: else
1876: l_service_request_rec.type_id := p_sr_rec.sr_type_id;
1877: end if;
1878:
1876: l_service_request_rec.type_id := p_sr_rec.sr_type_id;
1877: end if;
1878:
1879: if p_sr_rec.sr_status_id is null then
1880: l_service_request_rec.status_id := fnd_profile.value('CSD_BLK_RCV_DEFAULT_SR_STATUS');
1881: else
1882: l_service_request_rec.status_id := p_sr_rec.sr_status_id;
1883: end if;
1884:
1882: l_service_request_rec.status_id := p_sr_rec.sr_status_id;
1883: end if;
1884:
1885: if p_sr_rec.sr_severity_id is null then
1886: l_service_request_rec.severity_id := fnd_profile.value('CSD_BLK_RCV_DEFAULT_SR_SEVERITY');
1887: else
1888: l_service_request_rec.severity_id := p_sr_rec.sr_severity_id;
1889: end if;
1890:
1888: l_service_request_rec.severity_id := p_sr_rec.sr_severity_id;
1889: end if;
1890:
1891: if p_sr_rec.sr_urgency_id is null then
1892: l_service_request_rec.urgency_id := fnd_profile.value('CSD_BLK_RCV_DEFAULT_SR_URGENCY');
1893: else
1894: l_service_request_rec.urgency_id := p_sr_rec.sr_urgency_id;
1895: end if;
1896:
1894: l_service_request_rec.urgency_id := p_sr_rec.sr_urgency_id;
1895: end if;
1896:
1897: if p_sr_rec.sr_owner_id is null then
1898: l_service_request_rec.owner_id := fnd_profile.value('CSD_BLK_RCV_DEFAULT_SR_OWNER');
1899: else
1900: l_service_request_rec.owner_id := p_sr_rec.sr_owner_id;
1901: end if;
1902:
1900: l_service_request_rec.owner_id := p_sr_rec.sr_owner_id;
1901: end if;
1902:
1903: if p_sr_rec.sr_incident_summary is null then
1904: l_service_request_rec.summary := fnd_profile.value('CSD_BLK_RCV_DEFAULT_SR_SUMMARY');
1905: else
1906: l_service_request_rec.summary := p_sr_rec.sr_incident_summary;
1907: end if;
1908:
1906: l_service_request_rec.summary := p_sr_rec.sr_incident_summary;
1907: end if;
1908:
1909: l_service_request_rec.sr_creation_channel := 'PHONE';
1910: l_service_request_rec.resource_type := FND_PROFILE.value('CS_SR_DEFAULT_OWNER_TYPE');
1911: l_service_request_rec.customer_id := p_sr_rec.sr_party_id;
1912: l_service_request_rec.account_id := p_sr_rec.sr_account_id;
1913: l_service_request_rec.customer_number := null;
1914: l_service_request_rec.customer_product_id := null;
2147: -- todo: may be the profile needs to be renamed to be more generic.
2148:
2149: IF l_owner_party_id <> p_sr_rec.sr_party_id
2150: THEN
2151: IF fnd_function.test('CSDREPLN_CHOWN_IB') AND fnd_profile.value('CSD_BLK_RCV_CHG_IB_OWNER') = 'Y'
2152: THEN
2153: IF (Fnd_Log.LEVEL_PROCEDURE >= Fnd_Log.G_CURRENT_RUNTIME_LEVEL) THEN
2154: Fnd_Log.STRING(Fnd_Log.LEVEL_PROCEDURE, lc_api_name,
2155: 'All conditions for change ownership met. Trying to change the instance ownership. Instance id:'||l_instance_id);
2252: IF (Fnd_Log.LEVEL_PROCEDURE >= Fnd_Log.G_CURRENT_RUNTIME_LEVEL) THEN
2253: Fnd_Log.STRING(Fnd_Log.LEVEL_PROCEDURE, lc_api_name,
2254: 'No Default rules set up for repair type. Fetching it from profile');
2255: END IF;
2256: l_repair_type_id := FND_PROFILE.VALUE('CSD_DEFAULT_REPAIR_TYPE');
2257: end if;
2258:
2259: if l_repair_type_id is null then
2260: -- trouble! We cant process this record. No further processing for this and hop
2286: l_repair_mode := g_repair_attrib_cache(l_repair_type_id).repair_mode;
2287: end if;
2288: -- get the contract information.
2289: -- we can possibly cache the information here.
2290: fnd_profile.get('SERVER_TIMEZONE_ID', l_server_tz_id);
2291: IF (Fnd_Log.LEVEL_PROCEDURE >= Fnd_Log.G_CURRENT_RUNTIME_LEVEL) THEN
2292: Fnd_Log.STRING(Fnd_Log.LEVEL_PROCEDURE, lc_api_name,
2293: 'Calling CSD_REPAIRS_UTIL.GET_ENTITLEMENTS to get contracts if any.');
2294: END IF;