Monday, November 14, 2016

HZ TABLES IN ORACLE RECEIVABLES

HZ_PARTIES:
The HZ_PARTIES table stores basic information about parties that can be shared with any relationship that the party might establish with another party. The primary key for this table is PARTY_ID.
Few Important Columns are
  • PARTY_ID: Party identifier
  • PARTY_NUMBER: Unique identification number for this party
  • PARTY_NAME: Name of the party
  • PARTY_TYPE: The party type can only be Person, Organization, Group or Relationship.
HZ_PARTY_SITES:
The HZ_PARTY_SITES table links a party (HZ_PARTIES) and a location (HZ_LOCATIONS) and stores location-specific party information. One party can optionally have one or more party sites. One location can optionally be used by one or more parties. The primary key for this table is PARTY_SITE_ID.
Few Important Columns are
  • PARTY_SITE_ID: Party site identifier.
  • PARTY_ID: Identifier for the party. Foreign key to the HZ_PARTIES table.
  • LOCATION_ID: Identifier for the party site. Foreign key to the HZ_LOCATIONS table.
  • PARTY_SITE_NUMBER: Party site number.
  • PARTY_SITE_NAME: User-defined name for the site.
  • ADDRESSEE: Addressee information.
HZ_LOCATIONS:
The HZ_LOCATIONS table stores information about a delivery or postal address such as building number, street address, postal code, and directions to a location. This table provides physical location information about parties (organizations and people) and customer accounts. The primary key for this table is LOCATION_ID.
Few Important Columns are
  • LOCATION_ID: Unique identifier for this location
  • COUNTRY: Country code from the TERRITORY_CODE column in the FND_TERRITORY table
  • ADDRESS1: First line for address
  • ADDRESS2: Second line for address
  • ADDRESS3: Third line for address
  • ADDRESS4: Fourth line for address
  • CITY: City
  • POSTAL_CODE: Postal Code
  • STATE: State
  • ADDRESS_KEY: Derived key that facilitates fuzzy searches
HZ_CUST_ACCOUNTS:
The HZ_CUST_ACCOUNTS table stores information about customer accounts , or business relationships that the deploying company establishes with a party of type Organization or Person. This table focuses on business relationships and how transactions are conducted in the relationship. Since a party can have multiple customer accounts, this table might contain several records for a single party. For example, an individual person can establish a personal account, family account, and a professional account for a consulting practice. The primary key for this table is CUST_ACCOUNT_ID.
Few Important Columns are
  • CUST_ACCOUNT_ID: Customer account identifier
  • PARTY_ID: A foreign key to the HZ_PARTY table.
  • ACCOUNT_NUMBER: Account Number
  • CUSTOMER_TYPE: Receivables lookup code for the CUSTOMER_TYPE attribute. I for internal customers, R for revenue generating external customers.
  • CUSTOMER_CLASS_CODE: Customer class identifier
HZ_CUST_ACCT_SITES_ALL:
The HZ_CUST_ACCT_SITES_ALL table stores all customer account sites across all operating units. Customer account sites are addresses, for customer accounts, where the deploying company does business with its customers. One customer account can have multiple customer account sites, and customer account sites for one customer account can belong to multiple operating units. The primary key for this table is CUST_ACCT_SITE_ID.
Few Important Columns are
  • CUST_ACCT_SITE_ID: Customer site identifier
  • CUST_ACCOUNT_ID: Identifier for a customer account. Foreign key to the HZ_CUST_ACCOUNTS table
  • PARTY_SITE_ID: Identifier for a party site. Foreign key to the HZ_PARTY_SITES table
  • BILL_TO_FLAG: Indicates if this is a Bill-To site.
  • SHIP_TO_FLAG: Indicates if this is a Ship-To site.
  • MARKET_FLAG: Indicates if this is a Marketing site.
