Sunday, January 26, 2020

how to remove table lock


 
STEP 1:  get  the SID for the table which have lock.
select
   session_id
from
   dba_dml_locks
where
   name = 'table';


output


SID
----
450


STEP 2:  find the Serial# for the table row lock :


select
   sid,
   serial#
from
   v$session
where
   sid in (
   select
      session_id
   from
      dba_dml_locks
   where
      name = 'table');


Output :
SID SERIAL#
---- -------
 450 18341


STEP 3:  Finally "alter system" command to kill the session that is holding the table lock:


alter system kill session 'SID,SERIALl#';
  alter system kill session '450,18341'

Saturday, January 18, 2020

item on hand qty query

/* Formatted on 2020/01/18 15:54 (Formatter Plus v4.8.8) */
SELECT   subinventory_code, item.segment1 item_code,
         item.description item_description, SUM (on_hand.on_hand) on_hand
    FROM apps.mtl_system_items_b item, apps.mtl_onhand_total_mwb_v on_hand
   WHERE item.organization_id = 130                                   --ORG ID
     AND item.inventory_item_id = on_hand.inventory_item_id
     --AND on_hand.subinventory_code = 'zzz'  --sub inventory
     AND item.segment1 IN
                         ('TCPGPGBG00025032', 'TCPGPGBG00500046') ---item name
GROUP BY item.segment1, item.description, subinventory_code;

sale order back to back query


