The following lines contain the word 'select', 'insert', 'update' or 'delete':
| called from one of the bulk insert statements since the function |
| blueprint_sla_hook has out parameters, this wrapper should not |
| be modified or customized |
| |
| PARAMETERS: |
| INPUT: |
| -p_wrap_txn_id Transaction ID |
| -p_wrap_tb_source String identifying the source table of the |
| transaction that is calling the hook, the two |
| possible values are: |
| "MMT" for transaction belonging to table |
| MTL_MATERIAL_TRANSACTIONS |
| "WT" for transactions belonging to table |
| WIP_TRANSACTIONS |
| CALLED FROM |
| CST_XLA_PVT.CreateBulk_WIPXLAEvent |
| CST_XLA.PVT.Create_WIPUpdateXLAEvent |
| CST_XLA.Create_CostUpdateXLAEvent |
| |
| RETURN VALUES |
| integer 1 Create SLA events in blue print org for this txn |
| -1 Error in the hook |
| 0 or any other number |
| Do not create SLA events in blue print org for this |
| transaction (Default) |
| HISTORY |
| 04-Jan-2010 Ivan Pineda Created |
*----------------------------------------------------------------------------*/
FUNCTION blueprint_sla_hook_wrap(p_wrap_txn_id NUMBER,
p_wrap_tb_source VARCHAR2)
RETURN integer IS
l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
DELETE FROM XLA_AE_HEADERS_GT;
DELETE FROM XLA_AE_LINES_GT;
DELETE FROM XLA_VALIDATION_HDRS_GT;
DELETE FROM XLA_VALIDATION_LINES_GT;
DELETE FROM XLA_BAL_CTRL_CTRBS_GT;
DELETE FROM XLA_BAL_PERIOD_STATS_GT;
DELETE FROM XLA_BAL_RECREATE_GT;
DELETE FROM XLA_BAL_ANACRI_LINES_GT;
DELETE FROM XLA_BAL_ANACRI_CTRBS_GT;
DELETE FROM XLA_BAL_SYNCHRONIZE_GT;
DELETE FROM XLA_BAL_STATUSES_GT;
DELETE FROM XLA_BAL_CTRL_LINES_GT;
DELETE FROM XLA_EVENTS_GT;
DELETE FROM XLA_EVT_CLASS_SOURCES_GT;
DELETE FROM XLA_EVT_CLASS_ORDERS_GT;
DELETE FROM XLA_TAB_ERRORS_GT;
DELETE FROM XLA_SEQ_JE_HEADERS_GT;
DELETE FROM XLA_TAB_NEW_CCIDS_GT;
DELETE FROM XLA_EXTRACT_OBJECTS_GT;
DELETE FROM XLA_REFERENCE_OBJECTS_GT;
DELETE FROM XLA_TRANSACTION_ACCTS_GT;
DELETE FROM XLA_UPG_LINE_CRITERIA_GT;
DELETE FROM XLA_TRIAL_BALANCES_GT;
DELETE FROM XLA_ACCT_PROG_EVENTS_GT;
DELETE FROM XLA_ACCT_PROG_DOCS_GT;
DELETE FROM XLA_MERGE_SEG_MAPS_GT;
DELETE FROM XLA_EVENTS_INT_GT;
DELETE FROM XLA_REPORT_BALANCES_GT;
DELETE FROM XLA_TB_BALANCES_GT;
DELETE FROM XLA_BAL_AC_CTRBS_GT;
24 , --COST_UPDATE
27 ) --RECEIPT
THEN
-- If Action ID is outside this range no custom inv txn allowed
-- hence always in the standard list
x_list_result := 'Y';
SELECT 'Y'
FROM mtl_transaction_accounts
WHERE transaction_id = p_transaction_id
AND organization_id = p_organization_id
AND accounting_line_type = 15;
SELECT NVL(PA_POSTING_FLAG, 'N')
INTO l_pjm_blueprint
FROM PJM_ORG_PARAMETERS
WHERE ORGANIZATION_ID = p_trx_info.inv_organization_id;
SELECT
EVENT_TYPE_CODE
INTO
l_event_type_code
FROM
CST_XLA_RCV_EVENT_MAP
WHERE TRANSACTION_TYPE_ID = p_trx_info.ACCT_EVENT_TYPE_ID
AND ATTRIBUTE = p_trx_info.ATTRIBUTE;
SELECT
EVENT_TYPE_CODE
INTO
l_event_type_code
FROM
CST_XLA_RCV_EVENT_MAP
WHERE TRANSACTION_TYPE_ID = p_trx_info.ACCT_EVENT_TYPE_ID
AND ATTRIBUTE is NULL;
- Insert this event into PSA_BC_XLA_EVENTS_GT
- Call the Budgetary Control API to create the BC accounting entries */
/* For the DELIVER and RTR events, we do not have the encumbrance amount populated in
* RRS. This information is populated against the ENCUMBRANCE_REVERSAL event.
* For the ENCUMBRANCE_REVERSAL event, the event that created this encumbrance
* reversal is the event type that is created in SLA. This event is created
* with a BUDGETARY_CONTROL_FLAG = 'Y' to distinguish it
* The accounting for this BC event is done by PSA through the BC API
* Note accounting_event_type_id = 13 mains "Encumbrance Reversal" */
/*
Commented whole encumbrance accounting code flow for encumbrance enhancement.
Referred doc MED_PSA_CST_XLA_GL.doc
*/
-- IF ( p_trx_info.ENCUMBRANCE_FLAG = 'Y' AND p_trx_info.ACCT_EVENT_TYPE_ID = 13 ) THEN
-- l_stmt_num := 45;
SELECT count(*)
INTO l_mta_exists
FROM MTL_TRANSACTION_ACCOUNTS
WHERE TRANSACTION_ID = p_trx_info.transaction_id
AND rownum=1;
SELECT NVL(PA_POSTING_FLAG, 'N')
INTO l_pjm_blueprint
FROM PJM_ORG_PARAMETERS
WHERE ORGANIZATION_ID = p_trx_info.txn_organization_id
AND EXISTS ( SELECT 'X'
FROM MTL_MATERIAL_TRANSACTIONS MMT
WHERE MMT.TRANSACTION_ID = p_trx_info.transaction_id
AND ( (NVL(MMT.LOGICAL_TRANSACTION,2) = 2)
OR( (NVL(MMT.LOGICAL_TRANSACTION,2) = 1)
AND MMT.TRANSACTION_TYPE_ID = 19
AND MMT.TRANSACTION_ACTION_ID = 26
AND MMT.TRANSACTION_SOURCE_TYPE_ID = 1
AND NVL(MMT.LOGICAL_TRX_TYPE_CODE,5) = 2
AND EXISTS ( SELECT 'X'
FROM rcv_transactions rt
WHERE rt.transaction_id =
mmt.rcv_transaction_id
AND rt.organization_id =
p_trx_info.txn_organization_id
)
)
)
);
SELECT DECODE( EVENT_TYPE, 3, G_COGS_REC_EVENT, G_COGS_REC_ADJ_EVENT)
INTO l_events(1).event_type_code
FROM CST_COGS_EVENTS
WHERE MMT_TRANSACTION_ID = p_trx_info.transaction_id;
SELECT nvl(process_enabled_flag, 'N')
INTO l_txfr_process_flag
FROM MTL_PARAMETERS
WHERE organization_id = p_trx_info.txfr_organization_id;
SELECT p_trx_info.transaction_id,
decode(organization, 'TRANSFER', p_trx_info.txfr_organization_id,
p_trx_info.txn_organization_id ),
-- Leave this transaction src type ID to initial in source_id_int_3
nvl( p_trx_info.txn_src_type_id, -1),
event_type_code
BULK COLLECT INTO l_events
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND ( ( transaction_source_type_id = l_txn_src_type_id ) --p_trx_info.txn_src_type_id
/* Added following OR condition for Bug6792259 */
OR (l_txn_src_type_id = 8 AND transaction_source_type_id = 7)
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = l_txn_src_type_id --p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
)
AND ( ( p_trx_info.tp is null and tp = 'N' ) or
( p_trx_info.tp is not null and tp = p_trx_info.tp ) )
AND NOT (organization = 'SAME' AND transfer_type = 'RCPT');
SELECT p_trx_info.transaction_id,
p_trx_info.txn_organization_id,
--Leave this value in source_id_int_3
nvl( p_trx_info.txn_src_type_id, -1),
event_type_code
INTO
l_events(1).transaction_id,
l_events(1).organization_id,
l_events(1).txn_src_type_id,
l_events(1).event_type_code
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND transfer_type = DECODE(SIGN(p_trx_info.primary_quantity),-1,'SHIP','RCPT')
AND ( ( transaction_source_type_id = l_txn_src_type_id ) --p_trx_info.txn_src_type_id
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = l_txn_src_type_id --p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
)
AND organization = p_trx_info.attribute
AND ( ( p_trx_info.tp is null and tp = 'N' ) or
( p_trx_info.tp is not null and tp = p_trx_info.tp ) );
SELECT p_trx_info.transaction_id,
p_trx_info.txn_organization_id,
nvl ( p_trx_info.txn_src_type_id, -1),
event_type_code
INTO
l_events(1).transaction_id,
l_events(1).organization_id,
l_events(1).txn_src_type_id,
l_events(1).event_type_code
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND ( ( transaction_source_type_id = l_txn_src_type_id) --p_trx_info.txn_src_type_id
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = l_txn_src_type_id --p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
)
AND attribute = p_trx_info.attribute;
SELECT nvl(process_enabled_flag, 'N')
INTO l_txfr_process_flag
FROM MTL_PARAMETERS
WHERE organization_id = p_trx_info.txfr_organization_id;
SELECT p_trx_info.transaction_id,
decode(organization, 'TRANSFER', p_trx_info.txfr_organization_id,
p_trx_info.txn_organization_id ),
nvl( p_trx_info.txn_src_type_id, -1),
event_type_code
BULK COLLECT INTO l_events
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND ( ( transaction_source_type_id = l_txn_src_type_id) --p_trx_info.txn_src_type_id )
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = l_txn_src_type_id --p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
)
AND fob_point = p_trx_info.fob_point
AND ( tp is null or ( tp is not null and tp = p_trx_info.tp ));
SELECT p_trx_info.transaction_id,
p_trx_info.txn_organization_id,
nvl( p_trx_info.txn_src_type_id, -1),
event_type_code
INTO l_events(1).transaction_id,
l_events(1).organization_id,
l_events(1).txn_src_type_id,
l_events(1).event_type_code
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND ( ( transaction_source_type_id = l_txn_src_type_id) --p_trx_info.txn_src_type_id )
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = l_txn_src_type_id --p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
)
AND fob_point = p_trx_info.fob_point
AND ( tp is null or ( tp is not null and tp = p_trx_info.tp ))
AND organization = 'SAME';
SELECT p_trx_info.transaction_id,
p_trx_info.txn_organization_id,
nvl( p_trx_info.txn_src_type_id, -1),
event_type_code
INTO l_events(1).transaction_id,
l_events(1).organization_id,
l_events(1).txn_src_type_id,
l_events(1).event_type_code
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND ( ( transaction_source_type_id = p_trx_info.txn_src_type_id )
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
)
AND ( tp is null or ( tp is not null and tp = p_trx_info.tp ));
SELECT p_trx_info.transaction_id,
p_trx_info.txn_organization_id,
nvl( p_trx_info.txn_src_type_id, -1),
event_type_code
INTO l_events(1).transaction_id,
l_events(1).organization_id,
l_events(1).txn_src_type_id,
l_events(1).event_type_code
FROM cst_xla_inv_event_map
WHERE transaction_action_id = p_trx_info.txn_action_id
AND attribute is null
AND ( ( transaction_source_type_id = l_txn_src_type_id) --p_trx_info.txn_src_type_id )
OR( transaction_source_type_id is null
AND NOT EXISTS (
SELECT 1
FROM cst_xla_inv_event_map
WHERE transaction_source_type_id = l_txn_src_type_id --p_trx_info.txn_src_type_id
AND transaction_action_id = p_trx_info.txn_action_id )
)
);
Inserts are done into the table in the following loop */
l_stmt_num := 115;
SELECT
ledger_id,
operating_unit
INTO
l_source_data.ledger_id,
l_security_data.security_id_int_2
FROM CST_ACCT_INFO_V
WHERE organization_id = l_events(l_index).ORGANIZATION_ID;
SELECT NVL(PA_POSTING_FLAG, 'N')
INTO l_pjm_blueprint
FROM PJM_ORG_PARAMETERS
WHERE ORGANIZATION_ID = p_trx_info.inv_organization_id;
SELECT
ledger_id,
operating_unit
INTO
l_source_data.ledger_id,
l_security_data.security_id_int_2
FROM CST_ACCT_INFO_V
WHERE organization_id = p_trx_info.INV_ORGANIZATION_ID;
SELECT
EVENT_TYPE_CODE
INTO
l_event_type_code
FROM
CST_XLA_WIP_EVENT_MAP
WHERE TRANSACTION_TYPE_ID = p_trx_info.TXN_TYPE_ID
AND ATTRIBUTE = p_trx_info.ATTRIBUTE;
SELECT
EVENT_TYPE_CODE
INTO
l_event_type_code
FROM
CST_XLA_WIP_EVENT_MAP
WHERE TRANSACTION_TYPE_ID = p_trx_info.TXN_TYPE_ID
AND ATTRIBUTE IS NULL;
SELECT NVL(PA_POSTING_FLAG, 'N')
INTO l_pjm_blueprint
FROM PJM_ORG_PARAMETERS
WHERE ORGANIZATION_ID = p_organization_id;
SELECT ledger_id,
operating_unit
INTO l_ledger_id,
l_operating_unit
FROM CST_ACCT_INFO_V
WHERE ORGANIZATION_ID = p_organization_id;
DELETE XLA_EVENTS_INT_GT;
INSERT INTO xla_events_int_gt(
application_id,
ledger_id,
entity_code,
source_id_int_1,
source_id_int_2,
source_id_int_3,
transaction_number,
event_class_code,
event_type_code,
event_date,
event_status_code,
security_id_int_1,
security_id_int_2,
transaction_date,
reference_date_1
)
SELECT DISTINCT
G_CST_APPLICATION_ID,
l_ledger_id,
'WIP_ACCOUNTING_EVENTS',
WTA.TRANSACTION_ID,
WTA.RESOURCE_ID,
WTA.BASIS_TYPE,
WTA.TRANSACTION_ID,
'ABSORPTION',
DECODE( WTA.COST_ELEMENT_ID, 3, G_RES_ABS_EVENT,
4, DECODE (WCTI.SOURCE_CODE, 'IPV',
G_IPV_TRANSFER_EVENT,
DECODE(WCTI.AUTOCHARGE_TYPE, 3, G_OSP_EVENT,
4, G_OSP_EVENT, G_RES_ABS_EVENT)),
5, G_OVH_ABS_EVENT ),
--BUG#7566005 synch event_date with accounting_date
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
WCTI.TRANSACTION_DATE,
l_operating_unit),
--WCTI.TRANSACTION_DATE,
XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED,
WCTI.ORGANIZATION_ID,
l_operating_unit,
WCTI.TRANSACTION_DATE,
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
WCTI.TRANSACTION_DATE,
l_operating_unit)
FROM
WIP_TRANSACTION_ACCOUNTS WTA,
WIP_COST_TXN_INTERFACE WCTI
WHERE
WCTI.TRANSACTION_ID = WTA.TRANSACTION_ID
AND WCTI.GROUP_ID = p_wcti_group_id
AND WCTI.TRANSACTION_TYPE in (1, 2, 3)
AND DECODE(l_pjm_blueprint,'N',1,
NVL(blueprint_sla_hook_wrap(WTA.transaction_id, 'WCTI'),0)) = 1
UNION ALL
SELECT
G_CST_APPLICATION_ID,
l_ledger_id,
'WIP_ACCOUNTING_EVENTS',
WCTI.TRANSACTION_ID,
-1,
/* Bug 9088305: NVL(WCTI.BASIS_TYPE, -1), */
Decode(WCTI.BASIS_TYPE, NULL, Decode(WCTI.TRANSACTION_TYPE, 17, 1, -1), WCTI.BASIS_TYPE),
WCTI.TRANSACTION_ID,
CXWEM.EVENT_CLASS_CODE,
CXWEM.EVENT_TYPE_CODE,
--BUG#7566005 synch event_date with accounting_date
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
WCTI.TRANSACTION_DATE,
l_operating_unit),
--WCTI.TRANSACTION_DATE,
XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED,
WCTI.ORGANIZATION_ID,
l_operating_unit,
WCTI.TRANSACTION_DATE,
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
WCTI.TRANSACTION_DATE,
l_operating_unit)
FROM
WIP_COST_TXN_INTERFACE WCTI,
CST_XLA_WIP_EVENT_MAP CXWEM
WHERE
WCTI.GROUP_ID = p_wcti_group_id
AND WCTI.TRANSACTION_TYPE = CXWEM.TRANSACTION_TYPE_ID
/* Modified for bug 9088305
AND WCTI.TRANSACTION_TYPE in (5, 6, 17) */
AND (WCTI.TRANSACTION_TYPE in (5, 6)
OR (WCTI.TRANSACTION_TYPE = 17 AND
((WCTI.SOURCE_CODE = 'IPV' AND
CXWEM.ATTRIBUTE = 'IPV')
OR
(WCTI.SOURCE_CODE = 'RCV' AND
CXWEM.ATTRIBUTE IS NULL))))
--{BUG#6916164
AND EXISTS (SELECT NULL
FROM WIP_TRANSACTION_ACCOUNTS WTA
WHERE wta.transaction_id = WCTI.TRANSACTION_ID
AND DECODE(l_pjm_blueprint,'N',1,
NVL(blueprint_sla_hook_wrap(wta.transaction_id, 'WCTI'),0)) = 1);
PROCEDURE Create_CostUpdateXLAEvent (
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_commit IN VARCHAR2,
p_validation_level IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_update_id IN NUMBER,
p_organization_id IN NUMBER ) IS
l_api_name CONSTANT VARCHAR2(30) := 'Create_CostUpdateXLAEvent';
SAVEPOINT Create_CostUpdateXLAEvent;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, l_module||'.begin' ,' Create_CostUpdateXLAEvent <<');
SELECT NVL(PA_POSTING_FLAG, 'N')
INTO l_pjm_blueprint
FROM PJM_ORG_PARAMETERS
WHERE ORGANIZATION_ID = p_organization_id;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, l_module||'.end','Create_CostUpdateXLAEvent >>');
SELECT ledger_id,
operating_unit
INTO l_ledger_id,
l_operating_unit
FROM CST_ACCT_INFO_V
WHERE ORGANIZATION_ID = p_organization_id;
DELETE XLA_EVENTS_INT_GT;
INSERT INTO xla_events_int_gt
(
application_id,
ledger_id,
entity_code,
source_id_int_1,
source_id_int_2,
source_id_int_3,
transaction_number,
event_class_code,
event_type_code,
event_date,
event_status_code,
security_id_int_1,
security_id_int_2,
transaction_date,
reference_date_1
)
SELECT
G_CST_APPLICATION_ID,
l_ledger_id,
'MTL_ACCOUNTING_EVENTS',
mmt.TRANSACTION_ID, -- SOURCE_ID_INT_1
mmt.ORGANIZATION_id, -- SOURCE_ID_INT_2 (ORGANIZATION)
mmt.TRANSACTION_SOURCE_TYPE_ID,-- SOURCE_ID_INT_3 (TRANSACTION_SOURCE_TYPE_ID)
mmt.TRANSACTION_ID,
'MTL_COST_UPD',
'STD_COST_UPD',
--BUG#7566005 synch event_date with accounting_date
-- mmt.TRANSACTION_DATE,
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
mmt.TRANSACTION_DATE,
l_operating_unit),
--{BUG#7505874
DECODE(mta.slid,NULL,XLA_EVENTS_PUB_PKG.C_EVENT_NOACTION, XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED),
--}
mmt.ORGANIZATION_ID,
l_operating_unit,
mmt.TRANSACTION_DATE,
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
mmt.TRANSACTION_DATE,
l_operating_unit)
FROM
MTL_MATERIAL_TRANSACTIONS mmt
--{BUG#7505874
,(SELECT MAX(inv_sub_ledger_id) slid
,transaction_id trx_id
FROM mtl_transaction_accounts
GROUP BY transaction_id) mta
--}
WHERE
mmt.TRANSACTION_SOURCE_ID = p_update_id
AND mmt.TRANSACTION_TYPE_ID = 24
AND mmt.TRANSACTION_ACTION_ID = 24
AND mmt.TRANSACTION_SOURCE_TYPE_ID = 11
AND mmt.ORGANIZATION_ID = p_organization_id
AND mmt.transaction_id = mta.trx_id(+) --BUG#7505874
AND DECODE(l_pjm_blueprint,'N',1,
NVL(blueprint_sla_hook_wrap(MMT.transaction_id, 'MMT'),0)) = 1;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, l_module||'.end','Create_CostUpdateXLAEvent >>');
ROLLBACK TO Create_CostUpdateXLAEvent;
ROLLBACK TO Create_CostUpdateXLAEvent;
ROLLBACK TO Create_CostUpdateXLAEvent;
FND_LOG.string(FND_LOG.LEVEL_UNEXPECTED, l_module||':'||l_stmt_num ,'Create_CostUpdateXLAEvent '||l_stmt_num||' : '||substr(SQLERRM,1,200));
END Create_CostUpdateXLAEvent;
PROCEDURE Create_WIPUpdateXLAEvent (
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_commit IN VARCHAR2,
p_validation_level IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_update_id IN NUMBER,
p_organization_id IN NUMBER ) IS
l_api_name CONSTANT VARCHAR2(30) := 'Create_WIPUpdateXLAEvent';
SAVEPOINT Create_WIPUpdateXLAEvent;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, l_module||'.begin' ,' Create_WIPUpdateXLAEvent <<');
SELECT NVL(PA_POSTING_FLAG, 'N')
INTO l_pjm_blueprint
FROM PJM_ORG_PARAMETERS
WHERE ORGANIZATION_ID = p_organization_id;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, l_module||'.end','Create_WIPUpdateXLAEvent >>');
SELECT ledger_id,
operating_unit
INTO l_ledger_id,
l_operating_unit
FROM CST_ACCT_INFO_V
WHERE ORGANIZATION_ID = p_organization_id;
DELETE XLA_EVENTS_INT_GT;
INSERT INTO xla_events_int_gt
(
application_id,
ledger_id,
entity_code,
source_id_int_1,
source_id_int_2,
source_id_int_3,
transaction_number,
event_class_code,
event_type_code,
event_date,
event_status_code,
security_id_int_1,
security_id_int_2,
transaction_date,
reference_date_1
)
SELECT
G_CST_APPLICATION_ID,
l_ledger_id,
'WIP_ACCOUNTING_EVENTS',
TRANSACTION_ID, -- SOURCE_ID_INT_1
-1, -- SOURCE_ID_INT_2 (WIP_RESOURCE_ID)
-1, -- SOURCE_ID_INT_3 (WIP_BASIS_TYPE_ID)
TRANSACTION_ID,
'WIP_COST_UPD',
'WIP_COST_UPD',
TRANSACTION_DATE,
XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED,
organization_id,
l_operating_unit,
--BUG#7566005 synch event_date with accounting_date
-- TRANSACTION_DATE,
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
TRANSACTION_DATE,
l_operating_unit),
INV_LE_TIMEZONE_PUB.get_le_day_time_for_ou(
TRANSACTION_DATE,
l_operating_unit)
FROM
WIP_TRANSACTIONS
WHERE
COST_UPDATE_ID = p_update_id
AND ORGANIZATION_ID = p_organization_id
AND DECODE(l_pjm_blueprint,'N',1,
NVL(blueprint_sla_hook_wrap(Transaction_id, 'WT'),0)) = 1;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, l_module||'.end','Create_WIPUpdateXLAEvent >>');
ROLLBACK TO Create_WIPUpdateXLAEvent;
ROLLBACK TO Create_WIPUpdateXLAEvent;
ROLLBACK TO Create_WIPUpdateXLAEvent;
,'Create_WIPUpdateXLAEvent '||l_stmt_num||' : '||substr(SQLERRM,1,200));
END Create_WIPUpdateXLAEvent;
SELECT SUBSTRB(p.argument_text,
INSTRB(p.argument_text,',',1,32)+1,
INSTRB(p.argument_text,',',1,33)-INSTRB(p.argument_text,',',1,32)-1)
FROM fnd_concurrent_requests c,
fnd_concurrent_requests p
WHERE c.request_id = fnd_global.conc_request_id
AND c.parent_request_id = p.request_id;