DBA Data[Home] [Help]

APPS.CSM_MTL_SYSTEM_ITEMS_EVENT_PKG SQL Statements

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

Line: 26

PROCEDURE insert_mtl_system_items( p_user_id     IN NUMBER,
                                   p_organization_id IN NUMBER,
                                   p_category_set_id IN NUMBER,
                                   p_category_id IN NUMBER,
                                   p_last_run_date IN DATE,
                                   p_changed IN VARCHAR2)
IS
l_run_date 		DATE;
Line: 55

SELECT csm_mtl_system_items_acc_s.NEXTVAL, inventory_item_id, organization_id, b_user_id
FROM   MTL_SYSTEM_ITEMS_B msi
WHERE  msi.organization_id = b_organization_id
AND    NOT EXISTS
	   ( SELECT 1
  	   FROM  csm_mtl_system_items_acc acc
  	   WHERE ((b_changed ='Y' AND USER_ID=-1)  OR (b_changed ='N' AND user_id = b_user_id))
  	   AND 	 acc.inventory_item_id = msi.inventory_item_id
  	   AND 	 acc.organization_id   = msi.organization_id);
Line: 69

SELECT csm_mtl_system_items_acc_s.NEXTVAL, itemcat.inventory_item_id,
      itemcat.organization_id, b_user_id
FROM   mtl_item_categories itemcat
WHERE  itemcat.category_id = b_category_id
AND    itemcat.organization_id = b_organization_id
AND    NOT EXISTS
(SELECT 1
 FROM   csm_mtl_system_items_acc acc
 WHERE ((b_changed ='Y' AND USER_ID=-1)  OR (b_changed ='N' AND user_id = b_user_id))
 AND    acc.inventory_item_id = itemcat.inventory_item_id
 AND    acc.organization_id   = itemcat.organization_id
 );
Line: 86

SELECT csm_mtl_system_items_acc_s.NEXTVAL, itemcat.inventory_item_id,
       itemcat.organization_id, b_user_id
FROM   mtl_item_categories itemcat
WHERE  itemcat.category_set_id = b_category_set_id
AND    itemcat.organization_id = b_organization_id
AND    NOT EXISTS
    (SELECT 1
      FROM csm_mtl_system_items_acc acc
      WHERE ((b_changed ='Y' AND USER_ID=-1)  OR (b_changed ='N' AND user_id = b_user_id))
      AND acc.inventory_item_id = itemcat.inventory_item_id
      AND acc.organization_id   = itemcat.organization_id
    );
Line: 103

SELECT csm_mtl_system_items_acc_s.NEXTVAL, itemcat.inventory_item_id,
        itemcat.organization_id, b_user_id
FROM   mtl_item_categories itemcat
WHERE  itemcat.category_set_id = b_category_set_id
AND    itemcat.category_id     = b_category_id
AND    itemcat.organization_id = b_organization_id
AND    NOT EXISTS
    (SELECT 1
    FROM csm_mtl_system_items_acc acc
    WHERE ((b_changed ='Y' AND USER_ID=-1)  OR (b_changed ='N' AND user_id = b_user_id))
    AND acc.inventory_item_id = itemcat.inventory_item_id
    AND acc.organization_id   = itemcat.organization_id
    );
Line: 119

SELECT 'Y' FROM CSM_USER_INVENTORY_ORG
WHERE ORGANIZATION_ID = b_org_id
AND   CATEGORY_SET_ID IS NULL
AND   CATEGORY_ID     IS NULL
AND   TYPE            = 'C'
AND   USER_ID  NOT IN(b_user_id);
Line: 128

SELECT ACCESS_ID,b_USER_ID
FROM  csm_mtl_system_items_acc acc
WHERE acc.organization_id   = b_organization_id
AND   acc.USER_ID = -1
AND   NOT EXISTS (SELECT 1 FROM
                  csm_mtl_system_items_acc acci
                  WHERE acci.organization_id = b_organization_id
                  AND   acci.USER_ID = b_USER_ID);
Line: 140