SELECT   hou.NAME ORGANIZATION, hp_ship.party_name customer,
         oh.cust_po_number customer_number, hca.account_number,
         oh.order_number so_no, ot.NAME order_type, oh.ordered_date so_date,
         oh.flow_status_code status, msib.segment1 item, msib.description,
         ordered_quantity, ship_to.LOCATION ship_to_location,
         ship_loc.address1 ship_to_address1,
         ship_loc.address2 ship_to_address2,
         ship_loc.address3 ship_to_address3,
         ship_loc.address4 ship_to_address4,
            DECODE (ship_loc.city,
                    NULL, NULL,
                    ship_loc.city || ', '
                   )
         || DECODE (ship_loc.state,
                    NULL, ship_loc.province || ', ',
                    ship_loc.state || ', '
                   )
         || DECODE (ship_loc.postal_code,
                    NULL, NULL,
                    ship_loc.postal_code || ', '
                   )
         || DECODE (ship_loc.country, NULL, NULL, ship_loc.country)
                                                             ship_to_address5,
         ship_to.LOCATION bill_to_location,
         bill_loc.address1 bill_to_address1,
         bill_loc.address2 bill_to_address2,
         bill_loc.address3 bill_to_address3,
         bill_loc.address4 bill_to_address4,
            DECODE (bill_loc.city,
                    NULL, NULL,
                    bill_loc.city || ', '
                   )
         || DECODE (bill_loc.state,
                    NULL, bill_loc.province || ', ',
                    bill_loc.state || ', '
                   )
         || DECODE (bill_loc.postal_code,
                    NULL, NULL,
                    bill_loc.postal_code || ', '
                   )
         || DECODE (bill_loc.country, NULL, NULL, bill_loc.country)
                                                             bill_to_address5,
         bill_to.LOCATION bill_to_location,
         ship_loc.address1 bill_to_address1,
         ship_loc.address2 bill_to_address2,
         ship_loc.address3 bill_to_address3,
         ship_loc.address4 bill_to_address4,
            DECODE (ship_loc.city,
                    NULL, NULL,
                    ship_loc.city || ', '
                   )
         || DECODE (ship_loc.state,
                    NULL, ship_loc.province || ', ',
                    ship_loc.state || ', '
                   )
         || DECODE (ship_loc.postal_code,
                    NULL, NULL,
                    ship_loc.postal_code || ', '
                   )
         || DECODE (ship_loc.country, NULL, NULL, ship_loc.country)
                                                             bill_to_address5,
         bill_to.LOCATION bill_to_location,
         bill_loc.address1 bill_to_address1,
         bill_loc.address2 bill_to_address2,
         bill_loc.address3 bill_to_address3,
         bill_loc.address4 bill_to_address4,
            DECODE (bill_loc.city,
                    NULL, NULL,
                    bill_loc.city || ', '
                   )
         || DECODE (bill_loc.state,
                    NULL, bill_loc.province || ', ',
                    bill_loc.state || ', '
                   )
         || DECODE (bill_loc.postal_code,
                    NULL, NULL,
                    bill_loc.postal_code || ', '
                   )
         || DECODE (bill_loc.country, NULL, NULL, bill_loc.country)
                                                             bill_to_address5
    FROM apps.oe_order_headers_all oh,
         apps.oe_order_lines_all ol,
         apps.hr_operating_units hou,
         apps.oe_transaction_types_tl ot,
         apps.mtl_system_items_b msib,
         apps.hz_cust_accounts_all hca,                                      --
         apps.hz_parties hp_ship,
         apps.hz_cust_site_uses_all ship_to,
         apps.hz_cust_acct_sites_all ship_cu,
         apps.hz_party_sites ship_ps,
         apps.hz_locations ship_loc,
         apps.hz_parties hp_bill,
         apps.hz_cust_site_uses_all bill_to,
         apps.hz_cust_acct_sites_all bill_cu,
         apps.hz_party_sites bill_ps,
         apps.hz_locations bill_loc
   WHERE 1 = 1
     AND source_type_code = 'EXTERNAL'
     AND oh.header_id = ol.header_id
     AND hou.organization_id = oh.org_id
     AND oh.sold_to_org_id = hca.cust_account_id
     AND hca.party_id = hp_ship.party_id
     AND ship_to.site_use_id = oh.ship_to_org_id
     AND ship_to.site_use_code = 'SHIP_TO'
     AND ship_to.cust_acct_site_id = ship_cu.cust_acct_site_id
     AND ship_ps.party_site_id = ship_cu.party_site_id
     AND ship_loc.location_id = ship_ps.location_id
     AND ot.transaction_type_id = oh.order_type_id
     AND ol.ordered_item = msib.segment1
     AND oh.ship_from_org_id = msib.organization_id
     -------
     AND hca.party_id = hp_bill.party_id
     AND bill_to.site_use_id = oh.invoice_to_org_id
     AND bill_to.site_use_code = 'BILL_TO'
     AND bill_to.cust_acct_site_id = bill_cu.cust_acct_site_id
     AND bill_ps.party_site_id = bill_cu.party_site_id
     AND bill_loc.location_id = bill_ps.location_id
ORDER BY oh.ordered_date DESC

finding location of rdf in server



SELECT APPLICATION_NAME,'$'||BASEPATH||'/'||'reports/US' Reports_Path,EXECUTION_FILE_NAME FROM APPS.FND_EXECUTABLES_VL A, APPS.FND_APPLICATION_VL B WHERE EXECUTION_METHOD_CODE='P' AND A.APPLICATION_ID=B.APPLICATION_ID AND EXECUTION_FILE_NAME like '%&RDF_NAME%'

Friday, January 17, 2020

Query to list all Form Personalizations oracle apps


 SELECT ffv.form_id                 ,
  ffv.form_name                     ,
  ffv.user_form_name                ,
  ffv.description "Form Description",
  ffcr.sequence                     ,
  ffcr.description "Personalization Rule Name"
   FROM fnd_form_vl ffv,
  fnd_form_custom_rules ffcr
  WHERE ffv.form_name = ffcr.form_name
ORDER BY ffv.form_name,
  ffcr.sequence;
 
 
 SELECT * FROM fnd_form_custom_rules;

Thursday, January 16, 2020

Oracle E-Business Form Not Launching(EBS Form Not Opening)