HZ_CUST_SITE_USES_ALL:
The HZ_CUST_SITE_USES_ALL table stores business purposes assigned to customer account sites, for example Bill-To, Ship-To, and Statements. Each customer account site can have one or more purposes. This table is a child of the HZ_CUST_ACCT_SITES_ALL table, with the foreign
key CUST_ACCT_SITE_ID. The HZ_CUST_SITE_USES_ALL table also stores operating unit identifier, though the HZ_CUST_ACCT_SITES_ALL table itself stores the operating unit for customer account sites. The primary key for this table is SITE_USE_ID.
Few Important Columns are
  • SITE_USE_ID: Site use identifier
  • CUST_ACCT_SITE_ID: Identifier for the customer account site. Foreign key to the HZ_CUST_ACCT_SITES_ALL table
  • SITE_USE_CODE: Business purpose assigned to customer site account, such as Bill-To, Market, and Statements.
  • PRIMARY_FLAG: Indicates if this site is the primary site for this customer account. Y for the primary customer account site. N for other customer account sites.
HZ_CUSTOMER_PROFILES:
The HZ_CUSTOMER_PROFILES table stores information about the credit characteristics of a single customer account or a customer account site or a party. A profile class defined in the
HZ_CUSTOMER_PROFILE_CLASSES table can be used to provide default values for the attributes in this table. The primary key for this table is CUST_ACCOUNT_PROFILE_ID.
Few Important Columns are
  • CUST_ACCOUNT_PROFILE_ID: Unique identifier of this customer profile
  • CUST_ACCOUNT_ID: Identifier for the Customer Account. Foreign key to the HZ_CUST_ACCOUNTS table.
  • STATUS: Indicates whether the profile is active or inactive
HZ_CUST_PROFILE_CLASSES:
The HZ_CUST_PROFILE_CLASSES table stores information about the credit characteristics that are common across a group of customer accounts. The characteristics specified in this table can be used as default characteristics for similar customer accounts. The primary key for this table is PROFILE_CLASS_ID.
HZ_PARTY_RELATIONSHIPS:
The HZ_PARTY_RELATIONSHIPS table stores information about relationships between parties.

Realated Queries
-------------------
select distinct ra.address1, ra.address2, ra.address3, ra.address4, ra.city, ra.state,ra.postal_code, ras.location,ra.attribute1
from 
--oe_order_headers_all h, oe_order_lines_all l ,
ra_customers rc,RA_SITE_USES_ALL RAS,RA_addresses_all RA
where 
---h.open_flag='Y'
--and h.header_id=l.header_id
---and h.sold_to_org_id in ( select customer_id from ra_customers where customer_name like 'KMART%')
----and h.sold_to_org_id=rc.customer_id 
 RA.ADDRESS_ID = RAS.ADDRESS_ID 
AND RA.CUSTOMER_ID =rc.customer_id
--and location in('2676')
and customer_number=2022;



--------Customer address FOR R12----------------------------

select distinct loc.address1, loc.address2, loc.address3, loc.address4, loc.city, loc.state,loc.postal_code, hcsua.location,acct_site.attribute1
from ra_customers c, 
hz_party_sites party_site,
hz_locations loc,
hz_cust_acct_sites_all acct_site,
hz_cust_site_uses_all hcsua
where acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
and acct_site.cust_acct_site_id = hcsua.cust_acct_site_id
and acct_site.cust_account_id = c.customer_id
and c.customer_number='1218';

------------preferable

select  loc.address1, loc.address2, loc.address3, loc.address4, 
loc.city, loc.state,loc.postal_code, hcsua.location,acct_site.attribute1
from ra_customers c, 
hz_party_sites party_site,
hz_locations loc,
hz_cust_acct_sites_all acct_site,
hz_cust_site_uses_all hcsua
where acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
and acct_site.cust_acct_site_id = hcsua.cust_acct_site_id
and acct_site.cust_account_id = c.customer_id
and acct_site.status='A' 
--and  hcsua.location in ('288')
and c.customer_number='1757';
Relationship between the tables



Thursday, November 10, 2016

Query for Running sheduling,pending,on hold requests