SELECT  csm_mtl_system_items_acc_s.NEXTVAL,inventory_item_id, organization_id
FROM   MTL_SYSTEM_ITEMS_B msi
WHERE  msi.organization_id = b_organization_id;
Line: 151

  CSM_UTIL_PKG.LOG('Entering CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS ',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 171

        l_tab_access_id.DELETE;
Line: 172

        l_tab_user_id.DELETE;
Line: 186

      ELSE--IF Org Items are not present then insert it freshly.

        --Do a direct into into the ACC table for user -1
        INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
                 created_by, creation_date, last_updated_by, last_update_date, last_update_login)
        SELECT   csm_mtl_system_items_acc_s.NEXTVAL,l_number, b.inventory_item_id, b.organization_id, 1,
                 fnd_global.user_id, l_run_date, fnd_global.user_id, l_run_date, fnd_global.login_id
                 FROM MTL_SYSTEM_ITEMS_B b
                 WHERE b.ORGANIZATION_ID = p_organization_id
                 AND b.enabled_flag = 'Y'
                 AND SYSDATE BETWEEN nvl(b.start_date_active, SYSDATE)
                 AND nvl(b.end_date_active, SYSDATE);
Line: 201

        l_tab_access_id.DELETE;
Line: 202

        l_tab_user_id.DELETE;
Line: 217

      UPDATE CSM_USER_INVENTORY_ORG
      SET    TYPE = 'C'
      WHERE  CATEGORY_SET_ID IS NULL
      AND    CATEGORY_ID     IS NULL
      AND    USER_ID   = p_user_id;