Oracle E-Business Form Not Launching(EBS Form Not Opening)

Download the latest Java JRE File

Download Link :




If You Get the following problems when opening the form
Oracle Forms – The application’s digital signature has an error – Your forms application is Frozen

https://oracleformsinfo.files.wordpress.com/2012/02/warning.jpg?w=300

Solution:
Go into the control panel and right-click on the java icon.

Go to ‘Advanced’  tab then open the ‘JAVA plugin’ branch on the tree
UNCHECK   ‘Enable the next-generation Java Plug-in(requires browser restart)’
Click Apply
Then click OK.
Then make sure ALL browser windows have been closed. You should also check in the control panel that no extra iexplore.exe processes are open and kill the program or “ORACLE FUSION FORMS … ”  if it exists. Then when you run the forms again your browser will reload this page and popup the warning message again, this time you should be able to select the checkbox and accept the security warning. Once accepted the warning should

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL26qsU6o37HcW6L-XTSONwJHfhylzSzTNhb0Rf3jH6KhjXcYmPYbZ4ocJfy3QxfolVKE9zCv1Xdg1rQsz83ROgOWgNtWpDMeiPYsssERNc3NMYU0Jnt15c0TXTFUR8dJlEmSCESGcROWm/s320/veri.jpg


Monday, January 13, 2020

Bom Components end date api (BOM Update)

CREATE TABLE PURE_BOM_UPDATE_STG
(
  ORGANIZATION_NAME      VARCHAR2(100 BYTE),
  BOM_CODE               VARCHAR2(200 BYTE),
  BOM_DESCRIPTION        VARCHAR2(500 BYTE),
  ALTERNATIVE_BOM        VARCHAR2(100 BYTE),
  COMPONENT_CODE         VARCHAR2(250 BYTE),
  COMPONENT_DESCRIPTION  VARCHAR2(500 BYTE),
  OPERATION_SEQ_NUM      NUMBER,
  ITEM_SEQUENCE          NUMBER,
  COMPONENT_QUANTITY     NUMBER,
  SUPPLY_SUBINVENTORY    VARCHAR2(500 BYTE),
  STATUS_MESSAGE         VARCHAR2(3000 BYTE),
  STATUS_FLAG            VARCHAR2(10 BYTE),
  PROCESS_FLAG           VARCHAR2(10 BYTE)
)