SELECT   fcr.request_id,
         DECODE (fcr.phase_code,
                 'P', DECODE (fcr.hold_flag, 'Y', 'Inactive', fl_pend.meaning),
                 fl_pend.meaning
                ) phase,
         DECODE (fcr.phase_code,
                 'P', DECODE (fcr.hold_flag,
                              'Y', 'On Hold',
                              DECODE (SIGN (fcr.requested_start_date - SYSDATE),
                                      1, 'Scheduled',
                                      fl_stat.meaning
                                     )
                             ),
                 fl_stat.meaning
                ) status,
         fcpt.user_concurrent_program_name, fcr.increment_dates,
         fcr.resubmit_interval, fcr.resubmit_interval_unit_code,
         fcr.resubmit_interval_type_code, parent_request_id,
         fcr.requested_start_date, fu.user_name requested_by
    FROM fnd_concurrent_requests fcr,
         fnd_concurrent_programs_tl fcpt,
         fnd_lookups fl_pend,
         fnd_lookups fl_stat,
         fnd_user fu
   WHERE 1 = 1
     AND fcpt.concurrent_program_id = fcr.concurrent_program_id
     AND fcpt.LANGUAGE = USERENV ('LANG')
     AND fcr.phase_code = fl_pend.lookup_code
     AND fl_pend.lookup_type = 'CP_PHASE_CODE'
     AND fcr.status_code = fl_stat.lookup_code
     AND fl_stat.lookup_type = 'CP_STATUS_CODE'
     AND fl_pend.meaning != 'Completed'
     AND fu.user_id = fcr.requested_by
ORDER BY fcr.request_id DESC

Query to find the customer related information For Sales Order

SELECT ooh.order_number
     , hp_bill.party_name
     , hl_ship.address1 ||Decode(hl_ship.address2,NULL,'',chr(10))
      ||hl_ship.address2||Decode(hl_ship.address3,NULL,'',chr(10))
      ||hl_ship.address3||Decode(hl_ship.address4,NULL,'',chr(10))
      ||hl_ship.address4||Decode(hl_ship.city,NULL,'',chr(10))
      ||hl_ship.city    ||Decode(hl_ship.state,NULL,'',',')
      ||hl_ship.state   ||Decode(hl_ship.postal_code,'',',')
      ||hl_ship.postal_code ship_to_address
     , hl_bill.address1 ||Decode(hl_bill.address2,NULL,'',chr(10))
      ||hl_bill.address2||Decode(hl_bill.address3,NULL,'',chr(10))
      ||hl_bill.address3||Decode(hl_bill.address4,NULL,'',chr(10))
      ||hl_bill.address4||Decode(hl_bill.city,NULL,'',chr(10))
      ||hl_bill.city    ||Decode(hl_bill.state,NULL,'',',')
      ||hl_bill.state   ||Decode(hl_bill.postal_code,'',',')
      ||hl_bill.postal_code bill_to_address
     , ooh.transactional_curr_code currency_code
     , mp.organization_code
     , ooh.fob_point_code
     , ooh.freight_terms_code
     , ooh.cust_po_number
FROM   oe_order_headers_all ooh
     , hz_cust_site_uses_all hcs_ship
     , hz_cust_acct_sites_all hca_ship
     , hz_party_sites hps_ship
     , hz_parties hp_ship
     , hz_locations hl_ship
     , hz_cust_site_uses_all hcs_bill
     , hz_cust_acct_sites_all hca_bill
     , hz_party_sites hps_bill
     , hz_parties hp_bill
     , hz_locations hl_bill
     , mtl_parameters mp
WHERE  1 = 1
AND    header_id = :p_header_id
AND    ooh.ship_to_org_id = hcs_ship.site_use_id
AND    hcs_ship.cust_acct_site_id = hca_ship.cust_acct_site_id
AND    hca_ship.party_site_id = hps_ship.party_site_id
AND    hps_ship.party_id = hp_ship.party_id
AND    hps_ship.location_id = hl_ship.location_id
AND    ooh.invoice_to_org_id = hcs_bill.site_use_id
AND    hcs_bill.cust_acct_site_id = hca_bill.cust_acct_site_id
AND    hca_bill.party_site_id = hps_bill.party_site_id
AND    hps_bill.party_id = hp_bill.party_id
AND    hps_bill.location_id = hl_bill.location_id
AND    mp.organization_id(+) = ooh.ship_from_org_id

query to get the customer name and number and address


SELECT hp.party_name
     , hp.party_number
     , hca.account_number
     , hca.cust_account_id
     , hp.party_id
     , hps.party_site_id
     , hps.location_id
     , hl.address1
     , hl.address2
     , hl.address3
     , hl.city
     , hl.state
     , hl.country
     , hl.postal_code
     , hcsu.site_use_code
     , hcsu.site_use_id
     , hcsa.bill_to_flag
