21: -- required (EVM=Y) but it is not specified that distributions be created
22: -- from lines (CDF=N or null).
23: --
24: -- Where
25: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
26: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
27: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
28: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
29: -- (AP_CARD_PROFILES is parent of AP_CARDS).
22: -- from lines (CDF=N or null).
23: --
24: -- Where
25: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
26: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
27: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
28: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
29: -- (AP_CARD_PROFILES is parent of AP_CARDS).
30: --
24: -- Where
25: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
26: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
27: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
28: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
29: -- (AP_CARD_PROFILES is parent of AP_CARDS).
30: --
31: --
32: -- Assigned Exceptions. Exception code stored in
25: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
26: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
27: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
28: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
29: -- (AP_CARD_PROFILES is parent of AP_CARDS).
30: --
31: --
32: -- Assigned Exceptions. Exception code stored in
33: -- AP_EXPENSE_FEED_LINES.REJECT_CODE
241: and cp.card_program_id = P_CARD_PROGRAM_ID)
242: and nvl(create_distribution_flag,'N') = 'Y'
243: and exists
244: (select 'Profile mandates building account from card code'
245: from ap_card_profiles cp,
246: ap_cards c
247: where cp.profile_id = c.profile_id
248: and c.card_id = efl.card_id
249: and nvl(cp.build_acct_from_code_flag,'N') = 'Y')
255: update ap_expense_feed_lines efl
256: set reject_code = 'DIST REQUIRED'
257: where exists
258: (select 'Employee verification or manager approval required'
259: from ap_card_profiles cp,
260: ap_cards c
261: where cp.profile_id = c.profile_id
262: and c.card_id = efl.card_id
263: and (cp.emp_notification_lookup_code = 'Y' OR
303: -- o If BAFCF=N overlay account segments defined in
304: -- DEFAULT_ACCT_TEMPLATE on top of Employee Acct CCID (from
305: -- HR_EMPLOYEES_CURRENT_V).
306: -- o If error results from operations above, use
307: -- AP_CARD_PROFILES.EXCEPTION_CLEARING_CCID. If CCID not defined at
308: -- profile, use AP_CARD_PROGRAMS.EXCEPTION_CLEARING_CCID.
309: -- o If CCID still cannot be determined, populate REJECT_CODE to flag
310: -- as invalid account exception.
311: --
309: -- o If CCID still cannot be determined, populate REJECT_CODE to flag
310: -- as invalid account exception.
311: --
312: -- Where
313: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
314: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
315: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
316: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
317: -- (AP_CARD_PROFILES is parent of AP_CARDS).
310: -- as invalid account exception.
311: --
312: -- Where
313: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
314: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
315: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
316: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
317: -- (AP_CARD_PROFILES is parent of AP_CARDS).
318: --
312: -- Where
313: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
314: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
315: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
316: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
317: -- (AP_CARD_PROFILES is parent of AP_CARDS).
318: --
319: ---------------------------------------------------------------------------
320: PROCEDURE CREATE_DISTRIBUTIONS(
313: -- o EVM denotes AP_CARD_PROFILES.EMP_NOTIFICATION_LOOKUP_CODE
314: -- o MAM denotes AP_CARD_PROFILES.MGR_APPROVAL_LOOKUP_CODE
315: -- o CDF denotes AP_EXPENSE_FEED_LINES.CREATE_DISTRIBUTION_FLAG
316: -- o BAFCF denotes AP_CARD_PROFILES.BUILD_ACCT_FROM_CODE_FLAG
317: -- (AP_CARD_PROFILES is parent of AP_CARDS).
318: --
319: ---------------------------------------------------------------------------
320: PROCEDURE CREATE_DISTRIBUTIONS(
321: P_CARD_PROGRAM_ID IN NUMBER,
343: l_feed_line_id NUMBER;
344: l_amount NUMBER;
345: l_card_code_value AP_EXPENSE_FEED_LINES.card_code_value%TYPE;
346: l_exception_clearing_ccid NUMBER;
347: l_build_acct_from_code_flag AP_CARD_PROFILES.build_acct_from_code_flag%TYPE;
348: l_default_acct_template AP_CARD_PROFILES.default_acct_template%TYPE;
349: l_distribution_status AP_EXPENSE_FEED_DISTS.status_lookup_code%TYPE;
350: l_cost_center AP_EXPENSE_FEED_DISTS.cost_center%TYPE;
351: l_account_segment_value AP_EXPENSE_FEED_DISTS.account_segment_value%TYPE;
344: l_amount NUMBER;
345: l_card_code_value AP_EXPENSE_FEED_LINES.card_code_value%TYPE;
346: l_exception_clearing_ccid NUMBER;
347: l_build_acct_from_code_flag AP_CARD_PROFILES.build_acct_from_code_flag%TYPE;
348: l_default_acct_template AP_CARD_PROFILES.default_acct_template%TYPE;
349: l_distribution_status AP_EXPENSE_FEED_DISTS.status_lookup_code%TYPE;
350: l_cost_center AP_EXPENSE_FEED_DISTS.cost_center%TYPE;
351: l_account_segment_value AP_EXPENSE_FEED_DISTS.account_segment_value%TYPE;
352: l_card_code_set_id NUMBER;
355:
356: --
357: -- Cursor that loops through lines for which distributions should be created.
358: --
359: -- Legend to AP_CARD_PROFILES lookup codes
360: -- emp_notification_lookup_code = Employee Verification Method
361: -- Y = Verification Required
362: -- I = Notification Only
363: -- N = None
391: 'APPROVED')),
392: efl.description
393: from ap_expense_feed_lines efl,
394: ap_card_programs cpg,
395: ap_card_profiles cpr,
396: ap_cards c,
397: hr_employees_current_v hremp,
398: IBY_FNDCPT_PAYER_ALL_INSTRS_V IBY
399: where efl.card_id = c.card_id