CREATE OR REPLACE PROCEDURE pure_bom_update_api
IS
---DECLARE
   l_bom_header_rec             bom_bo_pub.bom_head_rec_type
                                          := bom_bo_pub.g_miss_bom_header_rec;
   l_bom_revision_tbl           bom_bo_pub.bom_revision_tbl_type
                                        := bom_bo_pub.g_miss_bom_revision_tbl;
   l_bom_component_tbl          bom_bo_pub.bom_comps_tbl_type
                                       := bom_bo_pub.g_miss_bom_component_tbl;
   l_bom_ref_designator_tbl     bom_bo_pub.bom_ref_designator_tbl_type
                                  := bom_bo_pub.g_miss_bom_ref_designator_tbl;
   l_bom_sub_component_tbl      bom_bo_pub.bom_sub_component_tbl_type
                                   := bom_bo_pub.g_miss_bom_sub_component_tbl;
   l_error_message_list         error_handler.error_tbl_type;
   l_x_bom_header_rec           bom_bo_pub.bom_head_rec_type;
   l_x_bom_revision_tbl         bom_bo_pub.bom_revision_tbl_type;
   l_x_bom_component_tbl        bom_bo_pub.bom_comps_tbl_type;
   l_x_bom_ref_designator_tbl   bom_bo_pub.bom_ref_designator_tbl_type;
   l_x_bom_sub_component_tbl    bom_bo_pub.bom_sub_component_tbl_type;
   l_x_return_status            VARCHAR2 (2000);
   l_x_msg_count                NUMBER;
   i                            NUMBER                                 := 1;
   l_count                      NUMBER;
   l_status_flag                VARCHAR2 (10)                         := NULL;
   l_error_message              VARCHAR2 (20000)                      := NULL;
   l_process_flag               VARCHAR2 (10);
   l_organization_id            NUMBER;
   l_start_eff_date             DATE;
   l_user_id                    NUMBER                                 := -1;
   l_resp_id                    NUMBER                                 := -1;
   l_application_id             NUMBER                                 := -1;
   l_user_name                  VARCHAR2 (1000)                     := 'PURE';
   l_resp_name                  VARCHAR2 (1000)                 := 'PURE_BOM';
   l_error_table                error_handler.error_tbl_type;
   l_return_status              VARCHAR2 (10)                         := NULL;
   l_msg_count                  NUMBER                                 := 0;
   l_assembly_item_id           NUMBER                                := NULL;
   l_organization_code          VARCHAR2 (100)                        := NULL;
   l_component_item_id          NUMBER                                := NULL;
   l_wip_supply_type            VARCHAR2 (50)                         := NULL;
   ---NUMBER;
   l_dis_date                   DATE;
   l_bill_sequence_id           NUMBER                                := NULL;

   CURSOR c_process
   IS
      SELECT   cust.process_flag, ood.organization_code,
               ood.organization_name, ood.organization_id,
               bom.assembly_item_id, msi.segment1 bom_code, msi.description,
               bic.item_num, bic.operation_seq_num, bic.component_item_id,
               msi1.segment1 component_code, ml.meaning supply_type,
               bic.wip_supply_type, bic.effectivity_date, bic.disable_date,
               cust.alternative_bom
          FROM mtl_system_items_b msi,
               org_organization_definitions ood,
               bom_bill_of_materials bom,
               bom_inventory_components bic,
               mtl_system_items_b msi1,
               mfg_lookups ml,
               pure_bom_update_stg cust
         WHERE bom.assembly_item_id = msi.inventory_item_id
           AND bom.bill_sequence_id = bic.bill_sequence_id
           AND msi.organization_id = ood.organization_id
           AND bom.organization_id = ood.organization_id
           AND msi1.inventory_item_status_code = 'Active'
           AND bic.component_item_id = msi1.inventory_item_id
           AND msi1.organization_id = ood.organization_id
           AND ml.lookup_code(+) = bic.wip_supply_type
           AND ml.lookup_type(+) = 'WIP_SUPPLY'
           AND ood.organization_name = cust.organization_name
           AND msi.segment1 = cust.bom_code
           AND msi1.segment1 = cust.component_code
           AND bic.operation_seq_num = cust.operation_seq_num
           AND item_sequence = item_num
           AND NVL (bom.alternate_bom_designator, 'x') =
                                               NVL (cust.alternative_bom, 'x')
           ---AND cust.status_flag <> 'C'
           AND cust.bom_code IN
                ('MGCRHDBR00200020', 'MGCRHDBR00200045', 'MGCRHDCN00001008')
      ORDER BY bom_code ASC;
-- AND process_flag NOT IN ('C', NULL);
BEGIN
   DBMS_OUTPUT.ENABLE (1000000);

   SELECT user_id
     INTO l_user_id
     FROM fnd_user
    WHERE user_name = l_user_name;

   -- Get the application_id and responsibility_id
   SELECT application_id, responsibility_id
     INTO l_application_id, l_resp_id
     FROM fnd_responsibility
    WHERE responsibility_key = l_resp_name;

   -- intiialize applications information
   fnd_global.apps_initialize (l_user_id, l_resp_id, l_application_id);
  --- i := 0;

   FOR j IN c_process
   LOOP
      i := 1;
      l_error_message := NULL;                           --- startt C_PROCESS

      IF j.disable_date IS NOT NULL
      THEN
         UPDATE pure_bom_update_stg
            SET status_flag = 'C',                       ---l_x_return_status,
                status_message = 'Already end dated ',
                process_flag = 'C'
          WHERE organization_name = j.organization_name
            AND bom_code = j.bom_code
            AND component_code = j.component_code
            AND operation_seq_num = j.operation_seq_num
            AND item_sequence = j.item_num;

         ---dbms_output.put_line(disabled component )||;
         COMMIT;
      END IF;

