Thursday 15 July 2021

Oracle Webadi Tables?

BNE_INTEGRATORS_B à Integrator
BNE_LAYOUTS_B à Layout
BNE_LAYOUT_COLS à Layout Columns
BNE_MAPPINGS_B à Mapping
BNE_CONTENTS_B à Content
BNE_INTERFACES_B à Interface

Wednesday 14 July 2021

FNDLOAD Script for Webadi

Integrator
FNDLOAD apps/apps 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bneintegrator.lct XXXX_AP_INV_INT_XINTG.ldt BNE_INTEGRATORS INTEGRATOR_ASN=SQLAP INTEGRATOR_CODE=XXXX_AP_INV_INT_XINTG 

FNDLOAD apps/apps 0 Y UPLOAD $BNE_TOP/patch/115/import/bneintegrator.lct XXXX_AP_INV_INT_XINTG.ldt 

Layout
FNDLOAD apps/apps 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bnelay.lct XXXX_AR_INV_INT_LAYOUT.ldt BNE_LAYOUTS LAYOUT_ASN=SQLAP LAYOUT_CODE=XXXXAPINVINTERFACEINTEGRATOR 

FNDLOAD apps/apps 0 Y UPLOAD $BNE_TOP/patch/115/import/bnelay.lct XXXX_AP_INV_INT_LAYOUT.ldt 

Mapping
FNDLOAD apps/apps 0 Y DOWNLOAD $BNE_TOP/admin/import/bnemap.lct XXXX_APINV_IFACE_MAP.ldt BNE_MAPPINGS MAPPING_ASN="SQLAP" MAPPING_CODE="XXXX_APINV_IFACE_MAP"

FNDLOAD apps/apps 0 Y UPLOAD $BNE_TOP/patch/115/import/bnemap.lct XXXX_APINV_IFACE_MAP.ldt 

Content
FNDLOAD apps/apps 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bnecont.lct XXXX_AP_INV_INT_CNT2.ldt BNE_CONTENTS CONTENT_ASN=SQLAP CONTENT_CODE=XXXX_AP_INV_INT_CNT2 

FNDLOAD apps/apps 0 Y UPLOAD $BNE_TOP/patch/115/import/bnecont.lct XXXX_AP_INV_INT_CNT2.ldt 

Standard Concurrent program to import Service Contracts from Order Management?

Run “Service Contracts Order Processing” Program to import the service contract from order management. 

Service Contract tables?

OKC_K_HEADERS_ALL_B
OKS_K_HEADERS_ALL_B
OKC_K_LINES_B
OKC_K_ITEMS
OKC_K_REL_OBJS
OKS_BILL_TRANSACTIONS
OKS_BILL_TXN_LINES
OKS_BILL_CONT_LINES
OKS_BILL_SUB_LINES
OKS_BILL_CONT_LINES
OKS_LEVEL_ELEMENTS
CSI_ITEM_INSTANCES

Query to findout Workflow Listeners Status

          SELECT   DISTINCT fcq.concurrent_queue_id,
                           fcq.concurrent_queue_name,
                           fcq.user_concurrent_queue_name,
                           fsc.component_status
         FROM     apps.fnd_concurrent_queues_vl fcq,
                  fnd_svc_components fsc
         WHERE    fsc.concurrent_queue_id = fcq.concurrent_queue_id
         AND      fcq.concurrent_queue_name IN ('WFALSNRSVC',
                                                'WFMLRSVC',
                                                'WFWSSVC')
         ORDER BY fcq.concurrent_queue_id;

Script to Activate and Deactivate Oracle EBS Workflow Listeners

CREATE OR REPLACE PACKAGE apps.workflow_listener_pkg
AS
   PROCEDURE MAIN(p_errbuf    OUT VARCHAR2,
                  p_retcode   OUT VARCHAR2);
END workflow_listener_pkg;


