33: THEN
34: BEGIN
35: SELECT global_attribute2
36: INTO l_trx_reason_code
37: FROM mtl_system_items mtl
38: WHERE mtl.organization_id = (SELECT inventory_organization_id
39: FROM financials_system_parameters
40: WHERE org_id = p_org_id)
41: AND mtl.inventory_item_id = l_item_id
91: DEBUG (p_deliver_to_org_id);
92: DEBUG (l_txn_reason_code);
93:
94: --
95: -- get transaction reason code from mtl system items if
96: -- item is known.
97: -- Determine which organization to use from po system parameters
98: -- and then fetch transaction reason accordingly.
99: --
110: l_def_from_org_id := p_deliver_to_org_id;
111:
112: SELECT global_attribute2
113: INTO l_txn_reason_code
114: FROM mtl_system_items mtl
115: WHERE mtl.organization_id = l_def_from_org_id
116: AND mtl.inventory_item_id = p_item_id
117: AND ROWNUM = 1;
118:
128: WHERE org_id = p_org_id;
129:
130: SELECT global_attribute2
131: INTO l_txn_reason_code
132: FROM mtl_system_items mtl
133: WHERE mtl.organization_id = l_def_from_org_id
134: AND mtl.inventory_item_id = p_item_id
135: AND ROWNUM = 1;
136:
151: WHERE org_id = p_org_id;
152:
153: SELECT global_attribute2
154: INTO l_txn_reason_code
155: FROM mtl_system_items mtl
156: WHERE mtl.organization_id = l_def_from_org_id
157: AND mtl.inventory_item_id = p_item_id
158: AND ROWNUM = 1;
159: