Tag Archives: oracle sql script

SQL Script to find Concurrent program details with Path

5 Sep

SQL Script to find Concurrent program details with Path, program type, Executable details

SELECT fcp.concurrent_program_id
      ,fcp.concurrent_program_name 
      ,fcpt.user_concurrent_program_name usr_conc_program
      ,fcp.enabled_flag flag
      ,fcp.output_file_type output_TYPE
      ,fe.executable_name
      ,fcp.execution_method_code program_method_code
      ,(SELECT meaning FROM apps.fnd_lookup_values WHERE lookup_code = fcp.execution_method_code AND lookup_type = ‘CP_EXECUTION_METHOD_CODE’) prog_method
      ,fe.execution_method_code executable_method_code
      ,(SELECT meaning FROM apps.fnd_lookup_values WHERE lookup_code = fe.execution_method_code AND lookup_type = ‘CP_EXECUTION_METHOD_CODE’) exec_method
      ,fe.execution_file_name
      ,fa.application_short_name
      ,fat.application_name
      ,fa.basepath top
      ,(select value from apps.fnd_env_context where variable_name = fa.basepath and concurrent_process_id = (select max(concurrent_process_id) from apps.fnd_env_context)) ||’/reports/US’ path
      ,fcp.creation_date
      ,(select user_name||’ : ‘||description from apps.fnd_user where user_id = fcp.created_by) created_by
      ,fcp.last_update_date
      ,(select user_name||’ : ‘||description from apps.fnd_user where user_id = fcp.last_updated_by) updated_by
FROM apps.fnd_concurrent_programs_tl fcpt
    ,apps.fnd_concurrent_programs    fcp
    ,apps.fnd_executables            fe
    ,apps.fnd_application_tl         fat
    ,apps.fnd_application           fa

WHERE 1 = 1
and fcpt.application_id = fcp.application_id
and fcpt.concurrent_program_id = fcp.concurrent_program_id
and fe.executable_id = fcp.executable_id
and fe.application_id = fa.application_id
and fat.application_id = fa.application_id
AND fcp.enabled_flag = ‘Y’
and upper(fcpt.user_concurrent_program_name) = ‘&prog_name_upper_case’–like ‘%EVENT%’
;

Oracle Order Fulfilment: Back to Back Order

18 Nov
Back to Back(B2B) process is used for items that are not typically stocked nor manufactured. In an environment where lead times are often only a matter of 24 hours, the B2B process improves efficiency of the three steps above, by closely linking the Sales Order and the Purchase Order together.
The B2B process automates the creation of a supply order (PO) when a sales order is booked. The supply order is hard pegged (hard-reservation) to the sales order that it is supplying so that once the PO is received, the items are not inadvertently taken by another order or demand. Where the sales order line is within the process, can be visible at all times so that customer service inquiries can be answered. 
This process is also called Supply to Order.
1. Customer orders items (OM).
2. Purchase those items from the supplier (PO) and receive them into the warehouse.
3. Ship those items to the customer (OM).

Create a B2B Item

Go to Inventory > Items > Master Items and define the item as follows :
Enter item name and description.
From Tools > Copy From, apply the Purchased Item template.

 In the Purchasing tab, enter a value in the List Price field.

 In the General Planning tab, set the Make or Buy flag to Buy

 In the Work in Process tab, make sure the Build in WIP flag is checked

  In the Order Management tab, check the Assemble to Order flag (ATO).

Save, and assign to Organization M1

B2B item must be created at item validation org.
Same item in same item validation org cannot be both stock item and a B2B item

Define Sourcing rule for the item

Sourcing rules can be set up in PO to default sourcing information such as the supplier from which the item is purchased.

Assign the item to the price list

Back to Back Order Flow

Create Order

Go to OM > Orders, Returns > Sales Orders.

Create a sales order with Order Type Mixed and enter the B2B item created in previous step in the lines for any quantity.
Book the order. Note down the Order Number

 The line status will move to Supply Eligible (flow_status_code SUPPLY_ELIGIBLE).

Place cursor on the line and go to Actions > Progress Order > Select Create Supply Order – Eligible to progress the workflow of the line 

 