FROM   hz_parties hp
     , hz_party_sites hps
     , hz_locations hl
     , hz_cust_accounts_all hca
     , hz_cust_acct_sites_all hcsa
     , hz_cust_site_uses_all hcsu
WHERE  hp.party_id = hps.party_id
AND    hps.location_id = hl.location_id
AND    hp.party_id = hca.party_id
AND    hcsa.party_site_id = hps.party_site_id
AND    hcsu.cust_acct_site_id = hcsa.cust_acct_site_id
AND    hca.cust_account_id = hcsa.cust_account_id
AND    hca.account_number = :customer_number

query that can be used to link AR and OM

SELECT ooha.order_number
     , oola.line_number so_line_number
     , oola.ordered_item
     , oola.ordered_quantity * oola.unit_selling_price so_extended_price
     , rcta.trx_number invoice_number
     , rcta.trx_date
     , rctla.line_number inv_line_number
     , rctla.unit_selling_price inv_unit_selling_price
FROM   oe_order_headers_all ooha
     , oe_order_lines_all oola
     , ra_customer_trx_all rcta
     , ra_customer_trx_lines_all rctla
WHERE  ooha.header_id = oola.header_id
AND    rcta.customer_trx_id = rctla.customer_trx_id
AND    rctla.interface_line_attribute6 = TO_CHAR (oola.line_id)
AND    rctla.interface_line_attribute1 = TO_CHAR (ooha.order_number)
AND    order_number = :p_order_number

Alert on Order is booked but line is Entered


Based on a request from one of our reader, below are the steps on how to notify users when an order is booked or new line is inserted on a booked order.

The Alert below will send notification once a day in the morning at 8:00 am.

1) Define Alert
                                            
Query used is

SELECT   (select lower(name) from v$database) instance_name ,RPAD(HZP.PARTY_NAME,40)
,        RPAD(OOH.CUST_PO_NUMBER,35)
,        RPAD(OOH.ORDER_NUMBER,15)
,        RPAD(OOL.LINE_NUMBER,10)
,        RPAD(OOL.ORDERED_ITEM,40)
,        RPAD(OOL.ORDERED_QUANTITY,15)
,        RPAD(HCSU.LOCATION,15)  
,        RPAD(DECODE(OOL.DELIVER_TO_ORG_ID,NULL,NULL,HCSU2.LOCATION),15) 
,        RPAD('CUSTOMER',41)||RPAD('CUST_PO_NUMBER',36)
                            ||RPAD('ORDER_NUMBER',16)
                            ||RPAD('LINE_NUM',11)
                            ||RPAD('ORDERED_ITEM',41)
                            ||RPAD('ORDERED_QTY',16)
                            ||RPAD('SHIP_TO_STORE',16)
                            ||RPAD('DELIVER_TO',16)
,        RPAD('--------',41)||RPAD('--------------',36)
                            ||RPAD('------------',16)
                            ||RPAD('--------',11)
                            ||RPAD('------------',41)
                            ||RPAD('-----------',16)
                            ||RPAD('-------------',16)
                            ||RPAD('----------',16)
 INTO    &instance,&CUSTOMER
,        &CUST_PO_NUMBER
,        &ORDER_NUMBER 
,        &LINE_NUMBER
,        &ORDERED_ITEM
,        &ORDERED_QUANTITY
,        &SHIP_TO_STORE 
,        &DELIVER_TO 
,        &HEADING
,        &UNDER_LINE 
 FROM    OE_ORDER_LINES_ALL              OOL,
         OE_ORDER_HEADERS_ALL            OOH,
         HZ_CUST_ACCOUNTS_ALL            HCA,
         HZ_PARTIES                      HZP,
         HZ_CUST_SITE_USES_ALL           HCSU,
         HZ_CUST_ACCT_SITES_ALL          HCAS,
         HZ_PARTY_SITES                  HPS,
         HZ_LOCATIONS                    HZL,
         HZ_CUST_ACCOUNTS_ALL            HCA2,
         HZ_PARTIES                      HZP2,
         HZ_CUST_SITE_USES_ALL           HCSU2,
         HZ_CUST_ACCT_SITES_ALL          HCAS2,
         HZ_PARTY_SITES                  HPS2,
         HZ_LOCATIONS                    HZL2