CREATE OR REPLACE PACKAGE BODY apps.workflow_listener_pkg
AS
   PROCEDURE MAIN(p_errbuf    OUT VARCHAR2,
                  p_retcode   OUT VARCHAR2)
   IS
      ln_spid   NUMBER;
  ln_user_id             NUMBER := fnd_profile.VALUE('USER_ID');
      ln_responsibility_id   apps.fnd_responsibility.responsibility_id%TYPE := fnd_profile.VALUE('RESP_ID');
      ln_resp_appl_id        apps.fnd_responsibility.application_id%TYPE := fnd_profile.VALUE('RESP_APPL_ID');
  
      CURSOR cur_wfsrv
      IS
         SELECT   DISTINCT fcq.concurrent_queue_id,
                           fcq.concurrent_queue_name,
                           fcq.user_concurrent_queue_name
         FROM     apps.fnd_concurrent_queues_vl fcq,
                  fnd_svc_components fsc
         WHERE    fsc.concurrent_queue_id = fcq.concurrent_queue_id
         AND      fcq.concurrent_queue_name IN ('WFALSNRSVC',
                                                'WFMLRSVC')
         AND      fsc.component_status = 'STOPPED'
         AND      fsc.component_id NOT IN (10040,
                                           10042)
         ORDER BY fcq.concurrent_queue_id;
   BEGIN
      -- WFMLRSVC : Workflow Mailer Service
  -- WFALSNRSVC : Workflow Agent Listener Service
      -- WFWSSVC : Workflow Document Web Services Service
      fnd_file.put_line(fnd_file.LOG, 'Workflow Listeners Program start');
  
  fnd_file.put_line(fnd_file.LOG, 'ln_user_id:' || ln_user_id);
      fnd_file.put_line(fnd_file.LOG, 'ln_responsibility_id:' || ln_responsibility_id);
      fnd_file.put_line(fnd_file.LOG, 'ln_resp_appl_id:' || ln_resp_appl_id);
      fnd_global.apps_initialize(ln_user_id, ln_responsibility_id, ln_resp_appl_id);
  
      FOR rec_wfsrv IN cur_wfsrv
      LOOP
         fnd_file.put_line(fnd_file.LOG, 'loop start');
         fnd_file.put_line(fnd_file.LOG, 'user_concurrent_queue_name:' || rec_wfsrv.user_concurrent_queue_name);
         fnd_file.put_line(fnd_file.LOG, 'concurrent_queue_name:' || rec_wfsrv.concurrent_queue_name);
         ln_spid   := fnd_request.submit_svc_ctl_request(command => 'ACTIVATE', service => rec_wfsrv.concurrent_queue_name, service_app => 'FND');
         fnd_file.put_line(fnd_file.LOG, 'ln_spid:' || ln_spid);

         IF ln_spid = 0 THEN
            fnd_file.put_line(fnd_file.LOG, 'IF ln_spid = 0:' || fnd_message.get);
         END IF;

         fnd_file.put_line(fnd_file.LOG, 'loop end');
      END LOOP;
      fnd_file.put_line(fnd_file.LOG, 'Workflow Listeners Program end');
   EXCEPTION
      WHEN OTHERS THEN
         fnd_file.put_line(fnd_file.LOG, 'In Main Exception :' || SQLCODE || ' - ' || SQLERRM);
         p_retcode   := 2;
         p_errbuf    := SQLCODE || ' - ' || SQLERRM;
   END MAIN;
END workflow_listener_pkg;
/

Note:
For Activate
spid   := fnd_request.submit_svc_ctl_request(command => 'ACTIVATE', service => l_cqname, service_app => 'FND');

For Deactivate
spid   := fnd_request.submit_svc_ctl_request(command => 'DEACTIVATE', service => l_cqname, service_app => 'FND');

For Abort
spid   := fnd_request.submit_svc_ctl_request(command => 'ABORT', service => l_cqname, service_app => 'FND');

Tuesday 1 June 2021

How to convert single column into row in PL SQL

CREATE TABLE sale_records
(
   sale_id       NUMBER PRIMARY KEY,
   fiscal_year    NUMBER,
   quantity1      NUMBER,
   quantity2      NUMBER,
   quantity3      NUMBER
); 

INSERT INTO sale_records(sale_id, fiscal_year, quantity1, quantity2, quantity3)
VALUES(1,2019, NULL, 100, 200);
 