The line status will now show PO-ReqRequested/External Requisition Requested (flow_status_code PO_REQ_REQUESTED).

OM has inserted a record in the PO requisitions interface table.

Go to Purchasing > Reports > Run and run the concurrent program Requisition Import with the Import Source parameter = CTO. Leave the other parameters as default. The concurrent program can also be run from OM > Orders, Returns > Requisition Import.
Go to View > Requests and verify that the Requisition Import has completed successfully.

The line status of the sales order line will now show PO-ReqCreated/External Requisition Open (flow_status_code PO_REQ_CREATED)

From the sales order line, go to Tools > Scheduling > Reservation Details > ‘Supply’ tab. Verify that the order line is reserved against the requisition. Note down the requisition number seen in this window.

Go to Purchasing > Requisitions > Requisition Summary.

In the Find Requisitions window, enter requisition number found in the previous step and click on Find.
Verify that the status is Approved

Go to Purchasing > Autocreate.
From Edit > Clear > Record, clear any query criteria that may be defaulted like buyer, requester etc.
Enter requisition number and click Find.

  

Check the checkbox to the left of the line, and click on Automatic. Enter the Supplier and Supplier site such as the following and click on Create

 Once the PO created, enter the supplier and site details and once everything is OK, approve the PO

The line status of the sales order line will now show PO-Created/PO Open (flow_status_code PO_CREATED)

From the sales order line, go to Tools > Scheduling > Reservation Details > ‘Supply’ tab. Verify that the order line is reserved against the PO

Go to Purchasing > Receiving > Receipts.

Enter Purchase Order number and click on Find.
In the Receipts window, check the checkbox to the left of the line and enter and save the receipt

Go to Purchasing > Receiving > Receiving Transactions Summary.

Enter the Purchase Order number and click on Find.
Click on the Transactions button.
Verify a Receive and Delivery transaction. This means that the B2B item has been received into Inventory.

The line status of the sales order line will now show Awaiting Shipping (flow_status_code = AWAITING_SHIPPING).

On the sales order line, Tools > Scheduling > Reservation Details will now show that the item is reserved against Inventory in Subinventory = FGI (PO has been received in this subinventory).

The line can now be pick released, shipped and invoiced to the customer.
This completes the Back to Back Order workflow.

Useful queries

Once you progress the order after Supply Eligible step, use below query to find whether the data inserted to requisition interface or not

select * from po_requisitions_interface_all
where interface_source_line_id = &order_line_id
and interface_source_code = ‘CTO’;

SQL Script for getting the details of Inventory Org to Business Group

5 Oct

Below Script will help you to get the Inventory Org to Business Group details with Legal Entity, Operating Unit, Ledger, Period details, Inventory Validation org and Purchase Validation org for the Operating unit

This script is in the context of Oracle R12