WHERE    OOL.HEADER_ID            =   OOH.HEADER_ID
  AND    HCA.PARTY_ID             =   HZP.PARTY_ID
  AND    HCSU.CUST_ACCT_SITE_ID   =   HCAS.CUST_ACCT_SITE_ID(+)
  AND    HCAS.PARTY_SITE_ID       =   HPS.PARTY_SITE_ID
  AND    HPS.LOCATION_ID          =   HZL.LOCATION_ID
  AND    HCSU.SITE_USE_ID         =   OOL.SHIP_TO_ORG_ID
  AND    OOH.SOLD_TO_ORG_ID       =   HCA.CUST_ACCOUNT_ID
  AND    HCA2.PARTY_ID            =   HZP2.PARTY_ID
  AND    HCSU2.CUST_ACCT_SITE_ID  =   HCAS2.CUST_ACCT_SITE_ID(+)
  AND    HCAS2.PARTY_SITE_ID      =   HPS2.PARTY_SITE_ID
  AND    HPS2.LOCATION_ID         =   HZL2.LOCATION_ID
  AND    HCSU2.SITE_USE_ID        =   NVL(OOL.DELIVER_TO_ORG_ID,OOL.SHIP_TO_ORG_ID)
  AND    OOH.SOLD_TO_ORG_ID       =   HCA2.CUST_ACCOUNT_ID
  AND    OOL.FLOW_STATUS_CODE='ENTERED'
  AND    OOH.FLOW_STATUS_CODE='BOOKED'
  AND    OOH.CREATION_DATE LIKE SYSDATE




2) Define Actions
Click on the actions button and then actions Detail button and define message as shown in screenshot. Note that the message type is summary.


3) Define Action Sets
Click on action sets and then action set details and in the members tab enter the action defined in step 2

4) Schedule the Request
Navigate to Request --> Check and submit the alert. Based on the definition of alert it will be scheduled to run.


Sales order Importing Using API

DECLARE
l_api_version_number           NUMBER  := 1;
l_return_status                VARCHAR2 (2000);
l_msg_count                    NUMBER;
l_msg_data                     VARCHAR2 (2000);
/*****************PARAMETERS****************************************************/
l_debug_level                  NUMBER  := 1;    -- OM DEBUG LEVEL (MAX 5)
l_org                          NUMBER  := 5283;         -- OPERATING UNIT
l_no_orders                    NUMBER  := 1;              -- NO OF ORDERS
l_user                         NUMBER  := 28573;          -- USER
l_resp                         NUMBER  := 53073;        -- RESPONSIBLILTY
l_appl                         NUMBER  := 660;        -- ORDER MANAGEMENT
/*****************INPUT VARIABLES FOR PROCESS_ORDER API*************************/
l_header_rec                   oe_order_pub.header_rec_type;
l_line_tbl                     oe_order_pub.line_tbl_type;
l_action_request_tbl           oe_order_pub.request_tbl_type;
l_line_adj_tbl                 oe_order_pub.line_adj_tbl_type;
/*****************OUT VARIABLES FOR PROCESS_ORDER API***************************/
l_header_rec_out               oe_order_pub.header_rec_type;
l_header_val_rec_out           oe_order_pub.header_val_rec_type;
l_header_adj_tbl_out           oe_order_pub.header_adj_tbl_type;
l_header_adj_val_tbl_out       oe_order_pub.header_adj_val_tbl_type;
l_header_price_att_tbl_out     oe_order_pub.header_price_att_tbl_type;
l_header_adj_att_tbl_out       oe_order_pub.header_adj_att_tbl_type;
l_header_adj_assoc_tbl_out     oe_order_pub.header_adj_assoc_tbl_type;
l_header_scredit_tbl_out       oe_order_pub.header_scredit_tbl_type;
l_header_scredit_val_tbl_out   oe_order_pub.header_scredit_val_tbl_type;
l_line_tbl_out                 oe_order_pub.line_tbl_type;
l_line_val_tbl_out             oe_order_pub.line_val_tbl_type;
l_line_adj_tbl_out             oe_order_pub.line_adj_tbl_type;
l_line_adj_val_tbl_out         oe_order_pub.line_adj_val_tbl_type;
l_line_price_att_tbl_out       oe_order_pub.line_price_att_tbl_type;
l_line_adj_att_tbl_out         oe_order_pub.line_adj_att_tbl_type;
l_line_adj_assoc_tbl_out       oe_order_pub.line_adj_assoc_tbl_type;
l_line_scredit_tbl_out         oe_order_pub.line_scredit_tbl_type;
l_line_scredit_val_tbl_out     oe_order_pub.line_scredit_val_tbl_type;
l_lot_serial_tbl_out           oe_order_pub.lot_serial_tbl_type;
l_lot_serial_val_tbl_out       oe_order_pub.lot_serial_val_tbl_type;
l_action_request_tbl_out       oe_order_pub.request_tbl_type;
l_msg_index                    NUMBER;
l_data                         VARCHAR2 (2000);
l_loop_count                   NUMBER;
l_debug_file                   VARCHAR2 (200);
b_return_status                VARCHAR2 (200);
b_msg_count                    NUMBER;
b_msg_data                     VARCHAR2 (2000);
BEGIN
DBMS_APPLICATION_INFO.set_client_info (l_org);
MO_GLOBAL.SET_POLICY_CONTEXT('S',l_org);
mo_global.init('ONT');