INSERT INTO sale_records(sale_id, fiscal_year, quantity1, quantity2, quantity3)
VALUES(2,2020, 350, NULL, 450);
 
INSERT INTO sale_records(sale_id, fiscal_year, quantity1, quantity2, quantity3)
VALUES(3,2021,  580, 680, NULL);

SELECT * FROM sale_records

Query output:
---------------- 
SALE_ID        FISCAL_YEAR          QUANTITY1  QUANTITY2            QUANTITY3
1                      2019                                                      100                             200
2                      2020                             350                                                      450
3                      2021                             580                   680      

SELECT * FROM sale_records
UNPIVOT INCLUDE NULLS(
    quantity_value
    FOR quantity
    IN (
        quantity1 AS 'quantity1',
        quantity2 AS 'quantity2',
        quantity3 AS 'quantity3'
    )
);

Query output:
----------------
SALE_ID        FISCAL_YEAR         QUANTITY            QUANTITY_VALUE
1                      2019                            quantity1        
1                      2019                            quantity2                 100
1                      2019                            quantity3                 200
2                      2020                            quantity1                 350
2                      2020                            quantity2        
2                      2020                            quantity3                 450
3                      2021                            quantity1                 580
3                      2021                            quantity2                 680
3                      2021                            quantity3

Monday 31 May 2021

How to convert multiple columns into row in PL SQL

 
CREATE TABLE sales_records
(
   sales_id       NUMBER PRIMARY KEY,
   fiscal_year    NUMBER,
   quantity1      NUMBER,
   quantity2      NUMBER,
   amount1        NUMBER,
   amount2        NUMBER
);

INSERT INTO sales_records(sales_id, fiscal_year, quantity1, quantity2, amount1, amount2)
VALUES(1, 2020, 100, 200, 1000, 2000);
 
INSERT INTO sales_records(sales_id, fiscal_year, quantity1, quantity2, amount1, amount2)
VALUES(2, 2021, 300, 400, 3000, 4000);

SELECT * FROM  sales_records


SALES_ID FISCAL_YEAR  QUANTITY1  QUANTITY2   AMOUNT1     AMOUNT2
1                 2020                     100                  200                    1000                2000
2                 2021                     300                  400                    3000                4000



SELECT sales_id, fiscal_year,rownumber,quantity, amount
FROM sales_records
UNPIVOT (
    (quantity, amount)
    FOR rownumber
    IN (
        (quantity1, amount1) AS '1',
        (quantity2, amount2) AS '2'       
    )
);

SALES_ID      FISCAL_YEAR         ROWNUMBER            QUANTITY    AMOUNT
1                      2020                            1                                      100                  1000
1                      2020                            2                                      200                  2000
2                      2021                            1                                      300                  3000
2                      2021                            2                                      400                  4000



 

How to convert comma separated values into column in PL SQL

SELECT     REGEXP_SUBSTR(:p_string,

                         '[^,]+',

                         1,

                         LEVEL)

              AS site

FROM       DUAL

CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(:p_string, '[^,]*')) + 1;

 


 

SELECT     REGEXP_SUBSTR('1001,1002,1003',

                         '[^,]+',

                         1,

                         LEVEL)

              AS site

FROM       DUAL

CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE('1001,1002,1003', '[^,]*')) + 1;

 


Thursday 15 April 2021

Differentiate ship set and arrival set?

In the ship set process, the user would like to ship group of order lines from same warehouse to same location. If Order Lines are grouped under ship set, then until all lines in the ship set satisfy the demand, you cannot ship the goods to customer.

In the arrival set process, the customer requests specific order lines to arrive together.

Sunday 11 April 2021

Move order Tables?

MTL_TXN_REQUEST_HEADERS
Move order headers, this stores the move order number in column (REQUEST_NUMBER). It has a status, but this is not used as much as the lines status to drive functionality.


MTL_TXN_REQUEST_LINES
Move order lines, this is the one that drives most queries and status checks for the move order as each line can be transacted individually.

 

