[Home] [Help]
5939: organization_id
5940: FROM (
5941: SELECT a.item_id,
5942: DECODE(NVL(b.subinventory_ind_flag,'N'), 'Y', b.organization_id, b.mtl_organization_id) organization_id
5943: FROM gl_aloc_bas a,
5944: ic_whse_mst b
5945: WHERE a.item_id IS NOT NULL
5946: AND b.whse_code = a.whse_code
5947: );
5948:
5949: BEGIN
5950:
5951: G_Migration_run_id := P_migration_run_id;
5952: G_Table_name := 'GL_ALOC_BAS';
5953: G_Context := 'Expense Allocation Basis Migration';
5954: X_failure_count := 0;
5955:
5956: /********************************
5968: p_app_short_name => 'GMA'
5969: );
5970:
5971: /****************************************************************
5972: * Migrating Items IN GL_ALOC_BAS table to Converged Item Master *
5973: ****************************************************************/
5974:
5975: FOR i IN cur_get_gmf_items
5976: LOOP
5991: l_itm_failure_count_all := nvl(l_itm_failure_count_all,0) + nvl(l_itm_failure_count,0);
5992: END LOOP;
5993:
5994: /**********************************************************
5995: * Update a row in GL_ALOC_BAS for Account Codes *
5996: **********************************************************/
5997:
5998: BEGIN
5999:
5996: **********************************************************/
5997:
5998: BEGIN
5999:
6000: UPDATE gl_aloc_bas a
6001: SET a.basis_account_id
6002: = (
6003: SELECT gmf_migration.get_account_id(a.basis_Account_key, x.co_code)
6004: FROM gl_aloc_mst x
6070: **********************************************/
6071:
6072: SELECT count(*)
6073: INTO x_failure_count
6074: FROM gl_aloc_bas
6075: WHERE (
6076: (basis_account_key IS NOT NULL AND basis_account_id IS NULL)
6077: OR (inventory_item_id IS NULL AND item_id IS NOT NULL)
6078: OR (organization_id IS NULL AND whse_code IS NOT NULL)
9862: /**********
9863: * Cursors *
9864: **********/
9865:
9866: CURSOR c_gl_aloc_bas
9867: IS
9868: SELECT y.alloc_id,
9869: y.mina,
9870: count(x.alloc_id) cnt
9867: IS
9868: SELECT y.alloc_id,
9869: y.mina,
9870: count(x.alloc_id) cnt
9871: FROM gl_aloc_bas x, (
9872: SELECT a.alloc_id,
9873: (
9874: SELECT MIN(h.alloc_id)
9875: FROM gl_aloc_mst h
9878: FROM gl_aloc_mst i
9879: WHERE i.alloc_id = a.alloc_id
9880: )
9881: ) mina
9882: FROM gl_aloc_bas a
9883: GROUP BY a.alloc_id
9884: ) y
9885: WHERE x.alloc_id(+) = y.mina
9886: GROUP BY y.alloc_id,
9993: AND x.delete_mark <> 1
9994: );
9995:
9996: /******************************************************************
9997: * Deleting referenced records and updating records in GL_ALOC_BAS *
9998: ******************************************************************/
9999:
10000: FOR i IN c_gl_aloc_bas LOOP
10001: IF i.cnt > 0 THEN
9996: /******************************************************************
9997: * Deleting referenced records and updating records in GL_ALOC_BAS *
9998: ******************************************************************/
9999:
10000: FOR i IN c_gl_aloc_bas LOOP
10001: IF i.cnt > 0 THEN
10002: UPDATE gl_aloc_bas a
10003: SET a.delete_mark = 1
10004: WHERE a.alloc_id = i.alloc_id
9998: ******************************************************************/
9999:
10000: FOR i IN c_gl_aloc_bas LOOP
10001: IF i.cnt > 0 THEN
10002: UPDATE gl_aloc_bas a
10003: SET a.delete_mark = 1
10004: WHERE a.alloc_id = i.alloc_id
10005: AND a.delete_mark <> 1;
10006: ELSE
10003: SET a.delete_mark = 1
10004: WHERE a.alloc_id = i.alloc_id
10005: AND a.delete_mark <> 1;
10006: ELSE
10007: UPDATE gl_aloc_bas a
10008: SET a.alloc_id = i.mina
10009: WHERE a.alloc_id = i.alloc_id
10010: AND a.delete_mark <> 1;
10011: END IF;