/*****************INITIALIZE DEBUG INFO*************************************/
IF (l_debug_level > 0)
THEN
l_debug_file := oe_debug_pub.set_debug_mode ('FILE');
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel (l_debug_level);
oe_msg_pub.initialize;
END IF;

/*****************INITIALIZE ENVIRONMENT*************************************/
fnd_global.apps_initialize (l_user, l_resp, l_appl);-- pass in user_id, responsibility_id, and application_id
/*****************INITIALIZE HEADER RECORD******************************/
l_header_rec := oe_order_pub.g_miss_header_rec;
/*****************POPULATE REQUIRED ATTRIBUTES **********************************/
l_header_rec.operation := oe_globals.g_opr_create;
l_header_rec.order_type_id := 2159;                                                                          -- domestic return
l_header_rec.sold_to_org_id := 659018;
l_header_rec.ship_to_org_id := 635775;
l_header_rec.invoice_to_org_id := 635776;
l_header_rec.order_source_id := 9;
l_header_rec.booked_flag := 'N';
l_header_rec.price_list_id := 39825;
l_header_rec.pricing_date := SYSDATE;
l_header_rec.transactional_curr_code := 'USD';
l_header_rec.flow_status_code := 'ENTERED';
l_header_rec.cust_po_number := '1211314AFA';


/*****************INITIALIZE ACTION REQUEST RECORD*************************************/
l_action_request_tbl (1) := oe_order_pub.g_miss_request_rec;
/*****************INITIALIZE LINE RECORD********************************/
l_line_tbl (1) := oe_order_pub.g_miss_line_rec;
l_line_tbl (1).operation := oe_globals.g_opr_create;
l_line_tbl (1).inventory_item_id := 826543;
l_line_tbl (1).ordered_quantity := 1;
--l_line_tbl(1).unit_selling_price := 2000; -- The price is done using adjustments
--l_line_tbl(1).unit_list_price := 2000;
l_line_tbl (1).calculate_price_flag := 'Y';
l_line_tbl (1).return_reason_code := 'B2';
--l_line_tbl(1).line_number := 1;
l_line_adj_tbl (1) := oe_order_pub.g_miss_line_adj_rec;
l_line_adj_tbl (1).operation := oe_globals.g_opr_create;
l_line_adj_tbl (1).list_header_id := 148129;
l_line_adj_tbl (1).list_line_id := 651550;
l_line_adj_tbl (1).change_reason_code := 'MANUAL';
l_line_adj_tbl (1).change_reason_text := 'Manually applied adjustments';
l_line_adj_tbl (1).operand := 2000;
l_line_adj_tbl (1).pricing_phase_id := 2;
l_line_adj_tbl (1).updated_flag := 'Y';
l_line_adj_tbl (1).applied_flag := 'Y';
l_line_adj_tbl (1).line_index := 1;

