DBA Data[Home] [Help]

APPS.GMF_PERIODCLOSE_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 71

  SELECT
    mp.organization_code,
    UPPER(nvl(mp.process_enabled_flag,'N')) process_flag,
    oacp.period_name,
    oacp.period_close_date,
    oacp.schedule_close_date,
    oacp.open_flag
  FROM
    mtl_parameters mp,
    org_acct_periods oacp
  WHERE
    mp.organization_id = p_organization_id AND
    mp.organization_id = oacp.organization_id AND
    oacp.acct_period_id = p_acct_period_id
  ;
Line: 156

  SELECT org_information2 INTO l_legal_entity_id
  FROM hr_organization_information
  WHERE organization_id = p_organization_id
  AND  org_information_context = 'Accounting Information';
Line: 196

  /* if there are already some prelim rows from some prior prelim close  -- delete them*/
  DELETE FROM gmf_period_balances
       WHERE acct_period_id = p_closing_acct_period_id
          AND organization_id = p_organization_id;
Line: 202

    Log_Msg(C_LOG_FILE,'        No rows found in gmf_period_balances to delete.');
Line: 204

    Log_Msg(C_LOG_FILE,'        Deleted '||SQL%ROWCOUNT||' rows from gmf_period_balances.');
Line: 230

  /* All done, update period status to Closed */
  UPDATE org_acct_periods
  SET
    open_flag = 'N',
    summarized_flag = 'Y'
  WHERE
    organization_id = p_organization_id AND
    acct_period_id = p_closing_acct_period_id;
Line: 313

  SELECT
    moq.organization_id,
    moq.cost_group_id,
    moq.subinventory_code,
    moq.inventory_item_id,
    moq.locator_id,
    moq.lot_number,
    SUM(moq.primary_transaction_quantity) pri_qty, /*bug 5463187*/
    SUM(NVL(moq.secondary_transaction_quantity,0)) sec_qty
  FROM
    mtl_onhand_quantities_detail moq
  WHERE
    moq.organization_id = p_organization_id AND
    moq.is_consigned = 2  /* moq does not have sec qty */
  GROUP BY
    moq.organization_id,
    moq.cost_group_id,
    moq.subinventory_code,
    moq.inventory_item_id,
    moq.locator_id,
    moq.lot_number
  ;
Line: 343

  SELECT    /* lot controlled items */
    mmt.organization_id,
    mmt.cost_group_id,
    mmt.subinventory_code,
    mmt.inventory_item_id,
    mmt.locator_id,
    mtln.lot_number,
    SUM(mtln.primary_quantity) pri_qty,
    SUM(NVL(mtln.secondary_transaction_quantity,0)) sec_qty
  FROM
    mtl_transaction_lot_numbers mtln,
    mtl_material_transactions mmt,
    MTL_SECONDARY_INVENTORIES sinv /*B8404849*/
  WHERE
    mmt.transaction_id = mtln.transaction_id AND
    mmt.organization_id = p_organization_id AND
    mmt.transaction_date > p_rollback_to_date AND
    /* Ignore consigned */
    mmt.organization_id = NVL(mmt.owning_organization_id, mmt.organization_id) AND
    NVL(mmt.owning_tp_type,2) = 2 AND
    /* Ignore Logical Txns */
    NVL(mmt.logical_transaction,-1) <> 1
    /*B8404849 - Ignore Non Quantity tracked subinventory txns - START*/
    AND sinv.organization_id = mmt.organization_id
    AND sinv.secondary_inventory_name = mmt.subinventory_code
    AND nvl(sinv.quantity_tracked,1) = 1
    /*B8404849 - Ignore Non Quantity tracked subinventory txns - End*/
    /* TBD: do we need to exclude any specific txns in process orgs */
  GROUP BY
    mmt.organization_id,
    mmt.cost_group_id,
    mmt.subinventory_code,
    mmt.inventory_item_id,
    mmt.locator_id,
    mtln.lot_number
  UNION ALL
  SELECT   /*+ INDEX(mmt mtl_material_transactions_n5) */  /* non lot controlled items */
    mmt.organization_id,
    mmt.cost_group_id,
    mmt.subinventory_code,
    mmt.inventory_item_id,
    mmt.locator_id,
    null lot_number,
    SUM(mmt.primary_quantity) pri_qty,
    SUM(NVL(mmt.secondary_transaction_quantity,0)) sec_qty
  FROM
    mtl_system_items_b msi,
    mtl_material_transactions mmt,
    MTL_SECONDARY_INVENTORIES sinv /*B8404849*/
  WHERE
    mmt.inventory_item_id = msi.inventory_item_id AND
    mmt.organization_id = msi.organization_id AND
    msi.lot_control_code = 1 AND  /* no lot control */
    mmt.organization_id = p_organization_id AND
    mmt.transaction_date > p_rollback_to_date AND
    /* Ignore consigned */
    mmt.organization_id = NVL(mmt.owning_organization_id, mmt.organization_id) AND
    NVL(mmt.owning_tp_type,2) = 2 AND
    /* Ignore Logical Txns */
    NVL(mmt.logical_transaction,-1) <> 1
    /*B8404849 - Ignore Non Quantity tracked subinventory txns - START*/
    AND sinv.organization_id = mmt.organization_id
    AND sinv.secondary_inventory_name = mmt.subinventory_code
    AND nvl(sinv.quantity_tracked,1) = 1
    /*B8404849 - Ignore Non Quantity tracked subinventory txns - End*/
    /* TBD: do we need to exclude any specific txns in process orgs */
  GROUP BY
    mmt.organization_id,
    mmt.cost_group_id,
    mmt.subinventory_code,
    mmt.inventory_item_id,
    mmt.locator_id
  ;
