118: c_acct_type VARCHAR2(1);
119: row_count NUMBER;
120: BEGIN
121:
122: ccid_cursor := dbms_sql.open_cursor;
123:
124: ccid_select := ' SELECT cc.code_combination_id,
125: gst.ledger_id,
126: cc.enabled_flag, cc.account_type'||
311: ccid_select := ccid_select ||
312: ' AND gst.template_id (+) = cc.template_id ' ||
313: ' ORDER BY decode(gst.ledger_id,:lgr_id,0,1) ';
314:
315: dbms_sql.parse(ccid_cursor,ccid_select,dbms_sql.v7);
316:
317: dbms_sql.define_column(ccid_cursor, 1, c_ccid);
318: dbms_sql.define_column(ccid_cursor, 2, c_lgr_id);
319: dbms_sql.define_column(ccid_cursor, 3, c_enabled_flag, 1);
313: ' ORDER BY decode(gst.ledger_id,:lgr_id,0,1) ';
314:
315: dbms_sql.parse(ccid_cursor,ccid_select,dbms_sql.v7);
316:
317: dbms_sql.define_column(ccid_cursor, 1, c_ccid);
318: dbms_sql.define_column(ccid_cursor, 2, c_lgr_id);
319: dbms_sql.define_column(ccid_cursor, 3, c_enabled_flag, 1);
320: dbms_sql.define_column(ccid_cursor, 4, c_acct_type, 1);
321:
314:
315: dbms_sql.parse(ccid_cursor,ccid_select,dbms_sql.v7);
316:
317: dbms_sql.define_column(ccid_cursor, 1, c_ccid);
318: dbms_sql.define_column(ccid_cursor, 2, c_lgr_id);
319: dbms_sql.define_column(ccid_cursor, 3, c_enabled_flag, 1);
320: dbms_sql.define_column(ccid_cursor, 4, c_acct_type, 1);
321:
322: dbms_sql.bind_variable(ccid_cursor, ':coa_id', x_coa_id);
315: dbms_sql.parse(ccid_cursor,ccid_select,dbms_sql.v7);
316:
317: dbms_sql.define_column(ccid_cursor, 1, c_ccid);
318: dbms_sql.define_column(ccid_cursor, 2, c_lgr_id);
319: dbms_sql.define_column(ccid_cursor, 3, c_enabled_flag, 1);
320: dbms_sql.define_column(ccid_cursor, 4, c_acct_type, 1);
321:
322: dbms_sql.bind_variable(ccid_cursor, ':coa_id', x_coa_id);
323:
316:
317: dbms_sql.define_column(ccid_cursor, 1, c_ccid);
318: dbms_sql.define_column(ccid_cursor, 2, c_lgr_id);
319: dbms_sql.define_column(ccid_cursor, 3, c_enabled_flag, 1);
320: dbms_sql.define_column(ccid_cursor, 4, c_acct_type, 1);
321:
322: dbms_sql.bind_variable(ccid_cursor, ':coa_id', x_coa_id);
323:
324: IF ( x_segment1 IS NOT NULL ) THEN
318: dbms_sql.define_column(ccid_cursor, 2, c_lgr_id);
319: dbms_sql.define_column(ccid_cursor, 3, c_enabled_flag, 1);
320: dbms_sql.define_column(ccid_cursor, 4, c_acct_type, 1);
321:
322: dbms_sql.bind_variable(ccid_cursor, ':coa_id', x_coa_id);
323:
324: IF ( x_segment1 IS NOT NULL ) THEN
325: dbms_sql.bind_variable(ccid_cursor, ':segment1', x_segment1);
326: END IF;
321:
322: dbms_sql.bind_variable(ccid_cursor, ':coa_id', x_coa_id);
323:
324: IF ( x_segment1 IS NOT NULL ) THEN
325: dbms_sql.bind_variable(ccid_cursor, ':segment1', x_segment1);
326: END IF;
327:
328: IF ( x_segment2 IS NOT NULL ) THEN
329: dbms_sql.bind_variable(ccid_cursor, ':segment2', x_segment2);
325: dbms_sql.bind_variable(ccid_cursor, ':segment1', x_segment1);
326: END IF;
327:
328: IF ( x_segment2 IS NOT NULL ) THEN
329: dbms_sql.bind_variable(ccid_cursor, ':segment2', x_segment2);
330: END IF;
331:
332: IF ( x_segment3 IS NOT NULL ) THEN
333: dbms_sql.bind_variable(ccid_cursor, ':segment3', x_segment3);
329: dbms_sql.bind_variable(ccid_cursor, ':segment2', x_segment2);
330: END IF;
331:
332: IF ( x_segment3 IS NOT NULL ) THEN
333: dbms_sql.bind_variable(ccid_cursor, ':segment3', x_segment3);
334: END IF;
335:
336: IF ( x_segment4 IS NOT NULL ) THEN
337: dbms_sql.bind_variable(ccid_cursor, ':segment4', x_segment4);
333: dbms_sql.bind_variable(ccid_cursor, ':segment3', x_segment3);
334: END IF;
335:
336: IF ( x_segment4 IS NOT NULL ) THEN
337: dbms_sql.bind_variable(ccid_cursor, ':segment4', x_segment4);
338: END IF;
339:
340: IF ( x_segment5 IS NOT NULL ) THEN
341: dbms_sql.bind_variable(ccid_cursor, ':segment5', x_segment5);
337: dbms_sql.bind_variable(ccid_cursor, ':segment4', x_segment4);
338: END IF;
339:
340: IF ( x_segment5 IS NOT NULL ) THEN
341: dbms_sql.bind_variable(ccid_cursor, ':segment5', x_segment5);
342: END IF;
343:
344: IF ( x_segment6 IS NOT NULL ) THEN
345: dbms_sql.bind_variable(ccid_cursor, ':segment6', x_segment6);
341: dbms_sql.bind_variable(ccid_cursor, ':segment5', x_segment5);
342: END IF;
343:
344: IF ( x_segment6 IS NOT NULL ) THEN
345: dbms_sql.bind_variable(ccid_cursor, ':segment6', x_segment6);
346: END IF;
347:
348: IF ( x_segment7 IS NOT NULL ) THEN
349: dbms_sql.bind_variable(ccid_cursor, ':segment7', x_segment7);
345: dbms_sql.bind_variable(ccid_cursor, ':segment6', x_segment6);
346: END IF;
347:
348: IF ( x_segment7 IS NOT NULL ) THEN
349: dbms_sql.bind_variable(ccid_cursor, ':segment7', x_segment7);
350: END IF;
351:
352: IF ( x_segment8 IS NOT NULL ) THEN
353: dbms_sql.bind_variable(ccid_cursor, ':segment8', x_segment8);
349: dbms_sql.bind_variable(ccid_cursor, ':segment7', x_segment7);
350: END IF;
351:
352: IF ( x_segment8 IS NOT NULL ) THEN
353: dbms_sql.bind_variable(ccid_cursor, ':segment8', x_segment8);
354: END IF;
355:
356: IF ( x_segment9 IS NOT NULL ) THEN
357: dbms_sql.bind_variable(ccid_cursor, ':segment9', x_segment9);
353: dbms_sql.bind_variable(ccid_cursor, ':segment8', x_segment8);
354: END IF;
355:
356: IF ( x_segment9 IS NOT NULL ) THEN
357: dbms_sql.bind_variable(ccid_cursor, ':segment9', x_segment9);
358: END IF;
359:
360: IF ( x_segment10 IS NOT NULL ) THEN
361: dbms_sql.bind_variable(ccid_cursor, ':segment10', x_segment10);
357: dbms_sql.bind_variable(ccid_cursor, ':segment9', x_segment9);
358: END IF;
359:
360: IF ( x_segment10 IS NOT NULL ) THEN
361: dbms_sql.bind_variable(ccid_cursor, ':segment10', x_segment10);
362: END IF;
363:
364: IF ( x_segment11 IS NOT NULL ) THEN
365: dbms_sql.bind_variable(ccid_cursor, ':segment11', x_segment11);
361: dbms_sql.bind_variable(ccid_cursor, ':segment10', x_segment10);
362: END IF;
363:
364: IF ( x_segment11 IS NOT NULL ) THEN
365: dbms_sql.bind_variable(ccid_cursor, ':segment11', x_segment11);
366: END IF;
367:
368: IF ( x_segment12 IS NOT NULL ) THEN
369: dbms_sql.bind_variable(ccid_cursor, ':segment12', x_segment12);
365: dbms_sql.bind_variable(ccid_cursor, ':segment11', x_segment11);
366: END IF;
367:
368: IF ( x_segment12 IS NOT NULL ) THEN
369: dbms_sql.bind_variable(ccid_cursor, ':segment12', x_segment12);
370: END IF;
371:
372: IF ( x_segment13 IS NOT NULL ) THEN
373: dbms_sql.bind_variable(ccid_cursor, ':segment13', x_segment13);
369: dbms_sql.bind_variable(ccid_cursor, ':segment12', x_segment12);
370: END IF;
371:
372: IF ( x_segment13 IS NOT NULL ) THEN
373: dbms_sql.bind_variable(ccid_cursor, ':segment13', x_segment13);
374: END IF;
375:
376: IF ( x_segment14 IS NOT NULL ) THEN
377: dbms_sql.bind_variable(ccid_cursor, ':segment14', x_segment14);
373: dbms_sql.bind_variable(ccid_cursor, ':segment13', x_segment13);
374: END IF;
375:
376: IF ( x_segment14 IS NOT NULL ) THEN
377: dbms_sql.bind_variable(ccid_cursor, ':segment14', x_segment14);
378: END IF;
379:
380: IF ( x_segment15 IS NOT NULL ) THEN
381: dbms_sql.bind_variable(ccid_cursor, ':segment15', x_segment15);
377: dbms_sql.bind_variable(ccid_cursor, ':segment14', x_segment14);
378: END IF;
379:
380: IF ( x_segment15 IS NOT NULL ) THEN
381: dbms_sql.bind_variable(ccid_cursor, ':segment15', x_segment15);
382: END IF;
383:
384: IF ( x_segment16 IS NOT NULL ) THEN
385: dbms_sql.bind_variable(ccid_cursor, ':segment16', x_segment16);
381: dbms_sql.bind_variable(ccid_cursor, ':segment15', x_segment15);
382: END IF;
383:
384: IF ( x_segment16 IS NOT NULL ) THEN
385: dbms_sql.bind_variable(ccid_cursor, ':segment16', x_segment16);
386: END IF;
387:
388: IF ( x_segment17 IS NOT NULL ) THEN
389: dbms_sql.bind_variable(ccid_cursor, ':segment17', x_segment17);
385: dbms_sql.bind_variable(ccid_cursor, ':segment16', x_segment16);
386: END IF;
387:
388: IF ( x_segment17 IS NOT NULL ) THEN
389: dbms_sql.bind_variable(ccid_cursor, ':segment17', x_segment17);
390: END IF;
391:
392: IF ( x_segment18 IS NOT NULL ) THEN
393: dbms_sql.bind_variable(ccid_cursor, ':segment18', x_segment18);
389: dbms_sql.bind_variable(ccid_cursor, ':segment17', x_segment17);
390: END IF;
391:
392: IF ( x_segment18 IS NOT NULL ) THEN
393: dbms_sql.bind_variable(ccid_cursor, ':segment18', x_segment18);
394: END IF;
395:
396: IF ( x_segment19 IS NOT NULL ) THEN
397: dbms_sql.bind_variable(ccid_cursor, ':segment19', x_segment19);
393: dbms_sql.bind_variable(ccid_cursor, ':segment18', x_segment18);
394: END IF;
395:
396: IF ( x_segment19 IS NOT NULL ) THEN
397: dbms_sql.bind_variable(ccid_cursor, ':segment19', x_segment19);
398: END IF;
399:
400: IF ( x_segment20 IS NOT NULL ) THEN
401: dbms_sql.bind_variable(ccid_cursor, ':segment20', x_segment20);
397: dbms_sql.bind_variable(ccid_cursor, ':segment19', x_segment19);
398: END IF;
399:
400: IF ( x_segment20 IS NOT NULL ) THEN
401: dbms_sql.bind_variable(ccid_cursor, ':segment20', x_segment20);
402: END IF;
403:
404: IF ( x_segment21 IS NOT NULL ) THEN
405: dbms_sql.bind_variable(ccid_cursor, ':segment21', x_segment21);
401: dbms_sql.bind_variable(ccid_cursor, ':segment20', x_segment20);
402: END IF;
403:
404: IF ( x_segment21 IS NOT NULL ) THEN
405: dbms_sql.bind_variable(ccid_cursor, ':segment21', x_segment21);
406: END IF;
407:
408: IF ( x_segment22 IS NOT NULL ) THEN
409: dbms_sql.bind_variable(ccid_cursor, ':segment22', x_segment22);
405: dbms_sql.bind_variable(ccid_cursor, ':segment21', x_segment21);
406: END IF;
407:
408: IF ( x_segment22 IS NOT NULL ) THEN
409: dbms_sql.bind_variable(ccid_cursor, ':segment22', x_segment22);
410: END IF;
411:
412: IF ( x_segment23 IS NOT NULL ) THEN
413: dbms_sql.bind_variable(ccid_cursor, ':segment23', x_segment23);
409: dbms_sql.bind_variable(ccid_cursor, ':segment22', x_segment22);
410: END IF;
411:
412: IF ( x_segment23 IS NOT NULL ) THEN
413: dbms_sql.bind_variable(ccid_cursor, ':segment23', x_segment23);
414: END IF;
415:
416: IF ( x_segment24 IS NOT NULL ) THEN
417: dbms_sql.bind_variable(ccid_cursor, ':segment24', x_segment24);
413: dbms_sql.bind_variable(ccid_cursor, ':segment23', x_segment23);
414: END IF;
415:
416: IF ( x_segment24 IS NOT NULL ) THEN
417: dbms_sql.bind_variable(ccid_cursor, ':segment24', x_segment24);
418: END IF;
419:
420: IF ( x_segment25 IS NOT NULL ) THEN
421: dbms_sql.bind_variable(ccid_cursor, ':segment25', x_segment25);
417: dbms_sql.bind_variable(ccid_cursor, ':segment24', x_segment24);
418: END IF;
419:
420: IF ( x_segment25 IS NOT NULL ) THEN
421: dbms_sql.bind_variable(ccid_cursor, ':segment25', x_segment25);
422: END IF;
423:
424: IF ( x_segment26 IS NOT NULL ) THEN
425: dbms_sql.bind_variable(ccid_cursor, ':segment26', x_segment26);
421: dbms_sql.bind_variable(ccid_cursor, ':segment25', x_segment25);
422: END IF;
423:
424: IF ( x_segment26 IS NOT NULL ) THEN
425: dbms_sql.bind_variable(ccid_cursor, ':segment26', x_segment26);
426: END IF;
427:
428: IF ( x_segment27 IS NOT NULL ) THEN
429: dbms_sql.bind_variable(ccid_cursor, ':segment27', x_segment27);
425: dbms_sql.bind_variable(ccid_cursor, ':segment26', x_segment26);
426: END IF;
427:
428: IF ( x_segment27 IS NOT NULL ) THEN
429: dbms_sql.bind_variable(ccid_cursor, ':segment27', x_segment27);
430: END IF;
431:
432: IF ( x_segment28 IS NOT NULL ) THEN
433: dbms_sql.bind_variable(ccid_cursor, ':segment28', x_segment28);
429: dbms_sql.bind_variable(ccid_cursor, ':segment27', x_segment27);
430: END IF;
431:
432: IF ( x_segment28 IS NOT NULL ) THEN
433: dbms_sql.bind_variable(ccid_cursor, ':segment28', x_segment28);
434: END IF;
435:
436: IF ( x_segment29 IS NOT NULL ) THEN
437: dbms_sql.bind_variable(ccid_cursor, ':segment29', x_segment29);
433: dbms_sql.bind_variable(ccid_cursor, ':segment28', x_segment28);
434: END IF;
435:
436: IF ( x_segment29 IS NOT NULL ) THEN
437: dbms_sql.bind_variable(ccid_cursor, ':segment29', x_segment29);
438: END IF;
439:
440: IF ( x_segment30 IS NOT NULL ) THEN
441: dbms_sql.bind_variable(ccid_cursor, ':segment30', x_segment30);
437: dbms_sql.bind_variable(ccid_cursor, ':segment29', x_segment29);
438: END IF;
439:
440: IF ( x_segment30 IS NOT NULL ) THEN
441: dbms_sql.bind_variable(ccid_cursor, ':segment30', x_segment30);
442: END IF;
443:
444: dbms_sql.bind_variable(ccid_cursor, ':lgr_id', x_ledger_id);
445: row_count := dbms_sql.execute_and_fetch(ccid_cursor);
440: IF ( x_segment30 IS NOT NULL ) THEN
441: dbms_sql.bind_variable(ccid_cursor, ':segment30', x_segment30);
442: END IF;
443:
444: dbms_sql.bind_variable(ccid_cursor, ':lgr_id', x_ledger_id);
445: row_count := dbms_sql.execute_and_fetch(ccid_cursor);
446:
447: IF (row_count = 0) THEN
448: -- Create a detail account
441: dbms_sql.bind_variable(ccid_cursor, ':segment30', x_segment30);
442: END IF;
443:
444: dbms_sql.bind_variable(ccid_cursor, ':lgr_id', x_ledger_id);
445: row_count := dbms_sql.execute_and_fetch(ccid_cursor);
446:
447: IF (row_count = 0) THEN
448: -- Create a detail account
449: IF ( x_conc_seg IS NOT NULL) THEN
458: 'NAME=GL_RJE_NO_NEW_SUMMARY\nN'
459: )) THEN
460: x_templgrid := x_ledger_id;
461: x_err_msg :=fnd_flex_keyval.error_message;
462: dbms_sql.close_cursor(ccid_cursor);
463: RETURN FALSE;
464: ELSE
465: x_ccid := fnd_flex_keyval.combination_id;
466: x_templgrid := x_ledger_id;
467: x_acct_type := fnd_flex_keyval.qualifier_value('GL_ACCOUNT_TYPE');
468: END IF;
469: END IF;
470: ELSE
471: dbms_sql.column_value(ccid_cursor, 1, c_ccid);
472: dbms_sql.column_value(ccid_cursor, 2, c_lgr_id);
473: dbms_sql.column_value(ccid_cursor, 3, c_enabled_flag);
474: dbms_sql.column_value(ccid_cursor, 4, c_acct_type);
475:
468: END IF;
469: END IF;
470: ELSE
471: dbms_sql.column_value(ccid_cursor, 1, c_ccid);
472: dbms_sql.column_value(ccid_cursor, 2, c_lgr_id);
473: dbms_sql.column_value(ccid_cursor, 3, c_enabled_flag);
474: dbms_sql.column_value(ccid_cursor, 4, c_acct_type);
475:
476: IF (c_enabled_flag ='N')THEN
469: END IF;
470: ELSE
471: dbms_sql.column_value(ccid_cursor, 1, c_ccid);
472: dbms_sql.column_value(ccid_cursor, 2, c_lgr_id);
473: dbms_sql.column_value(ccid_cursor, 3, c_enabled_flag);
474: dbms_sql.column_value(ccid_cursor, 4, c_acct_type);
475:
476: IF (c_enabled_flag ='N')THEN
477: x_ccid := c_ccid;
470: ELSE
471: dbms_sql.column_value(ccid_cursor, 1, c_ccid);
472: dbms_sql.column_value(ccid_cursor, 2, c_lgr_id);
473: dbms_sql.column_value(ccid_cursor, 3, c_enabled_flag);
474: dbms_sql.column_value(ccid_cursor, 4, c_acct_type);
475:
476: IF (c_enabled_flag ='N')THEN
477: x_ccid := c_ccid;
478: x_templgrid := c_lgr_id;
478: x_templgrid := c_lgr_id;
479: x_acct_type := c_acct_type;
480: fnd_message.set_name( 'SQLGL', 'GL_RJE_RULE_INV_CCID' );
481: x_err_msg := fnd_message.get;
482: dbms_sql.close_cursor(ccid_cursor);
483: RETURN FALSE;
484: ELSE
485: x_ccid := c_ccid;
486: x_templgrid := c_lgr_id;
486: x_templgrid := c_lgr_id;
487: x_acct_type := c_acct_type;
488: END IF;
489: END IF;
490: dbms_sql.close_cursor(ccid_cursor);
491: RETURN TRUE;
492: END get_ccid;
493:
494: -- *********************************************************************