FOR i IN 1 .. l_no_orders  
LOOP                                      
/*****************CALLTO PROCESS ORDER API*********************************/
oe_order_pub.process_order (
p_api_version_number          => l_api_version_number
, p_header_rec                  => l_header_rec
, p_line_tbl                    => l_line_tbl
, p_action_request_tbl          => l_action_request_tbl
, p_line_adj_tbl                => l_line_adj_tbl
-- OUT variables
, x_header_rec                  => l_header_rec_out
, x_header_val_rec              => l_header_val_rec_out
, x_header_adj_tbl              => l_header_adj_tbl_out
, x_header_adj_val_tbl          => l_header_adj_val_tbl_out
, x_header_price_att_tbl        => l_header_price_att_tbl_out
, x_header_adj_att_tbl          => l_header_adj_att_tbl_out
, x_header_adj_assoc_tbl        => l_header_adj_assoc_tbl_out
, x_header_scredit_tbl          => l_header_scredit_tbl_out
, x_header_scredit_val_tbl      => l_header_scredit_val_tbl_out
, x_line_tbl                    => l_line_tbl_out
, x_line_val_tbl                => l_line_val_tbl_out
, x_line_adj_tbl                => l_line_adj_tbl_out
, x_line_adj_val_tbl            => l_line_adj_val_tbl_out
, x_line_price_att_tbl          => l_line_price_att_tbl_out
, x_line_adj_att_tbl            => l_line_adj_att_tbl_out
, x_line_adj_assoc_tbl          => l_line_adj_assoc_tbl_out
, x_line_scredit_tbl            => l_line_scredit_tbl_out
, x_line_scredit_val_tbl        => l_line_scredit_val_tbl_out
, x_lot_serial_tbl              => l_lot_serial_tbl_out
, x_lot_serial_val_tbl          => l_lot_serial_val_tbl_out
, x_action_request_tbl          => l_action_request_tbl_out
, x_return_status               => l_return_status
, x_msg_count                   => l_msg_count
, x_msg_data                    => l_msg_data
);

/*****************CHECK RETURN STATUS***********************************/
IF l_return_status = fnd_api.g_ret_sts_success
THEN
IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('success');
END IF;

COMMIT;
ELSE
IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('failure');
END IF;

ROLLBACK;
END IF;
END LOOP; -- END LOOP
/*****************DISPLAY RETURN STATUS FLAGS******************************/
IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('process ORDER ret status IS: '
|| l_return_status);
DBMS_OUTPUT.put_line ('process ORDER msg data IS: '
|| l_msg_data);
DBMS_OUTPUT.put_line ('process ORDER msg COUNT IS: '
|| l_msg_count);
DBMS_OUTPUT.put_line ('header.order_number IS: '
|| TO_CHAR (l_header_rec_out.order_number));
DBMS_OUTPUT.put_line ('adjustment.return_status IS: '
|| l_line_adj_tbl_out (1).return_status);
DBMS_OUTPUT.put_line ('header.header_id IS: '
|| l_header_rec_out.header_id);
DBMS_OUTPUT.put_line ('line.unit_selling_price IS: '
|| l_line_tbl_out (1).unit_selling_price);
END IF;

/*****************DISPLAY ERROR MSGS*************************************/
IF (l_debug_level > 0)
THEN
FOR i IN 1 .. l_msg_count
LOOP
oe_msg_pub.get (p_msg_index => i, p_encoded => fnd_api.g_false, p_data => l_data, p_msg_index_out => l_msg_index);
DBMS_OUTPUT.put_line ('message is: ' || l_data);
DBMS_OUTPUT.put_line ('message index is: ' || l_msg_index);
END LOOP;
END IF;

IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('Debug = ' || oe_debug_pub.g_debug);
DBMS_OUTPUT.put_line ('Debug Level = ' || TO_CHAR (oe_debug_pub.g_debug_level));
DBMS_OUTPUT.put_line ('Debug File = ' || oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
DBMS_OUTPUT.put_line ('****************************************************');
oe_debug_pub.debug_off;
END IF;
END;
/

Oracle Fusion - Cost Lines and Expenditure Item link in Projects

SELECT   ccd.transaction_id,ex.expenditure_item_id,cacat.serial_number FROM fusion.CST_INV_TRANSACTIONS cit,   fusion.cst_cost_distribution_...