Line: 426

  SELECT
    pbt.organization_id,
    pbt.cost_group_id,
    pbt.subinventory_code,
    pbt.inventory_item_id,
    pbt.locator_id,
    pbt.lot_number,
    SUM(pbt.primary_quantity) pri_qty,
    SUM(NVL(pbt.secondary_quantity,0)) sec_qty
  FROM
    gmf_period_balances_gt pbt
  WHERE
    organization_id = p_organization_id  /* Bug#5652481 ANTHIYAG 09-Nov-2006 */
    AND acct_period_id = p_acct_period_id /* Bug#5652481 ANTHIYAG 09-Nov-2006 */
  GROUP BY
    pbt.organization_id,
    pbt.cost_group_id,
    pbt.subinventory_code,
    pbt.inventory_item_id,
    pbt.locator_id,
    pbt.lot_number
  HAVING
    ( SUM(pbt.primary_quantity) <> 0 OR
      SUM(NVL(pbt.secondary_quantity,0)) <> 0 )
  ;
Line: 469

  /* SELECT SYSDATE INTO l_rollback_to_date FROM DUAL; */
Line: 480

    fnd_log.string(fnd_log.level_statement, 'l_log_module','Inserting Onhand Balances');
Line: 488

    /* insert into balances table */
    INSERT INTO gmf_period_balances_gt (
      source_type_id,
      acct_period_id,
      organization_id,
      cost_group_id,
      subinventory_code,
      inventory_item_id,
      lot_number,
      locator_id,
      primary_quantity,
      secondary_quantity,
      intransit_primary_quantity,
      intransit_secondary_quantity,
      accounted_value,
      intransit_accounted_value
    )
    VALUES
    (
      1,  /* onhand */
      p_closing_acct_period_id,
      p_organization_id,
      r_onhand.cost_group_id,
      r_onhand.subinventory_code,
      r_onhand.inventory_item_id,
      r_onhand.lot_number,
      r_onhand.locator_id,
      r_onhand.pri_qty,
      r_onhand.sec_qty,
      0,  /* intransit pri qty */
      0,  /* intransit sec qty */
      0,  /* accounted_value */
      0   /* intransit accounted value */
    );
Line: 536

    INSERT INTO gmf_period_balances_gt (
      source_type_id,
      acct_period_id,
      organization_id,
      cost_group_id,
      subinventory_code,
      inventory_item_id,
      lot_number,
      locator_id,
      primary_quantity,
      secondary_quantity,
      intransit_primary_quantity,
      intransit_secondary_quantity,
      accounted_value,
      intransit_accounted_value
    )
    VALUES
    (
      2,  /* txns */
      p_closing_acct_period_id,
      p_organization_id,
      r_txns.cost_group_id,
      r_txns.subinventory_code,
      r_txns.inventory_item_id,
      r_txns.lot_number,
      r_txns.locator_id,
      -1 * r_txns.pri_qty,
      -1 * r_txns.sec_qty,
      0,  /* intransit pri qty */
      0,  /* intransit sec qty */
      0,  /* accounted_value */
      0   /* intransit accounted value */
    );
Line: 572

  /* Insert/Update balances table */
  IF( fnd_log.level_statement >= fnd_log.g_current_runtime_level )
  THEN
    fnd_log.string(fnd_log.level_statement, 'l_log_module','Inserting into balances');