--      BEGIN
--         SELECT COUNT (*)
--           INTO l_count
--           FROM bom_inventory_components
--          WHERE component_item_id = j.component_item_id
--            ---and ORGANIZATION_ID=j.ORGANIZATION_ID
--            AND item_num = j.item_num
--            AND operation_seq_num = j.operation_seq_num;

      --         IF l_count =0
--         THEN
--            UPDATE pure_bom_update_stg
--               SET status_flag = 'E',                    ---l_x_return_status,
--                   status_message = 'Component doesnot exist ',
--                   process_flag = 'I'
--             WHERE organization_name = j.organization_name
--               AND bom_code = j.bom_code
--               AND component_code = j.component_code
--               AND operation_seq_num = j.operation_seq_num
--               AND item_sequence = j.item_num;

      --            COMMIT;
--         END IF;
--      END;
      DBMS_OUTPUT.put_line ('l_start_eff_date ' || l_start_eff_date);
      DBMS_OUTPUT.put_line ('j.wip_supply_type ' || l_wip_supply_type);
      l_bom_component_tbl (i) := bom_bo_pub.g_miss_bom_component_rec;
      l_bom_component_tbl (i).transaction_type := 'UPDATE';
      l_bom_component_tbl (i).organization_code := j.organization_code;
      l_bom_component_tbl (i).assembly_item_name := j.bom_code;
      l_bom_component_tbl (i).start_effective_date := j.effectivity_date;
      --- TO_DATE (j.effectivity_date, 'DD-MON-YYYY HH24:MI:SS');
      l_bom_component_tbl (i).disable_date := SYSDATE;
      --- TO_DATE (SYSDATE, 'DD-MON-YYYY HH24:MI:SS');
      l_bom_component_tbl (i).component_item_name := j.component_code;
      l_bom_component_tbl (i).item_sequence_number := j.item_num;
      l_bom_component_tbl (i).operation_sequence_number := j.operation_seq_num;
      l_bom_component_tbl (i).return_status := NULL;
      l_bom_component_tbl (i).wip_supply_type := j.wip_supply_type;
      --- j.supply_type;
      l_bom_component_tbl (i).alternate_bom_code :=
                                                 NVL (j.alternative_bom, NULL);

      IF j.disable_date IS NULL
      THEN
         BEGIN
            DBMS_OUTPUT.put_line ('Calling API...');
            DBMS_OUTPUT.put_line (' j.organization_code'
                                  || l_organization_code
                                 );
            DBMS_OUTPUT.put_line (' j.bom_code' || j.bom_code);
            DBMS_OUTPUT.put_line (' l_start_eff_date' || j.effectivity_date);
            DBMS_OUTPUT.put_line (' j.component_code ' || j.component_code);
            DBMS_OUTPUT.put_line (' j.item_sequence' || j.item_num);
            DBMS_OUTPUT.put_line (' j.operation_seq_num'
                                  || j.operation_seq_num
                                 );
            DBMS_OUTPUT.put_line (' wip_supply_type' || j.wip_supply_type);
        --- IF j.disable_date IS NOT NULL
      ---THEN