——————-
select mp.organization_code org_code,
       org.organization_id org_id,
       org.name org_name,
       hl.location_id,
       hl.location_code,
       hl.address_line_1,
       hl.address_line_2,
       hl.address_line_3,
       hl.town_or_city,
       hl.country,
       hl.postal_code,
       ou.organization_id ou_id,
       ou.name OU,
       le.legal_entity_id le_id,
       le.name LE,
       gl.ledger_id,
       gl.name primary_ledger,
       gl.currency_code,
       bg.name bg,
       (select organization_code
          from apps.mtl_parameters
         where organization_id =
               (select parameter_value
                  from apps.OE_SYS_PARAMETERS_ALL
                 where parameter_code = ‘MASTER_ORGANIZATION_ID’
                   and org_id = ou.organization_id)) IVO,
       (select organization_code
          from apps.mtl_parameters
         where organization_id =
               (select inventory_organization_id
                  from AP.FINANCIALS_SYSTEM_PARAMS_ALL#
                 where org_id = ou.organization_id)) PVO,
       (select period_name || ‘ : ‘ || open_flag
          from apps.ORG_ACCT_PERIODS
         where period_start_date <= trunc(sysdate)
           and schedule_close_date >= trunc(sysdate)
           and organization_id = mp.organization_id) inv_period,
       (select period_name || ‘ : ‘ || show_status
          from apps.GL_PERIOD_STATUSES_V
         where start_date <= trunc(sysdate)
           and end_date >= trunc(sysdate)
           and ledger_id = gl.ledger_id
           and application_id = 101) gl_ledger_period,
       (select period_name || ‘ : ‘ || show_status
          from apps.GL_PERIOD_STATUSES_V
         where start_date <= trunc(sysdate)
           and end_date >= trunc(sysdate)
           and ledger_id = gl.ledger_id
           and application_id = 200) AP_period,
       (select period_name || ‘ : ‘ || show_status
          from apps.GL_PERIOD_STATUSES_V
         where start_date <= trunc(sysdate)
           and end_date >= trunc(sysdate)
           and ledger_id = gl.ledger_id
           and application_id = 222) AR_period,
       (select period_name || ‘ : ‘ || show_status
          from apps.GL_PERIOD_STATUSES_V
         where start_date <= trunc(sysdate)
           and end_date >= trunc(sysdate)
           and ledger_id = gl.ledger_id
           and application_id = 201) PO_period

  from apps.XLE_ENTITY_PROFILES         le,
       apps.HR_ALL_ORGANIZATION_UNITS   ou,
       apps.HR_ALL_ORGANIZATION_UNITS   org,
       apps.HR_ALL_ORGANIZATION_UNITS   bg,
       apps.mtl_parameters              mp,
       apps.GL_LEDGERS                  gl,
       apps.HR_ORGANIZATION_INFORMATION ouinfo,
       apps.HR_ORGANIZATION_INFORMATION orginfo,
       apps.hr_locations                hl
 where mp.organization_id = org.organization_id
   and org.organization_id = orginfo.organization_id
   and org.location_id = hl.location_id
   and orginfo.org_information_context = ‘Accounting Information’
   and orginfo.org_information3 = ou.organization_id
   and orginfo.org_information1 = gl.ledger_id
   and orginfo.org_information2 = le.legal_entity_id
   and ou.organization_id = ouinfo.organization_id
   and ouinfo.org_information_context = ‘Operating Unit Information’
   and ouinfo.org_information2 = le.legal_entity_id
   and ouinfo.org_information3 = gl.ledger_id
   and bg.organization_id = ou.business_group_id
   and mp.organization_code in (‘V1’);

————————-

Oracle Order Management Pick Release Process

19 Aug

Pick Release is the process of Picking the order for ship confirming.
This process includes 3 parts, Move Order creation and Move order Allocation and Move order transaction.

When you do a pick release, it will create a move order, as per the details you have provided in the picking process, it will allocate the move order from the satisfied subinventory, locator, lot, serial, LPN.
And as per the criteria (whether auto pick confirm is Yes or No), it will transact the move order as well.

So in Shipping transaction form, the flow will happen like this

1. Ready to Release: The order is booked and ready and you can run the pick release on this
2. Released to Warehouse: Once you did pick release and if the pick release successful, it will be changed to Released to warehouse. Also if no order satisfies the criteria what you have given, then the status will remain as it is. If Auto Pick confirm is set as Yes, this satus will never come and it will move to next status Satged/Pick released.
3. Backordered: If there is no satisfied source find during the process of pick release, delivery details will be back ordered.
4. Staged/Pick Confirmed: Once pick release process including pick confirm completes (depends on the Auto pick confirm flag), status will be changed to this.

Auto Pick Confirm flag under shipping tab

Mostly this flag was kept as No for Warehouse enabled Organizations, so that the physical pick and drop process can be done from the physical location through Paper based picking or task directed picking. When this flag is No, after pick release, the status in shipping transaction form will be released to warehouse and as per setup pick slip will be printed. Warehouse operator will do the Pick and Drop transaction using the data from the pick slip in MSCA.
Also even if it in not WMS enabled organization, still if you need to manually do the Move order transactions and if your business has some checks, then also you can keep the flag as No.
If the flag is set to Yes, during pick release, system will do the move order transaction as well and status in shipping transaction form will be staged/pick confirmed. Which means pick release is complete and order/delivery is ready for shipping.