Line: 581

    INSERT INTO gmf_period_balances (
      period_balance_id,
      acct_period_id,
      organization_id,
      cost_group_id,
      subinventory_code,
      inventory_item_id,
      lot_number,
      locator_id,
      primary_quantity,
      secondary_quantity,
      intransit_primary_quantity,
      intransit_secondary_quantity,
      accounted_value,
      intransit_accounted_value,
      costed_flag,
      creation_date,
      created_by,
      last_update_date,
      last_updated_by,
      last_update_login,
      request_id,
      program_application_id,
      program_id,
      program_update_date,
      period_close_status
    )
    VALUES
    (
      gmf_period_balances_s.nextval,
      p_closing_acct_period_id,
      p_organization_id,
      r_bal_tmp.cost_group_id,
      r_bal_tmp.subinventory_code,
      r_bal_tmp.inventory_item_id,
      r_bal_tmp.lot_number,
      r_bal_tmp.locator_id,
      r_bal_tmp.pri_qty,
      r_bal_tmp.sec_qty,
      0,    /* intransit pri qty */
      0,    /* intransit sec qty */
      0,    /* accounted value */
      0,    /* intransit accounted value */
      'N',  /* costed flag */
      sysdate,
      fnd_global.user_id,
      sysdate,
      fnd_global.user_id,
      fnd_global.login_id,
      fnd_global.conc_request_id,
      fnd_global.prog_appl_id,
      fnd_global.conc_program_id,
      sysdate,
      decode(p_final_close,1,'F','P')
    );
Line: 724

  UPDATE org_acct_periods
  SET
    open_flag = 'Y',
    summarized_flag = NULL
  WHERE
    organization_id = p_organization_id AND
    p_acct_period_id = p_acct_period_id;
Line: 819

   SELECT organization_code,
          organization_id
    FROM  gmf_process_organizations_gt
   ORDER BY organization_code;
Line: 827

     SELECT      acct_period_id, period_start_date start_date, schedule_close_date close_date, period_name
     FROM        ORG_ACCT_PERIODS
     WHERE       organization_id = p_org_id
     and         period_set_name = p_period_Set_name
     and         period_year = p_year
     and         period_num = p_period
     ORDER by    schedule_close_date;
Line: 854

        Log_Msg(C_LOG_FILE, 'The period is selected for final close');
Line: 856

        Log_Msg(C_LOG_FILE, 'The period is selected for preliminary close');
Line: 877

      SELECT user_name INTO l_user
      FROM   fnd_user
      WHERE  user_id = l_user_id;
Line: 896

    select  b.period_set_name
    into    l_period_Set_name
    from    gmf_fiscal_policies a,
            gl_ledgers b
    where   a.legal_entity_id = p_le_id
    and     b.ledger_id = a.ledger_id;
Line: 912

   SELECT glp.end_date
   INTO   l_period_end_date
 FROM GL_PERIODS GLP,GL_PERIOD_STATUSES STS, GL_SETS_OF_BOOKS SOB,GMF_FISCAL_POLICIES GFP
where sob.set_of_books_id  = GFP.LEDGER_ID
AND GFP.LEGAL_ENTITY_ID = p_le_id
AND glp.period_set_name = sob.period_set_name
AND glp.period_type     = sob.accounted_period_type
AND glp.period_year     = p_fiscal_year
AND glp.period_num      = sts.period_num
AND glp.period_year     = sts.period_year
AND sts.set_of_books_id = sob.set_of_books_id
AND sts.application_id  = 101
AND sts.period_num = p_fiscal_period;
Line: 1079

             UPDATE org_acct_periods
               SET
                 open_flag               = 'P',
                 period_close_date       = trunc(sysdate),
                 last_update_date        = trunc(sysdate),
                 last_updated_by         = l_user_id,
                 last_update_login       = l_login_id
               WHERE
                 acct_period_id = l_acct_period_id AND
                 -- program level check to make sure that
                 -- the period is only closed once
                 open_flag = 'Y' AND
                 organization_id = l_organization_id AND
                 period_set_name = l_period_set_name;
Line: 1139

        /* if there are already some prelim rows from some prior prelim close  -- delete them*/
         DELETE FROM gmf_period_balances
               WHERE acct_period_id = l_acct_period_id
                  AND organization_id = l_organization_id;
Line: 1145

            Log_Msg(C_LOG_FILE,'        No rows found in gmf_period_balances to delete.');
Line: 1147

            Log_Msg(C_LOG_FILE,'        Deleted '||SQL%ROWCOUNT||' rows from gmf_period_balances.');
Line: 1176

        /* All done, update period status to Closed */
        IF l_final_close = 1 THEN
           UPDATE org_acct_periods
           SET
             open_flag = 'N',
             summarized_flag = 'Y'
           WHERE
             organization_id = l_organization_id AND
             acct_period_id = l_acct_period_id;