---bms_output.put_line(' j.bom_code' || j.bom_code);
            DBMS_OUTPUT.put_line ('Line count....' || i || j.bom_code);
            error_handler.initialize;
            bom_bo_pub.process_bom
                      (p_bo_identifier               => 'BOM',
                       p_api_version_number          => 1.0,
                       p_init_msg_list               => TRUE,
                       p_bom_header_rec              => l_bom_header_rec,
                       p_bom_revision_tbl            => l_bom_revision_tbl,
                       p_bom_component_tbl           => l_bom_component_tbl,
                       p_bom_ref_designator_tbl      => l_bom_ref_designator_tbl,
                       p_bom_sub_component_tbl       => l_bom_sub_component_tbl,
                       x_bom_header_rec              => l_x_bom_header_rec,
                       x_bom_revision_tbl            => l_x_bom_revision_tbl,
                       x_bom_component_tbl           => l_x_bom_component_tbl,
                       x_bom_ref_designator_tbl      => l_x_bom_ref_designator_tbl,
                       x_bom_sub_component_tbl       => l_x_bom_sub_component_tbl,
                       x_return_status               => l_x_return_status,
                       x_msg_count                   => l_x_msg_count,
                       p_debug                       => 'N',
                       p_output_dir                  => '',
                       p_debug_filename              => ''
                      );
            COMMIT;
         EXCEPTION
            WHEN OTHERS
            THEN
               l_error_message :=
                      l_error_message || 'Error after processing ' || SQLERRM;

               ----- DBMS_OUTPUT.put_line ('1' || l_error_message);
               UPDATE pure_bom_update_stg
                  SET status_flag = 'E',                 ---l_x_return_status,
                      status_message = l_error_message,
                      process_flag = 'I'
                WHERE organization_name = j.organization_name
                  AND bom_code = j.bom_code
                  AND component_code = j.component_code
                  AND operation_seq_num = j.operation_seq_num
                  AND item_sequence = j.item_num;

               --AND ROWID = j.ROWID;
               COMMIT;
         END;
      END IF;

      error_handler.get_message_list (l_error_message_list);
 
      DBMS_OUTPUT.put_line ('Return Status = ' || l_x_return_status);
      DBMS_OUTPUT.put_line ('Message Count = ' || l_x_msg_count);

      IF l_x_return_status <> 'S'
      THEN
         ----DBMS_OUTPUT.put_line ('3' || l_error_message);
         FOR k IN 1 .. l_x_msg_count
         LOOP
            ----- DBMS_OUTPUT.put_line ('4' || l_error_message);
            DBMS_OUTPUT.put_line
                               (   TO_CHAR (k)
                                || ' MESSAGE TEXT '
                                || SUBSTR
                                        (l_error_message_list (k).MESSAGE_TEXT,
                                         1,
                                         250
                                        )
                               );
            DBMS_OUTPUT.put_line (   TO_CHAR (k)
                                  || ' MESSAGE TYPE '
                                  || l_error_message_list (k).MESSAGE_TYPE
                                 );
            l_error_message :=
                  l_error_message
               || TO_CHAR (k)
               || ' MESSAGE TEXT '
               || SUBSTR (l_error_message_list (k).MESSAGE_TEXT, 1, 250);
            ROLLBACK;

            UPDATE pure_bom_update_stg
               SET status_flag = l_x_return_status,
                   status_message = l_error_message,
                   process_flag = 'I'
             WHERE organization_name = j.organization_name
               AND bom_code = j.bom_code
               AND component_code = j.component_code
               AND operation_seq_num = j.operation_seq_num
               AND item_sequence = j.item_num;

            COMMIT;
         END LOOP;

         DBMS_OUTPUT.put_line (l_error_message);
      ELSE
         IF l_x_return_status = 'S'
         THEN
            UPDATE pure_bom_update_stg
               SET status_flag = 'C',                   ----l_x_return_status,
                   status_message = 'END DATED',
                   process_flag = 'C'
             WHERE organization_name = j.organization_name
               AND bom_code = j.bom_code
               AND component_code = j.component_code
               AND operation_seq_num = j.operation_seq_num
               AND item_sequence = j.item_num;
            COMMIT;
         END IF;
      END IF;

   END LOOP;                                                  ---END C_PROCESS
END;

SELECT 1
  FROM DUAL