Tag Archives: SQL

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’);

————————-

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);