Pick release can be done in different ways
Navigation:
Order Management –> Shipping –> Release Sales Order

Using Release Sales Orders form

Here you can enter all required parameter and release the orders either in concurrent or in online method.
In this method, you can pick release individual orders and restrict them with different parameters in the order tab.

In the Shipping tab, you can select how you want to handle the picking batch, whether you want to auto create delivery, whether you want to auto pick confirm, if you want to auto ship confirm the order from this form, also you can do so, if you select Auto pick confirm as Yes and using a ship confirm rule.
You can even restrict or specify certain other parameters like ship method and which sequence rule you want to use.

In the Inventory tab, you can specify from which warehouse, subinventory, locator you want to pick from and which subinventory and locator you want to stage in.
Also you can choose allocation method here whether inventory or cross-docking.
Here you can use business required predefined pick slip grouping rule as well to group the pick slips.

Using Release Sales Orders SRS

Pre-req for this process is to have your Pick release rule defined before hand (explained below).
Benefit of this method is, you can release multiple orders in one request just using a required release Rule name which satisfies your current business need which you have already defined in system.
Note: If you have many Release Rules defined for your business and you want them to be scheduled and executed one by one. You can consolidate all requests in one request set one by one and schedule that request set.

Define Release Rule Form:

Navigation:
Order Management –> Setup –> Shipping –> Picking –> Define Release Rule Form
Pick Release rule is nothing but the predefined pick release rule with all specific restrictions and attributes depending on your business needs.
This form is exactly like the Pick release form we discussed above. The same criteria, same restrictions can be used her as well. But here, you can define the rule, so that instead of manually selecting those criteria, every time, you can use the pre-defined release rule.
You can define multiple release rules with all set of parameters like for different customer, different item category, and all type of business requirements and use the same for Pick release from using the Form or Pick release through SRS.

Post pick Release and Debugging

Post Pick release execution, if any exception occurred, you can find those details in below table
select * from WSH_EXCEPTIONS;
Tables involved in pick release are below
You will be able to find the pick release batch details like what restrictions,, attributes used for the pick release.
SELECT * FROM WSH_PICKING_BATCHES;
Other tables involved here as well for delivery are
WSH_DELIVERY_DETAILS
WSH_DELIVERY_ASSIGNMENTS
WSH_NEW_DELIVERIES
If you want to check which release rules used for which order and what is the pick release batch for your sales order, you can use below script
——————————
SELECT wdd.source_header_number,
       oel.line_id,
       mp.organization_code,
       wpb.name,
       mtrl.creation_date,
       mtrl.last_update_date,
       mtrl.request_id mtl_req_id,
       wpb.request_id pick_batch_req_id,
       wdd.batch_id pick_batch_id,
       oel.ship_set_id,
       (select user_concurrent_program_name
          from apps.fnd_concurrent_programs_tl
         where concurrent_program_id =
               (select concurrent_program_id
                  from apps.fnd_concurrent_requests
                 where request_id = nvl(mtrl.request_id, wpb.request_id))) prog_name,
       decode((select concurrent_program_id
                from apps.fnd_concurrent_requests
               where request_id = nvl(mtrl.request_id, wpb.request_id)),
              1003890,
              (select PICKING_RULE_NAME
                 from apps.WSH_PICKING_RULES_V
                where picking_rule_id =
                      (select argument1
                         from apps.fnd_concurrent_requests
                        where request_id =
                              nvl(mtrl.request_id, wpb.request_id)))) rel_rule
  FROM apps.wsh_delivery_details  wdd,
       apps.mtl_txn_request_lines mtrl,
       apps.oe_order_lines_all    oel,
       apps.wsh_picking_batches   wpb,
       apps.mtl_parameters        mp
 WHERE wpb.batch_id = wdd.batch_id
   AND mtrl.line_id = wdd.move_order_line_id
   AND wdd.released_status IN (‘S’, ‘Y’, ‘C’)
   AND wdd.source_code = ‘OE’
   AND wdd.source_line_id = oel.line_id
   AND oel.line_id = &LINE_ID
   and oel.ship_from_org_id = mp.organization_id;
—————————————————————————