MTL_MATERIAL_TRANSACTIONS_TEMP
Pending material transactions table also called the transaction temporary table, this holds allocations that act like reservations on inventory. An allocation is where you pick a specific item in inventory down to the lot, locator, serial, revision to move, but you do not actually perform. The move yet.

Field move_order_header_id and move_order_line_id provided in this table, which related to

MTL_TXN_REQUEST_HEADERS and MTL_TXN_REQUEST_LINES.


MTL_MATERIAL_TRANSACTIONS
This is the store of transact move order transactions. And there were some queries related with it.

 

For some additional notes:

When a move order is allocated, a corresponding record is inserted into the pending table (MTL_MATERIAL_TRANSACTIONS_TEMP as well as lot/serial tables if required).

 

When the move order is transacted, the record moves from the pending table to the history table (MTL_MATERIAL_TRANSACTIONS).


What is the difference between purchased and purchasable flag for an item?

 If both purchased and purchasable attribute are enabled, we can create new purchasing documents and approve and receive the items.

 

If purchased is enabled and purchasable is disabled, we cannot create purchasing documents and approve but we can receive the item against approved purchasing documents.

 

We can enable purchasable only when purchased is enabled.

Wednesday 24 February 2021

Query to find out Bill_To and Ship_To Customer from Contract

 SELECT   okh.org_id

       , okh.contract_number

       , okh.contract_number_modifier

       , okh.ship_to_site_use_id

       , ship_hps.party_site_number ship_to_site_number

       , ship_hcas.account_number ship_to_customer_number

       , okh.bill_to_site_use_id

       , bill_hps.party_site_number bill_to_site_number

       , bill_hcas.account_number bill_to_customer_number

    FROM okc_k_headers_all_b okh

       , hz_cust_site_uses_all ship_hcsua

       , hz_cust_acct_sites_all ship_hcasa

       , hz_party_sites ship_hps

       , hz_cust_accounts ship_hcas

       , hz_cust_site_uses_all bill_hcsua

       , hz_cust_acct_sites_all bill_hcasa

       , hz_party_sites bill_hps

       , hz_cust_accounts bill_hcas

   WHERE 1 = 1

     AND okh.contract_number = '11346850'

     AND ship_hcsua.site_use_code = 'SHIP_TO'

     AND okh.ship_to_site_use_id = ship_hcsua.site_use_id

     AND ship_hcasa.cust_acct_site_id = ship_hcsua.cust_acct_site_id

     AND ship_hcasa.party_site_id = ship_hps.party_site_id

     AND ship_hps.party_id = ship_hcas.party_id

     AND ship_hcas.cust_account_id = ship_hcasa.cust_account_id

     AND bill_hcsua.site_use_code = 'BILL_TO'

     AND okh.bill_to_site_use_id = bill_hcsua.site_use_id

     AND bill_hcasa.cust_acct_site_id = bill_hcsua.cust_acct_site_id

     AND bill_hcasa.party_site_id = bill_hps.party_site_id

     AND bill_hps.party_id = bill_hcas.party_id

     AND bill_hcas.cust_account_id = bill_hcasa.cust_account_id

     AND ship_hcasa.status = 'A'

     AND ship_hcsua.status = 'A'

     AND ship_hcas.status = 'A'

     AND ship_hps.status = 'A'

     AND bill_hcasa.status = 'A'

     AND bill_hcsua.status = 'A'

     AND bill_hcas.status = 'A'

     AND bill_hps.status = 'A'

     AND okh.org_id = 111

     AND okh.scs_code = 'SUBSCRIPTION'

     AND okh.sts_code = 'ACTIVE'

ORDER BY okh.last_update_date DESC

Friday 5 February 2021

How to call one Form to another Form in Oracle APPS

DECLARE
   other_params                  VARCHAR2 (255);
BEGIN
   other_params :=
           'p_param1='
        || NAME_IN ('OKS_HEADER.id')
        || '&'
        || 'p_param2='
        || 'SC';
   fnd_function.EXECUTE (function_name      => 'CONTRACT_ESTIMATION'--Function Name
                       , open_flag          => 'Y'
                       , session_flag       => 'N'
                       , other_params       => other_params
                        );
END;