Line: 224

   CSM_UTIL_PKG.LOG('Leaving CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS after common processing',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 239

      l_stmt := 'UPDATE csm_mtl_system_items_acc';
Line: 241

      l_stmt :=   l_stmt || '  ,   last_update_date = SYSDATE';
Line: 242

      l_stmt :=   l_stmt || '  ,   last_updated_by = 1';
Line: 262

        l_stmt :=   l_stmt || '     (SELECT inventory_item_id';
Line: 274

  ELSE  -- if p_changed = 'N', delete items that are no longer assigned to the category/category set
      -- changed to dynamic sql to support either category or category set
      l_stmt :=  NULL;
Line: 277

      l_stmt := 'UPDATE csm_mtl_system_items_acc acc';
Line: 279

      l_stmt :=   l_stmt || '  ,   last_update_date = SYSDATE';
Line: 280

      l_stmt :=   l_stmt || '  ,   last_updated_by = 1';
Line: 299

        l_stmt :=   l_stmt || ' (SELECT 1';
Line: 305

        l_stmt :=   l_stmt || '  (SELECT 1';
Line: 315

        l_tab_access_id.DELETE;
Line: 316

        l_tab_user_id.DELETE;
Line: 318

        SELECT access_id, user_id
        BULK COLLECT INTO l_tab_access_id, l_tab_user_id
        FROM csm_mtl_system_items_acc acc
        WHERE acc.counter = 0;
Line: 334

                  DELETE FROM csm_mtl_system_items_acc WHERE access_id = l_tab_access_id(i);
Line: 353

        l_tab_access_id.DELETE;
Line: 354

        l_inventory_item_id_tbl.DELETE;
Line: 355

        l_organization_id_tbl.DELETE;
Line: 356

        l_tab_user_id.DELETE;
Line: 363

         CSM_UTIL_PKG.LOG('Bulk inserted ' || l_tab_access_id.count
                         || ' records into csm_mtl_system_items_acc for user ' || p_user_id ,
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 368

           INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
                       created_by, creation_date, last_updated_by, last_update_date, last_update_login)
                VALUES (l_tab_access_id(i), l_number, l_inventory_item_id_tbl(i), l_organization_id_tbl(i), 1,
                       fnd_global.user_id, l_run_date, fnd_global.user_id, l_run_date, fnd_global.login_id);
Line: 394

        l_tab_access_id.DELETE;
Line: 395

        l_inventory_item_id_tbl.DELETE;
Line: 396

        l_organization_id_tbl.DELETE;
Line: 397

        l_tab_user_id.DELETE;
Line: 404

        CSM_UTIL_PKG.LOG('Bulk inserted ' || l_tab_access_id.count
                         || ' records into csm_mtl_system_items_acc for user ' || p_user_id ,
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 409

           INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
                       created_by, creation_date, last_updated_by, last_update_date, last_update_login)
                VALUES (l_tab_access_id(i), l_number, l_inventory_item_id_tbl(i), l_organization_id_tbl(i), 1,
                       fnd_global.user_id, l_run_date, fnd_global.user_id, l_run_date, fnd_global.login_id);
Line: 435

        l_tab_access_id.DELETE;
Line: 436

        l_inventory_item_id_tbl.DELETE;
Line: 437

        l_organization_id_tbl.DELETE;
Line: 438

        l_tab_user_id.DELETE;
Line: 445

        CSM_UTIL_PKG.LOG('Bulk inserted ' || l_tab_access_id.count
                         || ' records into csm_mtl_system_items_acc for user ' || p_user_id ,
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 450

           INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
                       created_by, creation_date, last_updated_by, last_update_date, last_update_login)
                VALUES (l_tab_access_id(i), l_number, l_inventory_item_id_tbl(i), l_organization_id_tbl(i), 1,
                       fnd_global.user_id, l_run_date, fnd_global.user_id, l_run_date, fnd_global.login_id);
Line: 476

        l_tab_access_id.DELETE;
Line: 477

        l_inventory_item_id_tbl.DELETE;
Line: 478

        l_organization_id_tbl.DELETE;
Line: 479

        l_tab_user_id.DELETE;
Line: 486

        CSM_UTIL_PKG.LOG('Bulk inserted ' || l_tab_access_id.count
                         || ' records into csm_mtl_system_items_acc for user ' || p_user_id ,
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 491

           INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
                       created_by, creation_date, last_updated_by, last_update_date, last_update_login)
                VALUES (l_tab_access_id(i), l_number, l_inventory_item_id_tbl(i), l_organization_id_tbl(i), 1,
                       fnd_global.user_id, l_run_date, fnd_global.user_id, l_run_date, fnd_global.login_id);
Line: 512

    UPDATE CSM_USER_INVENTORY_ORG
    SET    TYPE = 'I'
    WHERE  USER_ID   = p_user_id;
Line: 517

 CSM_UTIL_PKG.LOG('Leaving CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS ',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 523

     l_error_msg := ' Exception in  INSERT_MTL_SYSTEM_ITEMS for user_id :'
                       || to_char(p_user_id) || ':' || l_sqlerrno || ':' || l_sqlerrmsg;
Line: 525

     CSM_UTIL_PKG.LOG(l_error_msg, 'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.INSERT_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EXCEPTION);
Line: 527

END INSERT_MTL_SYSTEM_ITEMS;
Line: 529

PROCEDURE update_mtl_system_items(p_last_run_date IN DATE)
IS
l_sqlerrno      VARCHAR2(20);
Line: 539

l_max_last_update_date_b  DATE;
Line: 540

l_max_last_update_date_tl DATE;
Line: 546

SELECT acc.access_id, acc.user_id
FROM   csm_mtl_system_items_acc acc, mtl_system_items_b msi,asg_user au
WHERE  msi.inventory_item_id = acc.inventory_item_id
AND    msi.organization_id   = acc.organization_id
AND    acc.USER_ID > 0
AND    au.user_id=acc.user_id
AND    nvl(au.MULTI_PLATFORM,'N')='N'
AND    msi.last_update_date >= b_last_date;
Line: 558

SELECT acc.access_id, uorg.user_id
FROM   csm_mtl_system_items_acc acc,
       csm_user_inventory_org uorg
WHERE  acc.organization_id = uorg.organization_id
AND    uorg.category_set_id IS NULL
AND    uorg.category_id     IS NULL
AND    acc.USER_ID = -1
AND    EXISTS ( SELECT 1 FROM  mtl_system_items_b msi
        WHERE  msi.inventory_item_id = acc.inventory_item_id
        AND    msi.organization_id   = acc.organization_id
        AND    (msi.last_update_date >= b_last_date))
UNION
SELECT acc.access_id, uorg.user_id
FROM   csm_mtl_system_items_acc acc,
       csm_user_inventory_org uorg
WHERE  acc.organization_id = uorg.organization_id
AND    uorg.category_set_id IS NULL
AND    uorg.category_id     IS NULL
AND    acc.USER_ID = -1
AND    EXISTS ( SELECT 1 FROM  mtl_system_items_tl tl
        WHERE  tl.inventory_item_id = acc.inventory_item_id
        AND    tl.organization_id   = acc.organization_id
        AND    (tl.last_update_date >= b_last_date));
Line: 586

  SELECT acc.access_id, uorg.user_id
  FROM   csm_mtl_system_items_acc acc,
         csm_user_inventory_org uorg
  WHERE  acc.organization_id = uorg.organization_id
  AND    uorg.category_set_id IS NULL
  AND    uorg.category_id     IS NULL
  AND    acc.USER_ID = -2;
Line: 598

SELECT acc.access_id, uorg.user_id
FROM   csm_mtl_system_items_acc acc,
       csm_user_inventory_org uorg
WHERE  acc.organization_id = uorg.organization_id
AND    uorg.category_set_id IS NULL
AND    uorg.category_id     IS NULL
AND    acc.USER_ID = -1
AND    EXISTS ( SELECT 1 FROM  mtl_system_items_b msi
        WHERE  msi.inventory_item_id = acc.inventory_item_id
        AND    msi.organization_id   = acc.organization_id
        AND (msi.enabled_flag = 'N' OR msi.end_date_active < b_last_date));
Line: 611

 CSM_UTIL_PKG.LOG('Entering CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS ',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 616

  /* This portion of code assumes indexes on last_update_date on MTL_SYSTEM_ITEMS_B */
  /* , MTL_SYSTEM_ITEMS_TL which were custom created */
  SELECT MAX(last_update_date) INTO l_max_last_update_date_b
  FROM mtl_system_items_b;
Line: 620

  IF( l_max_last_update_date_b < p_last_run_date) THEN
     SELECT MAX(last_update_date) INTO l_max_last_update_date_tl
     FROM mtl_system_items_tl;
Line: 623

     IF(l_max_last_update_date_tl < p_last_run_date) THEN
          -- No updates
          CSM_UTIL_PKG.LOG('Leaving UPDATE_MTL_SYSTEM_ITEMS - No Updates ',
                       'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 640

       l_tab_access_id.DELETE;
Line: 641

       l_tab_user_id.DELETE;
Line: 647

                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 665

      DELETE FROM csm_mtl_system_items_acc acc
      WHERE   USER_ID = -1
      AND  EXISTS ( SELECT 1 FROM  mtl_system_items_b msi
        WHERE  msi.inventory_item_id = acc.inventory_item_id
        AND    msi.organization_id   = acc.organization_id
        AND msi.enabled_flag = 'N' OR msi.end_date_active < l_run_date);
Line: 677

       l_tab_access_id.DELETE;
Line: 678

       l_tab_user_id.DELETE;
Line: 685

                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 702

    INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
             created_by, creation_date, last_updated_by, last_update_date, last_update_login)
    SELECT   csm_mtl_system_items_acc_s.NEXTVAL, -2, msi.inventory_item_id, msi.organization_id, 1,
             fnd_global.user_id, l_run_date, fnd_global.user_id, l_run_date, fnd_global.login_id
             FROM MTL_SYSTEM_ITEMS_B msi
             WHERE  msi.enabled_flag = 'Y'
             AND SYSDATE BETWEEN nvl(msi.start_date_active, SYSDATE) AND nvl(msi.end_date_active, SYSDATE)
             AND msi.ORGANIZATION_ID
             IN(SELECT DISTINCT uorg.ORGANIZATION_ID
                FROM   CSM_USER_INVENTORY_ORG uorg
                WHERE    uorg.category_set_id IS NULL
                AND    uorg.category_id     IS NULL)
             AND  NOT EXISTS
                   ( SELECT 1
                     FROM  csm_mtl_system_items_acc acc
                     WHERE acc.user_id = -1
                     AND 	 acc.inventory_item_id = msi.inventory_item_id
                     AND 	 acc.organization_id   = msi.organization_id);
Line: 726

       l_tab_access_id.DELETE;
Line: 727

       l_tab_user_id.DELETE;
Line: 733

                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 750

      UPDATE csm_mtl_system_items_acc
      SET    USER_ID = -1
      WHERE  USER_ID = -2;
Line: 759

       l_tab_access_id.DELETE;
Line: 760

       l_tab_user_id.DELETE;
Line: 767

                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EVENT);
Line: 784

 CSM_UTIL_PKG.LOG('Leaving CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS ',
                          'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 791

        l_error_msg := ' Exception in  UPDATE_MTL_SYSTEM_ITEMS :' || l_sqlerrno || ':' || l_sqlerrmsg;
Line: 792

        CSM_UTIL_PKG.LOG(l_error_msg, 'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.UPDATE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EXCEPTION);
Line: 794

END UPDATE_MTL_SYSTEM_ITEMS;
Line: 796

PROCEDURE delete_mtl_system_items(p_user_id IN NUMBER,
                                  p_organization_id IN NUMBER,
                                  p_category_set_id IN NUMBER,
                                  p_category_id IN NUMBER)
IS
l_sqlerrno 		 VARCHAR2(20);
Line: 812

CURSOR c_Delete_items(b_org_id NUMBER, b_user_id NUMBER)
IS
SELECT b_user_id, ACCESS_ID
FROM   csm_mtl_system_items_acc
WHERE  USER_ID =-1
AND    ORGANIZATION_ID = b_org_id;
Line: 821

SELECT count(*)
FROM   csm_user_inventory_org
WHERE  USER_ID <> b_user_id
AND    ORGANIZATION_ID = b_org_id;
Line: 829

 CSM_UTIL_PKG.LOG('Entering CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.DELETE_MTL_SYSTEM_ITEMS ',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.DELETE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 833

 l_tab_access_id.DELETE;
Line: 840

   OPEN c_Delete_items(p_organization_id, p_user_id);
Line: 842

   FETCH c_Delete_items BULK COLLECT INTO l_tab_user_id, l_tab_access_id LIMIT 1000;
Line: 853

   l_tab_access_id.DELETE;
Line: 854

   l_tab_user_id.DELETE;
Line: 863

            DELETE FROM csm_mtl_system_items_acc WHERE USER_ID = -1
            AND  organization_id =p_organization_id;
Line: 868

    l_stmt := 'UPDATE csm_mtl_system_items_acc acc';
Line: 870

    l_stmt :=   l_stmt || '  ,   LAST_UPDATE_DATE = SYSDATE';
Line: 871

    l_stmt :=   l_stmt || '  ,   last_updated_by = nvl(fnd_global.user_id, 1)';
Line: 890

  	  l_stmt :=   l_stmt || '  SELECT 1 ';
Line: 904

    l_tab_access_id.DELETE;
Line: 905

    l_tab_user_id.DELETE;
Line: 907

    SELECT access_id, user_id
    BULK COLLECT INTO l_tab_access_id, l_tab_user_id
    FROM csm_mtl_system_items_acc acc
    WHERE acc.counter = 0;
Line: 923

                 DELETE FROM csm_mtl_system_items_acc WHERE access_id = l_tab_access_id(i);
Line: 927

 CSM_UTIL_PKG.LOG('Leaving CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.DELETE_MTL_SYSTEM_ITEMS ',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.DELETE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_PROCEDURE);
Line: 933

     CSM_UTIL_PKG.LOG('Exception in CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.DELETE_MTL_SYSTEM_ITEMS: ' || l_sqlerrno || ':' || l_sqlerrmsg,
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.DELETE_MTL_SYSTEM_ITEMS',FND_LOG.LEVEL_EXCEPTION);
Line: 936

END DELETE_MTL_SYSTEM_ITEMS;
Line: 954

SELECT organization_id, category_set_id, category_id
FROM csm_user_inventory_org
WHERE user_id = b_user_id
FOR UPDATE;
Line: 974

                          || ' - Inserting all mtl_system_items',
                         'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.CONCURRENT_PROCESS_USER',FND_LOG.LEVEL_PROCEDURE);
Line: 976

   INSERT INTO csm_user_inventory_org (
      user_id, organization_id, last_update_date, last_updated_by,
      creation_date, created_by, category_set_id, category_id )
   VALUES (
      p_user_id, p_organization_id, SYSDATE, 1, SYSDATE, 1,
      p_category_set_id, p_category_id );
Line: 1024

                  csm_system_item_event_pkg.delete_system_items(p_user_id=>p_user_id,
                                                                p_organization_id=>r_org.organization_id);
Line: 1031

           delete_mtl_system_items(p_user_id=>p_user_id,
                                   p_organization_id=>r_org.organization_id,
                                   p_category_set_id=>r_org.category_set_id,
                                   p_category_id=>r_org.category_id);
Line: 1036

           CSM_UTIL_PKG.LOG('Inserting records for new profile settings for user_id: ' || TO_CHAR(p_user_id),
                            'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.CONCURRENT_PROCESS_USER',FND_LOG.LEVEL_PROCEDURE);
Line: 1039

           insert_mtl_system_items(p_user_id=>p_user_id,
                           p_organization_id=>p_organization_id,
                           p_category_set_id=>p_category_set_id,
                           p_category_id=>p_category_id,
                           p_last_run_date=>NULL,
                           p_changed=>'Y');
Line: 1046

           CSM_UTIL_PKG.LOG('Update csm_user_inventory_org with new profile settings for user_id: ' || TO_CHAR(p_user_id),
                            'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.CONCURRENT_PROCESS_USER',FND_LOG.LEVEL_PROCEDURE);
Line: 1049

           UPDATE csm_user_inventory_org
           SET organization_id = p_organization_id
           ,   category_set_id = p_category_set_id
           ,   category_id     = p_category_id
           ,   last_update_date = SYSDATE
           WHERE CURRENT OF c_org;
Line: 1062

           insert_mtl_system_items(p_user_id=>p_user_id,
                           p_organization_id=>p_organization_id,
                           p_category_set_id=>p_category_set_id,
                           p_category_id=>p_category_id,
                           p_last_run_date=>p_last_run_date,
                           p_changed=>'N');
Line: 1090

SELECT csm_mtl_system_items_acc_s.NEXTVAL,inventory_item_id,org_id ,user_id
FROM  ( select c.inventory_item_id,d.destination_organization_id org_id ,a.user_id
		from csm_req_lines_acc a, csp_req_line_details b ,
			 oe_order_lines_all c,csp_requirement_headers d
             ,csp_requirement_lines e ,asg_user au
		where a.requirement_line_id=b.requirement_line_id
		and  b.source_type= 'IO' and b.source_id=c.line_id
		and  au.user_id=a.user_id and au.multi_platform='Y'
		and  d.requirement_header_id=e.requirement_header_id
		and b.requirement_line_id=e.requirement_line_id
		UNION
		select c.inventory_item_id,c.organization_id as org_id ,a.user_id
		from csm_req_lines_acc a, csp_req_line_details b , mtl_reservations c,asg_user au
		where a.requirement_line_id=b.requirement_line_id
		and  b.source_type= 'RES' and b.source_id=c.reservation_id
		and  au.user_id=a.user_id and au.multi_platform='Y') d
where not exists(select 1 from csm_mtl_system_items_acc acc
				where acc.inventory_item_id=d.inventory_item_id
				and  acc.organization_id=d.org_id
				and acc.user_id=d.user_id);
Line: 1124

			l_tab_access_id.DELETE;
Line: 1125

			l_inventory_item_id_tbl.DELETE;
Line: 1126

			l_organization_id_tbl.DELETE;
Line: 1127

			l_tab_user_id.DELETE;
Line: 1133

			CSM_UTIL_PKG.LOG('Bulk inserted ' || l_tab_access_id.count || ' records into csm_mtl_system_items_acc of requirement lines' ,
								 'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.process_htm5_ordered_items',FND_LOG.LEVEL_EVENT);
Line: 1137

			   INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
						   created_by, creation_date, last_updated_by, last_update_date, last_update_login)
					VALUES (l_tab_access_id(i), l_tab_user_id(i), l_inventory_item_id_tbl(i), l_organization_id_tbl(i), 1,
						   fnd_global.user_id, sysdate, fnd_global.user_id, sysdate, fnd_global.login_id);
Line: 1160

select a.access_id,au.user_id
from csm_mtl_system_items_acc a,asg_user au
where au.user_id=a.user_id
and NVL(au.MULTI_PLATFORM,'N')='Y'
and not exists (select 1
                from csf_debrief_lines b
                where transaction_type_id in (select transaction_type_id
                                              from cs_transaction_types_b
                                              where line_order_category_code='RETURN')
                and b.last_update_date >= b_ret_acty_date
	            and a.inventory_item_id=b.inventory_item_id
                and a.organization_id=nvl(b.receiving_inventory_org_id,b.issuing_inventory_org_id))     --return debrief-ed items
and not exists(select 1
               from CSM_REQ_LINE_DETAILS_ACC req_acc
               where req_acc.user_id=au.user_id
	           and req_acc.item_id=a.inventory_item_id
	           and req_acc.org_id =a.organization_id)     --htm5 user ordered/reserved item
and not exists(select 1
               from csm_item_instances_acc acc ,csi_item_instances ii
               where acc.instance_id=ii.instance_id
               and acc.user_id=au.user_id
	           and ii.inventory_item_id=a.inventory_item_id
               and a.organization_id=NVL(ii.inv_organization_id,ii.LAST_VLD_ORGANIZATION_ID))  --sr instance and its children/parent
and not exists(select 1
               from csm_incidents_all_acc inc_a,cs_incidents_all_b inc
               where inc_a.incident_id=inc.incident_id
               and inc_a.user_id=au.user_id
               and NVL(inc.customer_product_id,0)=0
               and inc.inventory_item_id=a.inventory_item_id
               and inc.org_id=a.organization_id);     --sr item
Line: 1193

select csm_mtl_system_items_acc_s.NEXTVAL,item_id,msi.org_id,au.user_id
from  (select item_id,org_id from
	   (select inventory_item_id as item_id,
               nvl(receiving_inventory_org_id,issuing_inventory_org_id) as org_id,
                sum(quantity) tot from csf_debrief_lines b
	    where transaction_type_id in (select transaction_type_id
                                      from cs_transaction_types_b
                                      where line_order_category_code='RETURN')
		and inventory_item_id is not null
        and nvl(receiving_inventory_org_id,issuing_inventory_org_id) is not null
	    and b.lasT_update_date > b_ret_acty_date
	    group by inventory_item_id ,nvl(receiving_inventory_org_id,issuing_inventory_org_id)
	    order by tot desc)
	   where rownum <= b_max_mtl_items)  msi,
	   asg_user au
where not exists(select 1 from csm_mtl_system_items_acc
                 WHERE msi.item_id = inventory_item_id
                 AND   msi.org_id   = organization_id
		         AND   user_id =au.user_id);
Line: 1214

SELECT acc.access_id, acc.user_id
FROM   csm_mtl_system_items_acc acc, mtl_system_items_b msi
WHERE  msi.inventory_item_id = acc.inventory_item_id
AND    msi.organization_id   = acc.organization_id
AND    EXISTS(SELECT 1 FROM ASG_USER au WHERE AU.USER_ID=acc.USER_ID and NVL(MULTI_PLATFORM,'N')='Y')
AND    acc.CREATION_DATE <=p_run_date
AND    msi.last_update_date > p_run_date;
Line: 1234

   SELECT RESPONSIBILITY_ID INTO l_respId FROM FND_RESPONSIBILITY WHERE RESPONSIBILITY_KEY='OMFS_PALM';
Line: 1245

		   l_tab_access_id.DELETE;
Line: 1246

		   l_tab_user_id.DELETE;
Line: 1250

			   CSM_UTIL_PKG.LOG('Bulk deleted ' || l_tab_access_id.count || ' records from csm_mtl_system_items_acc','CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.process_htm5_user_items',FND_LOG.LEVEL_EVENT);
Line: 1261

					DELETE FROM csm_mtl_system_items_acc WHERE access_id = l_tab_access_id(i);
Line: 1271

	   l_tab_access_id.DELETE;
Line: 1272

	   l_tab_user_id.DELETE;
Line: 1275

			CSM_UTIL_PKG.LOG('Bulk updated ' || l_tab_access_id.count || ' records from csm_mtl_system_items_acc' ,'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.process_htm5_user_items',FND_LOG.LEVEL_EVENT);
Line: 1293

			l_tab_access_id.DELETE;
Line: 1294

			l_inventory_item_id_tbl.DELETE;
Line: 1295

			l_organization_id_tbl.DELETE;
Line: 1296

			l_tab_user_id.DELETE;
Line: 1302

			CSM_UTIL_PKG.LOG('Bulk inserted ' || l_tab_access_id.count || ' records into csm_mtl_system_items_acc ' ,
								 'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG.process_htm5_user_items',FND_LOG.LEVEL_EVENT);
Line: 1306

			   INSERT INTO csm_mtl_system_items_acc(access_id, user_id, inventory_item_id, organization_id, counter,
						   created_by, creation_date, last_updated_by, last_update_date, last_update_login)
					VALUES (l_tab_access_id(i), l_tab_user_id(i), l_inventory_item_id_tbl(i), l_organization_id_tbl(i), 1,
						   fnd_global.user_id, sysdate, fnd_global.user_id, sysdate, fnd_global.login_id);
Line: 1333

l_prog_update_date      jtm_con_request_data.last_run_date%TYPE;
Line: 1347

SELECT NVL(last_run_date, TO_DATE('1','J'))
FROM jtm_con_request_data
WHERE package_name = 'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG'
AND procedure_name = 'REFRESH_MTL_SYSTEM_ITEMS_ACC';
Line: 1360

 FETCH l_last_run_date_csr INTO l_prog_update_date;
Line: 1363

 process_htm5_user_items(l_prog_update_date);
Line: 1368

 select count(*) into l_num_non_multi_users
 from asg_user
 where enabled = 'Y'
 and nvl(multi_platform,'N') = 'N';
Line: 1375

     update_mtl_system_items(p_last_run_date => l_prog_update_date);
Line: 1396

                     p_last_run_date=>l_prog_update_date);
Line: 1405

 UPDATE jtm_con_request_data
 SET last_run_date = l_run_date
 WHERE package_name = 'CSM_MTL_SYSTEM_ITEMS_EVENT_PKG'
 AND procedure_name = 'REFRESH_MTL_SYSTEM_ITEMS_ACC';
Line: 1453

 insert_mtl_system_items(p_user_id=>p_user_id,
                         p_organization_id=>p_organization_id,
                         p_category_set_id=>p_category_set_id,
                         p_category_id=>p_category_id,
                         p_last_run_date=>NULL,
                         p_changed=>l_changed); -- new user, no profiles are changed
Line: 1485

     CSM_ACC_PKG.Insert_Acc
    ( P_PUBLICATION_ITEM_NAMES => g_mtl_sys_items_pubi_name
     ,P_ACC_TABLE_NAME         => g_mtl_sys_items_acc_table_name
     ,P_SEQ_NAME               => g_mtl_sys_items_seq_name
     ,P_PK1_NAME               => g_mtl_sys_items_pk1_name
     ,P_PK1_NUM_VALUE          => p_inventory_item_id
     ,P_PK2_NAME               => g_mtl_sys_items_pk2_name
     ,P_PK2_NUM_VALUE          => p_organization_id
     ,P_USER_ID                => p_user_id
    );
Line: 1521

    CSM_ACC_PKG.Delete_Acc
   ( P_PUBLICATION_ITEM_NAMES => g_mtl_sys_items_pubi_name
   ,P_ACC_TABLE_NAME         => g_mtl_sys_items_acc_table_name
   ,P_PK1_NAME               => g_mtl_sys_items_pk1_name
   ,P_PK1_NUM_VALUE          => p_inventory_item_id
   ,P_PK2_NAME               => g_mtl_sys_items_pk2_name
   ,P_PK2_NUM_VALUE          => p_organization_id
   ,P_USER_ID                => p_user_id
   );