SQL Script to find Concurrent Request Details in Oracle

17 Jun
select req.request_id,
       req.argument_text,
       req.requested_start_date,
       req.actual_start_date,
       req.actual_completion_date,
      (select meaning
          from apps.fnd_lookup_values
         where lookup_type = ‘CP_STATUS_CODE’
           AND lookup_code = req.phase_code
           and start_date_active is not null) phase,
       (select meaning
          from apps.fnd_lookup_values
         where lookup_type = ‘CP_STATUS_CODE’
           AND lookup_code = req.status_code
           and start_date_active is not null) status,
       (usr.user_name || ‘ – ‘ || usr.DESCRIPTION) requested_by,
       fcpt.user_concurrent_program_name,
       (SELECT responsibility_name
          FROM apps.fnd_responsibility_tl
         WHERE responsibility_id = req.responsibility_id) resp,
       req.logfile_name,
       req.outfile_name
  from apps.fnd_concurrent_requests    req,
       apps.fnd_user                   usr,
       apps.fnd_concurrent_programs_tl fcpt,
       apps.fnd_concurrent_programs    fcp
 where req.concurrent_program_id = fcpt.concurrent_program_id
   and fcp.concurrent_program_id = fcpt.concurrent_program_id
   and usr.user_id = req.requested_by
   and req.request_id in (&req_id);

To Query Profile option details for any user or responsibility

2 May

SELECT FPO.PROFILE_OPTION_ID,
      FPO.PROFILE_OPTION_NAME,
      FPOT.USER_PROFILE_OPTION_NAME,
      FPOV.LEVEL_ID,
      DECODE(FPOV.LEVEL_ID,
             ‘10001’,
             ‘Site’,
             ‘10002’,
             ‘Appllication’,
             ‘10003’,
             ‘Responsibility’,
             ‘10004’,
             ‘User’,
             FPOV.LEVEL_ID) LEVEL_TYPE,
      FPOV.LEVEL_VALUE,
      DECODE(FPOV.LEVEL_ID,
             ‘10001’,
             ‘Site’,
             ‘10002’,
             (SELECT APPLICATION_NAME
                FROM APPS.FND_APPLICATION_TL
               WHERE APPLICATION_ID =FPOV.LEVEL_VALUE),
             ‘10003’,
             (SELECT RESPONSIBILITY_NAME
                FROM APPS.FND_RESPONSIBILITY_TL
               WHERE RESPONSIBILITY_ID =FPOV.LEVEL_VALUE),
             10004,
             (SELECT DESCRIPTION
                FROM APPS.FND_USER
               WHERE USER_ID = FPOV.LEVEL_VALUE),
             FPOV.LEVEL_ID) LEVEL_VALUE,
      FPOV.PROFILE_OPTION_VALUE,
      FPOV.LAST_UPDATE_DATE,
      FPO.SQL_VALIDATION,
      TRUNC(FPOV.LAST_UPDATE_DATE),
      (SELECT DESCRIPTION
         FROM APPS.FND_USER
        WHERE USER_ID = FPOV.LAST_UPDATED_BY)UPDATED_BY
 FROM APPS.FND_PROFILE_OPTIONS       FPO,
      APPS.FND_PROFILE_OPTION_VALUES FPOV,
      APPS.FND_PROFILE_OPTIONS_TL    FPOT
WHERE FPOV.PROFILE_OPTION_ID = FPO.PROFILE_OPTION_ID
  AND FPOT.PROFILE_OPTION_NAME =FPO.PROFILE_OPTION_NAME
  AND FPOV.LEVEL_VALUE =
      (SELECT USER_ID FROM FND_USER WHERE USER_NAMEIN (‘305030341’)) –for user
  /*AND (FPOV.LEVEL_ID = 10003 AND
      FPOV.LEVEL_VALUE IN
      (SELECT RESPONSIBILITY_ID
          FROM FND_RESPONSIBILITY_TL
         WHERE RESPONSIBILITY_NAME LIKE ‘%%’)) –for responsibility*/
  /*AND UPPER(FPOT.USER_PROFILE_OPTION_NAME) LIKE ‘%WMS%TCP%’ — for profile option*/