Showing posts with label EDI. Show all posts
Showing posts with label EDI. Show all posts

How to rerun DSNO program again

Thursday, May 16, 2019 by Ajay Atre

Sometimes we need to regenerate the DSNO file again, usually we perform this activity for troubleshooting purpose-
Steps below depicts how to run DSNO program again.


When a customer is enabled for EDI DSNO transaction where in we define the EDI setups in e-commerce responsibility.
We then ship an order using shipping transaction form
in Request SRS - we see program getting fired as Outbound Triggering process(Triggering Process Outbound) program. This is DSNO generator program which generates DSNO file into file directory (E-Commerce profile)


So in concurrent program we don't see any such program exists as Outbound Triggering process rather exists Triggering Process Outbound
Assign Triggering Process Outbound to desired responsibility


Run the Triggering Process Outbound program with parameter as
File name in the first argument#1 as Pickup Stop ID


you can get the Pickup Stop ID from below sqls


SELECT
   fcr.request_date "Date Released"
  , fcr.argument2 "DSNO_file"
  , wdl.delivery_id "Delivery"
  , fcr.argument5 "Pickup Stop ID"
  , usr.user_name "User ID"
     FROM
    FND_CONCURRENT_REQUESTS fcr
  , wsh_new_deliveries wnd
  , wsh_delivery_legs wdl
  , fnd_user usr
    WHERE
    fcr.argument5           = TO_CHAR (wdl.pick_up_stop_id)
    AND wdl.delivery_id = wnd.delivery_id
    and fcr.argument2 like 'DSNO%'
    and fcr.requested_by = usr.user_id
    order by 1 desc, 2, 3, 4;




SELECT
fcr.argument2 "DSNO_file"
, fcr.request_date "Date Released"
, wdl.delivery_id "Delivery"
, wdl.pick_up_stop_id "Pickup Stop ID"
, wts.trip_id
, wnd.asn_seq_number
, wnd.confirmed_By "User_ID"
, wnd.organization_id
, mp.organization_code
FROM
FND_CONCURRENT_REQUESTS fcr
, wsh_new_deliveries wnd
, wsh_delivery_legs wdl
, wsh_trip_stops wts
, mtl_parameters mp
WHERE
wnd.delivery_id = wdl.delivery_id
and wdl.pick_up_stop_id = wts.stop_id
and TO_CHAR (wdl.pick_up_stop_id) = fcr.argument5
AND fcr.argument2 LIKE 'DSNO%'
and wnd.organization_id = mp.organization_id;

Filed under , having 61 comments

EDI queries

Friday, May 10, 2019 by Ajay Atre

EDI queries
-- -----------------------------------------------------------------------------------
-- Processing Rule - Address Level
-- -----------------------------------------------------------------------------------   
  SELECT distinct
     hcasa.ece_tp_location_code "Ship-to Location"
     ,hp.party_name
     ,hca.account_number
    , hl.city
    , hl.postal_code
    , hl.province
    , hl.county
    , hl.address1 || hl.address2 || hl.address3 || hl.address4
                                                                   address
    , mci.customer_item_number
    , mci.customer_item_desc
    , mif.item_number
    , mif.description
    , mcc.commodity_code
    , terms.customer_id
    -----------DEMAND FENCES---------------------------------------------
    , terms.pln_frozen_day_from
    , terms.pln_frozen_day_to 
    , terms.pln_firm_day_from  
    , terms.pln_firm_day_to 
    , terms.pln_forecast_day_from
    , terms.pln_forecast_day_to
    , terms.pln_mrp_forecast_day_from
    , terms.pln_mrp_forecast_day_to
    , terms.shp_frozen_day_from
    , terms.shp_frozen_day_to  
    , terms.shp_firm_day_from  
    , terms.shp_firm_day_to
    , terms.shp_forecast_day_from
    , terms.shp_forecast_day_to
    , terms.shp_mrp_forecast_day_from
    , terms.shp_mrp_forecast_day_to
    , terms.seq_frozen_day_from
    , terms.seq_frozen_day_to        
    , terms.seq_firm_day_from  
    , terms.seq_firm_day_to
    , terms.seq_forecast_day_from
    , terms.seq_forecast_day_to          
    , terms.seq_mrp_forecast_day_from 
    , terms.seq_mrp_forecast_day_to
----------------DEMAND mANAGEMENT--------------------------------------------
   -- , terms.schedule_hierarchy_code "Consume Demand Hierarchy Code"
    --,(SELECT meaning from fnd_lookups where lookup_code like terms.schedule_hierarchy_code) "Consume Demand Hierarchy"
   -- , terms.unshipped_firm_disp_cd "ATS PreHorizon Disp Code"
   -- ,(SELECT meaning from fnd_lookups where lookup_code like terms.unshipped_firm_disp_cd) "ATS PreHorizon Disposition"
   -- , terms.unship_firm_cutoff_days "ATS Horizon Cutoff Days"
    , terms.use_edi_sdp_code_flag "Use Cust Ship Delivery"
    , terms.ship_delivery_rule_name "Ship Delivery Code"
    , decode(terms.ship_delivery_rule_name,'D','Monday','E','Tuesday','F','Wednesday','G','Thursday',
                                           'H','Friday','J','Saturday','K','Sunday','N','As Directed',
                                           'O','Daily Monday through Friday','P','1/2 Monday and 1/2 Thursday',
                                           'T','1/2 Tuesday and 1/2 Friday','Y','None','R','1/2 Wednwsday and 1/2 Friday',
                                           'SZ','Tuesday,Thursday and Friday','13','Monday','14','Tuesday','15','Wednesday',
                                           '16','Thursday','17','Friday','18','Saturday','19','Sunday','20','Immediately',
                                           '21','As Directed','23','Daily Monday through Friday','ZZZ','Mutually defined') "Default Ship Delivery Pattern"
    , terms.demand_tolerance_above "Demand Tolerance Positive"
    , terms.demand_tolerance_below "Demand Tolerance Negative"
    , terms.round_to_std_pack_flag "Std Pack Round to"
     , terms.std_pack_qty     "STD Pack Qty"
     -------------------Order Management------------------------------------
     , ooh.order_number       "Order Number"
     --, ott.NAME               "Sales Order Type"
     , terms.intransit_time   "Intransit Time"
     , terms.time_uom_code    "Intransit UOM Code"
     , decode (terms.time_uom_code,'DAY','Day','HR','Hour') "Intransit Unit of Measure"
     , terms.exclude_non_workdays_flag "Exclude Non-Workdays"
    ---------------------CUM MANAGEMENT------------------------------------   
    --, terms.cum_control_code
   -- ,(select meaning from fnd_lookups where lookup_code like terms.cum_control_code)"CUM Management Type"
   -- , terms.cum_org_level_code "CUM Org Level"
   -- , terms.cum_shipment_rule_code "Shipment Rule Code"
   -- , terms.cust_shipto_terms_id
    ---------------------GENERAL------------------------------------------
    --, terms.cust_assign_supplier_cd "Assigned Supplier Code"
    , terms.address_id
    , terms.customer_id
    , terms.ship_from_org_id
    , terms.ship_method
    , terms.intransit_time
    , terms.time_uom_code
    --, terms.cum_current_record_year
    --, terms.cum_previous_record_year
    , terms.cum_current_start_date
    , terms.cum_previous_start_date
   -- , terms.cum_yesterd_time_cutoff
    --, terms.cust_assign_supplier_cd
   -- , terms.customer_rcv_calendar_cd
    , terms.freight_code
    --, terms.supplier_shp_calendar_cd
    --, terms.unship_firm_cutoff_days
    , terms.use_edi_sdp_code_flag
    , terms.inactive_date
   -- , terms.match_across_key
    --, terms.match_within_key
    , terms.header_id
    , terms.price_list_id
    --, terms.critical_attribute_key
    , terms.customer_contact_id
    , terms.supplier_contact_id
    , terms.agreement_id
    , terms.agreement_name
    , terms.future_agreement_id
    , terms.future_agreement_name
    , terms.comments
    , terms.last_updated_by
    , terms.last_update_date
    , terms.creation_date
    , terms.created_by
    , terms.attribute_category
    , terms.attribute1
    , terms.attribute2
    , terms.attribute3
    , terms.attribute4
    , terms.attribute5
    , terms.attribute6
    , terms.attribute7
    , terms.attribute8
    , terms.attribute9
    , terms.attribute10
    , terms.attribute11
    , terms.attribute12
    , terms.attribute13
    , terms.attribute14
    , terms.attribute15
    , terms.last_update_login
    , terms.request_id
    , terms.program_application_id
    , terms.program_id
    , terms.program_update_date
    , terms.tp_attribute1
    , terms.tp_attribute2
    , terms.tp_attribute3
    , terms.tp_attribute4
    , terms.tp_attribute5
    , terms.tp_attribute6
    , terms.tp_attribute7
    , terms.tp_attribute8
    , terms.tp_attribute9
    , terms.tp_attribute10
    , terms.tp_attribute11
    , terms.tp_attribute12
    , terms.tp_attribute13
    , terms.tp_attribute14
    , terms.tp_attribute15
    , terms.tp_attribute_category
    --, terms.intransit_calc_basis
    --,(select meaning from fnd_lookups where lookup_code=terms.intransit_calc_basis)"intransit calc basis"
    , terms.default_ship_from
    , terms.pln_frozen_flag
    , terms.shp_frozen_flag
    , terms.seq_frozen_flag
    , terms.issue_warning_drop_parts_flag
    , terms.org_id
    , terms.blanket_number
    , terms.release_rule
    , terms.release_time_frame
    , terms.release_time_frame_uom
    , terms.exclude_non_workdays_flag
    , terms.disable_create_cum_key_flag
 FROM apps.mtl_customer_items mci
    , apps.mtl_commodity_codes mcc
      , apps.XXAR4385_RA_CUST_R12_V racust
      , apps.XXAR4385_RA_ADDRESS_R12_V raadd
    , apps.rlm_cust_shipto_terms_all terms,
     APPS.HZ_PARTIES HP,
     APPS.HZ_PARTY_SITES HPS,
     HZ_CUST_ACCT_SITES_ALL HCASA,
       HZ_LOCATIONS HL,
       HZ_CUST_ACCOUNTS HCA
    , apps.mtl_item_flexfields mif
    , apps.mtl_customer_item_xrefs mcix
    , apps.oe_order_headers_All ooh
    --, oe_transaction_types_tl ott
WHERE terms.address_id = mci.address_id
AND
  terms.address_id IS NOT NULL
  AND  hp.party_id=hps.party_id
  and    hps.party_site_id=hcasa.party_site_id
  and    hps.location_id=hl.location_id               
  AND   hca.party_id=hp.party_id
  AND hca.cust_account_id = terms.customer_id
  AND hcasa.cust_acct_site_id = terms.address_id
  AND mci.commodity_code_id = mcc.commodity_code_id
  AND mif.inventory_item_id = mcix.inventory_item_id
  AND mif.organization_id = mcix.master_organization_id
  AND mcix.customer_item_id = mci.customer_item_id
   and terms.ship_from_org_id in (select organization_id from org_organization_definitions where organization_code in ('JES','MHF') )
  AND mcix.preference_number =
        (SELECT MIN (preference_number)
           FROM mtl_customer_item_xrefs
          WHERE customer_item_id = mci.customer_item_id
            AND inactive_flag <> 'Y')
  and ooh.header_id=terms.header_id
--  and  hca.account_number=:customer_number
  and hcasa.ece_tp_location_code is not null;
 
  -- -----------------------------------------------------------------------------------
  -- Processing Rule - Customer level
  -- -----------------------------------------------------------------------------------
 
 
SELECT  (select organization_code from org_organization_definitions where organization_id=terms.ship_from_org_id)"Organization code"
         , racust.account_number
         , hp.party_name
       , terms.pln_frozen_day_from 
       , terms.pln_frozen_day_to  
       , terms.pln_firm_day_from   
       , terms.pln_firm_day_to  
       , terms.pln_forecast_day_from
       , terms.pln_forecast_day_to
       , terms.pln_mrp_forecast_day_from
       , terms.pln_mrp_forecast_day_to
       , terms.shp_frozen_day_from 
       , terms.shp_frozen_day_to   
       , terms.shp_firm_day_from   
       , terms.shp_firm_day_to
       , terms.shp_forecast_day_from
       , terms.shp_forecast_day_to
       , terms.shp_mrp_forecast_day_from 
       , terms.shp_mrp_forecast_day_to
       , terms.seq_frozen_day_from 
       , terms.seq_frozen_day_to         
       , terms.seq_firm_day_from   
       , terms.seq_firm_day_to
       , terms.seq_forecast_day_from 
       , terms.seq_forecast_day_to           
       , terms.seq_mrp_forecast_day_from  
       , terms.seq_mrp_forecast_day_to
       ,(SELECT meaning from fnd_lookups where lookup_code like terms.schedule_hierarchy_code) "Consume Demand Hierarchy"
       ,(SELECT meaning from fnd_lookups where lookup_code like terms.unshipped_firm_disp_cd) "ATS PreHorizon Disposition"
       , terms.unship_firm_cutoff_days "ATS Horizon Cutoff Days"
       , terms.use_edi_sdp_code_flag "Use Cust Ship Delivery"
       , terms.ship_delivery_rule_name "Ship Delivery Code"
       , decode(terms.ship_delivery_rule_name,'D','Monday','E','Tuesday','F','Wednesday','G','Thursday',
                                              'H','Friday','J','Saturday','K','Sunday','N','As Directed',
                                              'O','Daily Monday through Friday','P','1/2 Monday and 1/2 Thursday',
                                              'T','1/2 Tuesday and 1/2 Friday','Y','None','R','1/2 Wednwsday and 1/2 Friday',
                                              'SZ','Tuesday,Thursday and Friday','13','Monday','14','Tuesday','15','Wednesday',
                                              '16','Thursday','17','Friday','18','Saturday','19','Sunday','20','Immediately',
                                              '21','As Directed','23','Daily Monday through Friday','ZZZ','Mutually defined') "Default Ship Delivery Pattern"
       , terms.demand_tolerance_above "Demand Tolerance Positive"
       , terms.demand_tolerance_below "Demand Tolerance Negative"
       , terms.round_to_std_pack_flag "Std Pack Round to"
        , terms.std_pack_qty     "STD Pack Qty"
        , ooh.order_number       "Order Number"
       , terms.intransit_time   "Intransit Time"
        , terms.time_uom_code    "Intransit UOM Code"
        , decode (terms.time_uom_code,'DAY','Day','HR','Hour') "Intransit Unit of Measure"
        ,(select meaning from fnd_lookups where lookup_code=terms.intransit_calc_basis)"intransit calc basis"
        , terms.exclude_non_workdays_flag "Exclude Non-Workdays"
       , terms.cum_control_code
       ,(select meaning from fnd_lookups where lookup_code like terms.cum_control_code)"CUM Management Type"
       , terms.cum_org_level_code "CUM Org Level"
       , terms.cum_shipment_rule_code "Shipment Rule Code"
       , terms.cust_shipto_terms_id
       , terms.cust_assign_supplier_cd "Assigned Supplier Code"
       , terms.address_id
       , terms.customer_id
       , terms.ship_from_org_id
       , terms.ship_method
       , terms.cum_current_record_year
       , terms.cum_previous_record_year
       , terms.cum_current_start_date
       , terms.cum_previous_start_date
       , terms.cum_yesterd_time_cutoff
       , terms.cust_assign_supplier_cd
       , terms.customer_rcv_calendar_cd
       , terms.freight_code
       , terms.supplier_shp_calendar_cd
       , terms.unship_firm_cutoff_days
       , terms.use_edi_sdp_code_flag
       , terms.inactive_date
       , terms.match_across_key
       , terms.match_within_key
       , terms.header_id
       , terms.price_list_id
       , terms.critical_attribute_key
       , terms.customer_contact_id
       , terms.supplier_contact_id
       , terms.agreement_id
       , terms.agreement_name
       , terms.future_agreement_id
       , terms.future_agreement_name
       , terms.comments
       , terms.last_updated_by
       , terms.last_update_date
       , terms.creation_date
       , terms.created_by
       , terms.attribute_category
       , terms.attribute1
       , terms.attribute2
       , terms.attribute3
       , terms.attribute4
       , terms.attribute5
       , terms.attribute6
       , terms.attribute7
       , terms.attribute8
       , terms.attribute9
       , terms.attribute10
       , terms.attribute11
       , terms.attribute12
       , terms.attribute13
       , terms.attribute14
       , terms.attribute15
       , terms.last_update_login
       , terms.request_id
       , terms.program_application_id
       , terms.program_id
       , terms.program_update_date
       , terms.tp_attribute1
       , terms.tp_attribute2
       , terms.tp_attribute3
       , terms.tp_attribute4
       , terms.tp_attribute5
       , terms.tp_attribute6
       , terms.tp_attribute7
       , terms.tp_attribute8
       , terms.tp_attribute9
       , terms.tp_attribute10
       , terms.tp_attribute11
       , terms.tp_attribute12
       , terms.tp_attribute13
       , terms.tp_attribute14
       , terms.tp_attribute15
       , terms.tp_attribute_category
       , terms.intransit_calc_basis
       , terms.default_ship_from
       , terms.pln_frozen_flag
       , terms.shp_frozen_flag
       , terms.seq_frozen_flag
       , terms.issue_warning_drop_parts_flag
       , terms.org_id
       , terms.blanket_number
       , terms.release_rule
       , terms.release_time_frame
       , terms.release_time_frame_uom
       , terms.disable_create_cum_key_flag
    FROM   apps.hz_cust_accounts racust
         ,apps.hz_parties hp
       , apps.rlm_cust_shipto_terms_all terms
       , apps.org_organization_definitions orgdef
       , apps.oe_order_headers_All ooh
   WHERE 
    racust.cust_account_id = terms.customer_id
     and  hp.party_id=racust.party_id
     AND orgdef.organization_id = terms.ship_from_org_id
     AND terms.address_id IS NULL
      and ooh.header_id=terms.header_id; 
  
-- -----------------------------------------------------------------------------------
--    Processing Rule - Item Level
-- -----------------------------------------------------------------------------------
SELECT distinct  cust_acct.account_number customer_number ,acct_site.CUST_ACCT_SITE_ID 
        ,loc.location_id 
       , mci.customer_item_number 
       , mci.customer_item_desc 
       , mif.item_number 
       , mif.description 
       , mcc.commodity_code 
       , terms.customer_id 
       , terms.pln_frozen_day_from  
       , terms.pln_frozen_day_to   
       , terms.pln_firm_day_from    
       , terms.pln_firm_day_to   
       , terms.pln_forecast_day_from 
       , terms.pln_forecast_day_to 
       , terms.pln_mrp_forecast_day_from 
       , terms.pln_mrp_forecast_day_to 
       , terms.shp_frozen_day_from  
       , terms.shp_frozen_day_to    
       , terms.shp_firm_day_from    
       , terms.shp_firm_day_to 
       , terms.shp_forecast_day_from 
       , terms.shp_forecast_day_to 
       , terms.shp_mrp_forecast_day_from  
       , terms.shp_mrp_forecast_day_to 
       , terms.seq_frozen_day_from  
       , terms.seq_frozen_day_to          
       , terms.seq_firm_day_from    
       , terms.seq_firm_day_to 
       , terms.seq_forecast_day_from  
       , terms.seq_forecast_day_to            
       , terms.seq_mrp_forecast_day_from   
       , terms.seq_mrp_forecast_day_to 
       , terms.use_edi_sdp_code_flag "Use Cust Ship Delivery"
       , terms.ship_delivery_rule_name "Ship Delivery Code" 
       , decode(terms.ship_delivery_rule_name,'D','Monday','E','Tuesday','F','Wednesday','G','Thursday', 
                                              'H','Friday','J','Saturday','K','Sunday','N','As Directed', 
                                              'O','Daily Monday through Friday','P','1/2 Monday and 1/2 Thursday', 
                                              'T','1/2 Tuesday and 1/2 Friday','Y','None','R','1/2 Wednwsday and 1/2 Friday', 
                                              'SZ','Tuesday,Thursday and Friday','13','Monday','14','Tuesday','15','Wednesday', 
                                              '16','Thursday','17','Friday','18','Saturday','19','Sunday','20','Immediately', 
                                              '21','As Directed','23','Daily Monday through Friday','ZZZ','Mutually defined') "Default Ship Delivery Pattern" 
       , terms.demand_tolerance_above "Demand Tolerance Positive"
       , terms.demand_tolerance_below "Demand Tolerance Negative" 
       , terms.round_to_std_pack_flag "Std Pack Round to"
        , terms.std_pack_qty "STD Pack Qty"
         , ooh.order_number "Order Number"
        , terms.intransit_time "Intransit Time"
        , terms.time_uom_code  "Intransit UOM Code"
        , decode (terms.time_uom_code,'DAY','Day','HR','Hour') "Intransit Unit of Measure"
        , terms.exclude_non_workdays_flag "Exclude Non-Workdays"
       , terms.address_id 
       , terms.customer_id 
       , terms.ship_from_org_id 
       , terms.ship_method 
       , terms.intransit_time 
       , terms.time_uom_code 
      , terms.cum_current_start_date 
       , terms.cum_previous_start_date 
       , terms.freight_code 
       , terms.use_edi_sdp_code_flag 
       , terms.inactive_date 
       , terms.header_id 
       , terms.price_list_id 
       , terms.customer_contact_id 
       , terms.supplier_contact_id 
       , terms.agreement_id 
       , terms.agreement_name 
       , terms.future_agreement_id 
       , terms.future_agreement_name 
       , terms.comments 
       , terms.last_updated_by 
       , terms.last_update_date 
       , terms.creation_date 
       , terms.created_by 
       , terms.attribute_category 
       , terms.attribute1 
       , terms.attribute2 
       , terms.attribute3 
       , terms.attribute4 
       , terms.attribute5 
       , terms.attribute6 
       , terms.attribute7 
       , terms.attribute8 
       , terms.attribute9 
       , terms.attribute10 
       , terms.attribute11 
       , terms.attribute12 
       , terms.attribute13 
       , terms.attribute14 
       , terms.attribute15 
       , terms.last_update_login 
       , terms.request_id 
       , terms.program_application_id 
       , terms.program_id 
       , terms.program_update_date 
       , terms.tp_attribute1 
       , terms.tp_attribute2 
       , terms.tp_attribute3 
       , terms.tp_attribute4 
       , terms.tp_attribute5 
       , terms.tp_attribute6 
       , terms.tp_attribute7 
       , terms.tp_attribute8 
       , terms.tp_attribute9 
       , terms.tp_attribute10 
       , terms.tp_attribute11 
       , terms.tp_attribute12 
       , terms.tp_attribute13 
       , terms.tp_attribute14 
       , terms.tp_attribute15 
       , terms.tp_attribute_category 
        , terms.default_ship_from 
       , terms.pln_frozen_flag 
       , terms.shp_frozen_flag 
       , terms.seq_frozen_flag 
       , terms.issue_warning_drop_parts_flag 
       , terms.org_id 
       , terms.blanket_number 
       , terms.release_rule 
       , terms.release_time_frame 
       , terms.release_time_frame_uom 
       , terms.exclude_non_workdays_flag 
       , terms.disable_create_cum_key_flag 
    FROM apps.mtl_customer_items mci 
       , apps.mtl_commodity_codes mcc 
        ,hz_parties party  
          ,hz_cust_accounts cust_acct 
          ,hz_party_sites party_site 
         ,hz_locations loc 
         ,hz_cust_acct_sites_all acct_site 
         , apps.rlm_cust_item_terms_all terms 
       , apps.mtl_item_flexfields mif 
       , apps.mtl_customer_item_xrefs mcix 
       , apps.oe_order_headers_All ooh 
    WHERE terms.customer_item_id = mci.customer_item_id 
     AND terms.address_id IS NOT NULL 
    And cust_acct.CUST_ACCount_ID = terms.customer_id 
            AND cust_acct.PARTY_ID = party.party_id 
     and party.party_id=party_site.party_id 
     and 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=terms.address_id 
     AND mci.commodity_code_id = mcc.commodity_code_id 
     AND mif.inventory_item_id = mcix.inventory_item_id 
     AND mif.organization_id = mcix.master_organization_id 
     AND mcix.customer_item_id = mci.customer_item_id 
     AND mcix.preference_number = 
           (SELECT MIN (preference_number) 
              FROM mtl_customer_item_xrefs 
             WHERE customer_item_id = mci.customer_item_id 
               AND inactive_flag <> 'Y') 
     and ooh.header_id=terms.header_id
     and terms.ship_from_org_id in (625,626);
 
-- -----------------------------------------------------------------------------------
-- Trading Partner Query
-- -----------------------------------------------------------------------------------
SELECT    etg.tp_group_code           "Group"
              ,etg.tp_group_description  "Description"
              ,hp.party_name         "Customer Name"--rc.customer_name          "Customer Name"       --mk
              ,HCA.ACCOUNT_NUMBER        "Customer_number" --,rc.CUSTOMER_NUMBER   "Customer Number"  --mk
              ,HL.address1||' '||HL.city||' '||HL.state     "Site Name"
              ,hcasa.ece_tp_location_code   "EDI Location"
              ,eth.tp_code                     "Partner"
              ,eth.tp_description            "Description"
              ,eth.tp_reference_ext1      "Reference1"
              ,eth.tp_reference_ext2      "Reference2"
              ,sub1.document                "Transaction"
              ,sub1.document_type2       "Type"
              ,sub1.translator_code         "Translator Code"  
              ,sub1.document_standard   "Document Standard"
              ,sub1.map_code                "Map"
              ,pvs.ece_tp_location_code  "TP Location Code"
              ,sub1.document_type
              ,sub1.edi_flag
              ,sub1.print_flag
              ,sub1.test_flag
              ,sub1.ATTRIBUTE_CATEGORY "TP Transaction"
              ,sub1.ATTRIBUTE1 "Account No"
              ,sub1.ATTRIBUTE2 "Account Name"
              ,sub1.ATTRIBUTE3 "Bank Name"
              ,eth.ATTRIBUTE_CATEGORY "Trading Partner"
              ,eth.attribute9 "Remit To Name"
              ,eth.attribute10 "Remit To Street"
              ,eth.attribute11 "Remit To City"
              ,eth.attribute12 "Remit To State"
              ,eth.attribute13 "Remit To Postal Code"
              ,eth.attribute14 "Remit To Country"
              ,eth.attribute15 "Remit To VAT NO"
FROM           hz_cust_accounts          hca     --ra_addresses_all         ra
             ,po_vendor_sites_all      pvs
             ,ap_bank_branches  ab
             ,hr_locations            hr
             ,ece_tp_headers      eth
             ,ece_tp_group         etg
             ,hz_parties          hp             --ra_customers         rc --mk
             ,hz_party_sites      hps            --mk
             ,hz_locations        hl             --mk
             ,hz_cust_acct_sites_All  hcasa      --mk
            ,( SELECT    etd.document_id,
                              etd.document_type,
                              etd.translator_code,
                              etd.edi_flag,
                              etd.print_flag,
                              etd.test_flag,
                              elv1.meaning document,
                              elv2.meaning document_type2,
                              etd.tp_header_id,
                              etd.document_standard,
                              em.map_code,
                              etd.ATTRIBUTE_CATEGORY,
                              etd.ATTRIBUTE1,
                              etd.ATTRIBUTE2,
                              etd.ATTRIBUTE3
               FROM      ece_tp_details etd,
                             ece_lookup_values elv1,
                             ece_lookup_values elv2,
                             ece_mappings       em
               WHERE    elv1.lookup_type = 'DOCUMENT'
               AND        elv1.lookup_code = etd.document_id
              AND        etd.map_id = em.map_id
              AND        elv1.enabled_flag = 'Y'
              AND        elv2.lookup_type = etd.document_id||':DOCUMENT_TYPE'
              AND        elv2.lookup_code = etd.document_type
              AND        elv2.enabled_flag = 'Y'
             ) sub1
WHERE  etg.tp_group_id = eth.tp_group_id
AND       eth.tp_header_id = pvs.tp_header_id (+)
AND      eth.tp_header_id = hcasa.tp_header_id (+)  --mk
AND      eth.tp_header_id = ab.tp_header_id (+)
AND      eth.tp_header_id = hr.tp_header_id (+)
AND      eth.tp_header_id = sub1.tp_header_id
AND      eth.tp_header_id = hcasa.tp_header_id
AND      hca.party_id = hp.party_id              --mk                             
AND      HP.PARTY_ID=HPS.PARTY_ID                --mk
AND      HPS.LOCATION_ID=HL.LOCATION_ID          --mk
AND      HPS.PARTY_SITE_ID=HCASA.PARTY_SITE_ID   --mk
--AND      HCA.ACCOUNT_NUMBER=:account_number 
--AND     hp.party_name=:party_name
--and     hcasa.ece_tp_location_code=:EDI_LOCATION
ORDER BY     etg.tp_group_code, eth.tp_code 

Filed under , , having 21 comments

EDIs with Oracle Apps R12

Friday, November 9, 2012 by Ajay Atre

EDIs with Oracle Apps R12
Inbound and outbound flow of EDI.

 Typical Oracle EDIs available which can fit in various process-
·         8X series is Customer EDIs
·         9x series is warehouse EDIs

Where does EDIs fit in Process
As an example- take a manufacturing company let’s say ABC Corp. with third party logistics warehouse as PQR,
Order creation -
Customer places an order via EDI850, ABC Corp. receives order in oracle Customer service personal books the order.
Order Booking -
Scheduled EDI940 picks us the eligible orders (Booked orders) and sends electronic communication to warehouse PQR, letting them know about they need to ship the order.
On the side note as the order is booked another scheduled program EDI855 picks the eligible orders (Booked orders) and sends them to Customer letting them know as an order is acknowledged.
Order Pick release and shipping -
Warehouse PQR ships the order based on decided criteria (Like LIFO) and sends EDI945 information which can contain lots, shipped quantity etc. to ABC Corp. Scheduled EDI945 program at ABC Corp. processes the order according the ship information received from PQR and pick releases/ship confirms the order in oracle.
As the order is closed scheduled EDI856 program picks the eligible orders (shipped orders) and sends electronic information as ship advise to Customer, by which customer knows order is shipped.
Invoice generation-
Once the Invoice is generated the scheduled EDI810 program picks the invoices and sends them to Customer.

IRISO cycle –
ABC. Corp creates requisition in oracle with the intention to send the inventory at its third party logistics (PQR here). The requisition then becomes the ISO (Internal Sales order) and is shipped form ABC Corp. Scheduled EDI943 program picks eligible orders (Internal shipped orders) and sends electronic receipt advise to warehouse PQR.
PQR in return after receiving good physically sends EDI944 information to ABC Corp. The scheduled EDI944 program at ABC Corp. then processes the file and receives the goods as an receiving transaction to its oracle PQR warehouse.

EDI explanation
Customer EDIs
EDI850- Order import EDI, Customer places the order and is then get imported in oracle.
EDI860- Order changes from Customer. Customer places order changes like quantity change, line cancellation, ship date changes etc.
EDI855- Order Acknowledgement to Customer EDI, customer is informed for order is booked.
EDI856- Shipment advise to Customer EDI, Customer is informed for order is shipped.
EDI810- Invoice to Customer EDI. Invoice information is sent Via EDI810

Third party logistics warehouse EDIs
EDI940- Order advise to warehouse EDI, Warehouse gets an electronic information about the order which then warehouse prepares for shipping.
EDI945- Order ship advise from warehouse EDI, Warehouse sends electronic information about order ship info like what lot number, how much qty etc.
EDI943- Receiving advise to warehouse. For internal order scenario (IR ISO), order is shipped internally and is expected to receive to warehouse to create inventory. EDI 943 sends the internal order ship information to warehouse.
EDI944- Warehouse receipt advise EDI. Warehouse sends electronic information about how the internal order (IR ISO) is received at warehouse.
EDI947 IN- Warehouse sends inventory adjustments via EDI. Inventory adjustments like cycle count, product damage adjustment etc.
EDI947 OUT- Main Company sends the lot status information to warehouse; lot status can contain a list of lots which are good to be FG shipping, Quality hold etc. This is to let warehouse know what lots to ship against the order.

Prerequisites -
For setting up the EDIs one must think of below prerequisites,
1.   EDI processing Engine- Can be a professional organization or an in-house capability. The processing engine will deal with customer/third party warehouse about how to get connected (various ways available like VAN, AS2 or FTP).
2.   FTP capabilities- This can be provided by EDI processing engine if not then custom UNIX based concurrent programs can be used to achieve to and from FTP requirements.
3.   FTP server/Shared Directories – You can have FTP server associated across oracle ERP system or you can have shared directories (between middle tier or DB tier) by which Oracle extraction/load programs can read and write data as an when needed.
4.   EDI jobs- As a seeded program oracle does provides a list of handful ready to use EDI programs which can be used to perform particular EDI. The only issue with the seeded programs is customization and debugging the exceptions. Alternate and more controlled approach can be having a custom program which can use the APIs/interfaces available to load/extract the data.
5.   Trading partner setup- EDI entities (customer or warehouse) will provide a unique ID (translator code) by which you can have the trading partner setup done in oracle E-Commerce responsibility by which you can then define which transactions wanted to do with EDI entities (customer or warehouse).
6.   EDI exception mechanism- You can have a common exception mechanism which can report all exceptions based on the particular EDIs/operating unit selected.
7.   EDI exception email mechanism- You can have a email utility developed which can be used to email with EDI exception report as an attachment to a designated user community.




Setups with E-Commerce responsibility-
Define the trading partners
E-Commerce Responsibility- Navigation: Setup/ Trading Partners
Customer EDIs Trading partner setup

Click on New to create new setup or click on open
Select the customer and site which you want to map with EDI

On the customer master site setup- assign the EDI location code (EDI location code is a unique ID by which customer deals with the site)
 Once defined click on the details tab


Warehouse EDIs Trading partner setup
Oracle as a seeded does not provide the 9X series of the EDIs so we need to use available customer EDIs with to map with warehouse EDIs

EDI940/945,947 IN and 947 OUT

For example
Map at warehouse level
EDI855- mapped as EDI940, EDI947 out
EDI856 IN - mapped as EDI945, EDI947 IN

For example see below defining for M1 as M1 is whs so we don’t need to assign customer below

But define the above transaction in details tab.

EDI943/944

Map at customer level (In IRISO we created ISO against the customer where we want to send the inventory as receipt, so the customer is internal customer by warehouse for example M1 Seattle customer if you are shipping from V1 whs)
EDI856 OUT- mapped as EDI943
EDI856 IN- mapped as EDI944

For example below ORATEST_INTERNAL_CUSTOMER is internal customer

E-Commerce Category-
You can define the category by which you one can decide the substitution value for both incoming and outgoing EDIs.
The direction column below shows options like IN, OUT or Both


Import/extract Programs -
Oracle as seeded provides below import programs

 For example 850

Extract programs

For example EDI810 program



Custom Programs logic-
As I said earlier issue with the standard program is customization and control.
The real time solution can be using the custom developed programs for each individual EDIs above using APIs/interfaces.

Custom Import Programs –
Incoming FTP Program (Unix shell script program) - which can download the available EDI files from EDI processing engine to incoming directory. This program can be scheduled.

Import program can be constructed as
1.   Load program – have the unix shell script program which can construct all available files into one single file (for example if its EDI 850 then it will club all EDI 850 flat files) and then feed the file name to PLSQL data load program
2.   PLSQL data load program- is the program which will take input from above program and will process the file and load the data (using UTL_FILE utility) into oracle staging tables.
3.   Validate/import program – Validated the necessary validations and if passed through imports the data using APIs/interfaces.
4.   Exception Report program- if there are any exceptions during load/ validate programs this program can report those.
5.   Exception email program- will email the exceptions; this program can be scheduled and can send email at particular interval.

EDI 850 – is an incoming EDI where we need to import the sales order in oracle.
We can use oe_order_pub.process_order APIs to get the order imported in oracle.

            oe_order_pub.process_order (p_api_version_number          => p_api_version_number
                                       ,p_init_msg_list               => fnd_api.g_false
                                       ,p_return_values               => fnd_api.g_false
                                       ,p_action_commit               => fnd_api.g_false
                                       ,x_return_status               => l_return_status
                                       ,x_msg_count                   => l_msg_count
                                       ,x_msg_data                    => l_msg_data
                                       ,p_header_rec                  => l_header_rec
                                       ,p_header_adj_tbl              => l_header_adj_tbl
                                       ,p_line_tbl                    => l_line_tbl
                                       ,p_line_adj_tbl                => l_line_adj_tbl
                                       ,p_action_request_tbl          => l_action_request_tbl
                                       ,x_header_rec                  => x_header_rec
                                       ,x_header_val_rec              => x_header_val_rec
                                       ,x_header_adj_tbl              => x_header_adj_tbl
                                       ,x_header_adj_val_tbl          => x_header_adj_val_tbl
                                       ,x_header_price_att_tbl        => x_header_price_att_tbl
                                       ,x_header_adj_att_tbl          => x_header_adj_att_tbl
                                       ,x_header_adj_assoc_tbl        => x_header_adj_assoc_tbl
                                       ,x_header_scredit_tbl          => x_header_scredit_tbl
                                       ,x_header_scredit_val_tbl      => x_header_scredit_val_tbl
                                       ,x_line_tbl                    => x_line_tbl
                                       ,x_line_val_tbl                => x_line_val_tbl
                                       ,x_line_adj_tbl                => x_line_adj_tbl
                                       ,x_line_adj_val_tbl            => x_line_adj_val_tbl
                                       ,x_line_price_att_tbl          => x_line_price_att_tbl
                                       ,x_line_adj_att_tbl            => x_line_adj_att_tbl
                                       ,x_line_adj_assoc_tbl          => x_line_adj_assoc_tbl
                                       ,x_line_scredit_tbl            => x_line_scredit_tbl
                                       ,x_line_scredit_val_tbl        => x_line_scredit_val_tbl
                                       ,x_lot_serial_tbl              => x_lot_serial_tbl
                                       ,x_lot_serial_val_tbl          => x_lot_serial_val_tbl
                                       ,x_action_request_tbl          => x_action_request_tbl
                                       );

EDI 945
EDI945 can do pick release and ship confirm of the order, below are some APIs by which entire process can be accomplished.
1.   Create reservation
         inv_quantity_tree_pvt.clear_quantity_cache;
         inv_reservation_pub.create_reservation (p_api_version_number          => 1.0
                                                ,p_init_msg_lst                => fnd_api.g_true
                                                ,x_return_status               => l_api_return_status
                                                ,x_msg_count                   => l_msg_count
                                                ,x_msg_data                    => l_msg_data
                                                ,p_rsv_rec                     => p_created_res
                                                ,p_serial_number               => l_serial_no
                                                ,x_serial_number               => l_actual_sn
                                                ,p_partial_reservation_flag    => fnd_api.g_false
                                                ,p_force_reservation_flag      => fnd_api.g_false
                                                ,p_validation_flag             => fnd_api.g_true
                                                ,p_over_reservation_flag      => l_over_reservation_flag
                                                ,x_quantity_reserved           => l_quantity_reserved
                                                ,x_reservation_id              => x_reservation_id
                                                ,p_partial_rsv_exists          => l_partial_rsv_exists
                                                ,p_substitute_flag             => l_substitute_flag
                                                );
2.   Delivery creation
               wsh_delivery_details_pub.autocreate_deliveries
                                                              (p_api_version_number          => 1.0
                                                              ,p_init_msg_list               => fnd_api.g_true
                                                              ,p_commit                      => fnd_api.g_false
                                                              ,x_return_status           => xout_return_status
                                                              ,x_msg_count               => xout_msg_count
                                                              ,x_msg_data                    => xout_msg_data
                                                              ,p_line_rows                   => l_line_rows
                                                              ,x_del_rows                    => l_del_rows
                                                              );
3.   Pick release Delivery
               wsh_deliveries_pub.delivery_action (p_api_version_number          => 1.0
                                                  ,p_init_msg_list               => fnd_api.g_true
                                                  ,x_return_status               => xout_return_status
                                                  ,x_msg_count                   => xout_msg_count
                                                  ,x_msg_data                    => xout_msg_data
                                                  ,p_action_code                 => 'PICK-RELEASE'
                                                  ,p_delivery_id                 => l_delivery_id
                                                  ,x_trip_id                     => l_trip_id
                                                  ,x_trip_name                   => l_trip_name
                                                  );
4.   Ship Confirm Delivery
            wsh_deliveries_pub.delivery_action (p_api_version_number          => 1.0
                                               ,p_init_msg_list               => fnd_api.g_true
                                               ,x_return_status               => xout_return_status
                                               ,x_msg_count                   => xout_msg_count
                                               ,x_msg_data                    => xout_msg_data
                                               ,p_action_code                 => 'CONFIRM'
                                               ,p_delivery_id                 => r_order.delivery_id
                                               ,p_sc_action_flag              => 'S'
                                               ,p_sc_intransit_flag           => 'Y'
                                               ,p_sc_close_trip_flag          => 'Y'
        ,p_sc_actual_dep_date => NVL (TRUNC (r_order.date_shipped), TRUNC (SYSDATE))
                                               ,x_trip_id                     => l_trip_id
                                               ,x_trip_name                   => l_trip_name
                                               );
5.   Close the Delivery
            wsh_ship_confirm_actions.interface_all (errbuf                        => l_errbuf
                                                   ,retcode                       => l_retcode
                                                   ,p_mode                        => 'ALL'
                                                   ,p_stop_id                     => NULL
                                                   ,p_delivery_id                 => l_delivery_id
                                                   ,p_log_level                   => 1
                                                   );

EDI 944 –
EDI944 can do the receipts in oracle. Using this program you can validate the receiving data and then insert into standard receiving interface tables
·         INSERT INTO po.rcv_headers_interface
·         INSERT INTO po.rcv_transactions_interface
·         INSERT INTO inv.mtl_transaction_lots_interface
·         If WMS being used then INSERT INTO wms_lpn_interface
·         Finally run the RCVTP
v_child_request                     :=
fnd_request.submit_request (‘PO’, ‘RCVTP’, NULL, NULL, FALSE, 'BATCH',
o   rcv_group_id, CHR (0));
·         RCVTP can be run as – immediate, batch or online.
EDI 947 IN-
Is an inventory adjustment EDI where warehouse can send adjustments like cycle count, damages, writeoffs etc.
Validate the data and then insert into
·         INSERT INTO mtl_transactions_interface
·         INSERT INTO mtl_transaction_lots_interface
·         Finally run the standard inventory transaction worker which can take care of posting the transactions
               fnd_request.submit_request ('INV'   -- Appl short name
                                          ,'INCTCW'   -- Inventory transaction worker
                                          ,NULL   -- Description
                                          ,NULL   -- Date and Time
                                          ,FALSE   -- Sub-request
                                          ,l_transaction_header_id
                                          ,3
                                          ,NULL
                                          ,NULL
                                          );




Custom Export Programs –
Outgoing extract programs can be constructed as a request set where the first stage will extract the data and stage 2 will then FTP the extracted file to the EDI processing engine.
The FTP utility can be constructed as a single concurrent unix shell program which can be shared across all outgoing jobs.

Import program can be constructed as
1.   Extract program – have the PLSQL extract done by SQL statements and generate a flat file using UTL_FILE utility. Pass on the file name to next stage.
2.   FTP Send Utility- is the common FTP program which will take input as file name and directory from above program and will FTP the file to EDI processing engine. EDI processing engine will then process the file and send it to customer.
3.   Exception Report program- if there are any exceptions during extracting and validating the data exception report can report those.
4.   Exception email program- will email the exceptions; this program can be scheduled and can send email at particular interval.

EDI 855
This program will send order acknowledgement to customer. Typical extraction SQL can be.
         SELECT DISTINCT *
                    FROM apps.oe_order_headers_all h
                        ,apps.oe_transaction_types_tl ot
                        ,apps.ra_salesreps_all rsa
                        ,apps.oe_order_lines_all l
                        ,hz_cust_site_uses_all ship_hcsu
                        ,hz_cust_acct_sites_all ship_hcas
                        ,hz_cust_accounts_all ship_hca
                        ,hz_parties ship_hp
                        ,hz_party_sites ship_hps
                        ,hz_locations ship_hc
                        ,apps.hz_cust_acct_sites_all bill_to
                        ,apps.hz_cust_site_uses_all bill_use
                        ,hz_party_sites bill_hps
                        ,hz_locations bill_hc
                        ,apps.ece_tp_headers eth
                        ,apps.ece_tp_details etd
                        ,ra_terms_tl rtl
                        ,qp_list_headers_tl qlht
                        ,hr_organization_units_v houv
                   WHERE 1 = 1
                     AND h.org_id = p_org_id
                     AND h.open_flag = 'Y'
                     AND h.booked_flag = 'Y'
                     AND NVL (h.cancelled_flag, 'N') != 'Y'
                     AND h.order_type_id = ot.transaction_type_id
                     AND h.salesrep_id = rsa.salesrep_id
                     AND h.header_id = l.header_id
                     AND l.flow_status_code NOT IN ('CANCELLED', 'AWAITING_RETURN', 'RETURNED', 'CLOSED')
                     AND h.ship_to_org_id = ship_hcsu.site_use_id
                     AND ship_hcsu.cust_acct_site_id = ship_hcas.cust_acct_site_id
                     AND ship_hcas.cust_account_id = ship_hca.cust_account_id
                     AND ship_hcsu.org_id = ship_hcas.org_id
                     AND ship_hca.party_id = ship_hp.party_id
                     AND ship_hcas.party_site_id = ship_hps.party_site_id
                     AND ship_hps.location_id = ship_hc.location_id
                     AND bill_to.party_site_id = bill_hps.party_site_id
                     AND bill_hps.location_id = bill_hc.location_id
                     AND h.invoice_to_org_id = bill_use.site_use_id
                     AND bill_to.cust_acct_site_id = bill_use.cust_acct_site_id
                     AND bill_to.org_id = bill_use.org_id
                     AND bill_to.cust_account_id = ship_hca.cust_account_id
                     AND ship_hcas.tp_header_id = eth.tp_header_id
                     AND etd.tp_header_id = eth.tp_header_id
                     AND etd.document_id = 'POAO'
                     AND etd.document_type = 'POAO'
                     AND etd.edi_flag = 'Y'
                     AND h.payment_term_id = rtl.term_id
                     AND qlht.list_header_id = h.price_list_id
                     AND l.ship_from_org_id = houv.organization_id
                     AND (p_order_number_list IS NULL OR (',' || p_order_number_list || ',' LIKE '%,' || h.order_number || ',%'))
                ORDER BY h.order_number;

EDI 856
This program will send orders shipped to customer. Typical extraction SQL can be.
         SELECT DISTINCT *
                    FROM apps.wsh_trips wt
                        ,apps.wsh_trip_stops wts
                        ,apps.wsh_trip_stops wts1
                        ,apps.wsh_new_deliveries wnd
                        ,apps.wsh_delivery_assignments wda
                        ,apps.wsh_delivery_details wdd
                        ,apps.wsh_delivery_legs wdl
                        ,apps.wsh_document_instances wdi
                        ,apps.wsh_document_instances wdi2
                        ,apps.hz_cust_site_uses_all ship_to_site
                        ,apps.hz_cust_acct_sites_all ship_to_acct
                        ,apps.hz_party_sites ship_to_party
                        ,apps.hz_locations ship_to_loc
                        ,apps.hz_cust_accounts ship_to_cust
                        ,apps.hz_cust_site_uses_all bill_to_site
                        ,apps.hz_cust_acct_sites_all bill_to_acct
                        ,apps.hz_party_sites bill_to_party
                        ,apps.hz_locations bill_to_loc
                        ,apps.hz_cust_accounts rc
                        ,apps.hz_parties hp
                        ,apps.oe_order_headers_all ooh
                        ,apps.oe_transaction_types_tl oot
                        ,apps.ece_tp_headers eth
                        ,apps.ece_tp_details etd
                        ,apps.ra_terms_tl rtt
                        ,mtl_parameters mp
                        ,oe_order_sources oos
                   WHERE 1 = 1
                     AND (p_delivery_name_list IS NULL OR (',' || p_delivery_name_list || ',' LIKE '%,' || wnd.NAME || ',%'))
                     AND ooh.org_id = p_org_id
                     AND wnd.delivery_id = wda.delivery_id
                     AND wnd.delivery_id = wdl.delivery_id
                     AND wdl.pick_up_stop_id = wts.stop_id
                     AND wdl.drop_off_stop_id = wts1.stop_id
                     AND wts.trip_id = wt.trip_id
                     AND wda.delivery_detail_id = wdd.delivery_detail_id
                     AND wdi.entity_id = wnd.delivery_id
                     AND wdi.entity_name = 'WSH_NEW_DELIVERIES'
                     AND wdi2.entity_id(+) = wnd.delivery_id
                     AND wdi2.entity_name(+) = 'WSH_DELIVERY_LEGS'
                     AND wdd.customer_id = rc.cust_account_id
                     AND rc.cust_account_id = ooh.sold_to_org_id
                     AND rc.party_id = hp.party_id
                     AND ooh.ship_to_org_id = ship_to_site.site_use_id
                     AND ship_to_site.cust_acct_site_id = ship_to_acct.cust_acct_site_id
                     AND ship_to_acct.org_id = ship_to_site.org_id
                     AND ship_to_acct.cust_account_id = rc.cust_account_id
                     AND ship_to_site.site_use_code = 'SHIP_TO'
                     AND ship_to_site.status = 'A'
                     AND wdd.source_header_id = ooh.header_id
                     AND wdd.org_id = ooh.org_id
                     AND oot.transaction_type_id = ooh.order_type_id
                     AND etd.tp_header_id = ship_to_acct.tp_header_id
                     AND eth.tp_header_id = etd.tp_header_id
                     AND etd.document_id = 'DSNO'
                     AND etd.document_type = 'DSNO'
                     AND etd.edi_flag = 'Y'
                     AND ship_to_acct.party_site_id = ship_to_party.party_site_id
                     AND ship_to_party.location_id = ship_to_loc.location_id
                     AND ship_to_cust.cust_account_id = ship_to_acct.cust_account_id
                     AND ooh.payment_term_id = rtt.term_id
                     AND ooh.invoice_to_org_id = bill_to_site.site_use_id
                     AND bill_to_acct.cust_acct_site_id = bill_to_site.cust_acct_site_id
                     AND bill_to_acct.org_id = bill_to_site.org_id
                     AND bill_to_acct.party_site_id = bill_to_party.party_site_id
                     AND bill_to_party.location_id = bill_to_loc.location_id
                     AND bill_to_acct.cust_account_id = rc.cust_account_id
                     AND mp.organization_id = wnd.organization_id
                     AND oos.order_source_id = ooh.order_source_id
                     AND wnd.status_code = 'CL'
                     AND TRUNC (wnd.confirm_date) >= '13-JUL-2010'
                ORDER BY wnd.delivery_id;



EDI 810
This program will send invoices to customer. Typical extraction SQL can be.
         SELECT   *
             FROM apps.ra_cust_trx_types_all ctt
                 ,apps.ra_customer_trx_all rct
                 ,apps.hz_cust_acct_sites_all ship_to
                 ,apps.hz_cust_site_uses_all ship_use
                 ,hz_party_sites hps
                 ,hz_locations ship_loc
                 ,apps.ece_tp_headers eth
                 ,apps.ece_tp_details etd
                 ,apps.hz_cust_accounts cust
                 ,hz_parties hp
                 ,apps.hz_cust_acct_sites_all bill_to
                 ,apps.hz_cust_site_uses_all bill_use
                 ,hz_party_sites hpb
                 ,hz_locations bill_loc
                 ,apps.hz_cust_acct_sites_all remit_to
                 ,hz_party_sites hpr
                 ,hz_locations remit_loc
                 ,apps.hr_organization_units hou
                 ,apps.hr_locations ship_from
                 ,apps.ra_terms term
                 ,apps.oe_order_headers_v ooh
            WHERE 1 = 1
              AND ctt.org_id = p_org_id
              AND ctt.attribute1 = 'Y'
              AND rct.org_id = ctt.org_id
              AND rct.cust_trx_type_id = ctt.cust_trx_type_id
              AND TRUNC (rct.trx_date) <= TRUNC (SYSDATE)
              AND rct.complete_flag = 'Y'
              AND NVL (rct.edi_processed_flag, 'N') = 'N'
              AND rct.edi_processed_status IS NULL
              AND ship_use.site_use_id = rct.ship_to_site_use_id
              AND hp.party_id = cust.party_id
              AND ship_to.cust_acct_site_id = ship_use.cust_acct_site_id
              AND hps.location_id = ship_loc.location_id
              AND ship_to.party_site_id = hps.party_site_id
              AND eth.tp_header_id = ship_to.tp_header_id
              AND etd.tp_header_id = eth.tp_header_id
              AND etd.document_id = 'INO'
              AND etd.document_type = 'INV'
              AND etd.edi_flag = 'Y'
              AND cust.cust_account_id = rct.bill_to_customer_id
              AND bill_use.site_use_id = rct.bill_to_site_use_id
              AND bill_to.cust_acct_site_id = bill_use.cust_acct_site_id
              AND hpb.location_id = bill_loc.location_id
              AND bill_to.party_site_id = hpb.party_site_id
              AND remit_to.cust_acct_site_id = rct.remit_to_address_id
              AND hpr.location_id = remit_loc.location_id
              AND remit_to.party_site_id = hpr.party_site_id
              AND hou.organization_id = TO_NUMBER (TRIM (rct.interface_header_attribute10))
              AND ship_from.location_id = hou.location_id
              AND term.term_id = rct.term_id
              AND ooh.order_type = rct.interface_header_attribute2
              AND ooh.order_number = TO_NUMBER (TRIM (rct.interface_header_attribute1))
              AND TRUNC (rct.creation_date) >= '21-FEB-2005'
              AND (   TO_CHAR (p_invoice_number_string) IS NULL
                   OR (',' || TO_CHAR (p_invoice_number_string) || ',' LIKE '%,' || TO_CHAR (rct.trx_number) || ',%')
                  )
         ORDER BY TO_NUMBER (invoice_number);




This explains complete EDI details and setups with oracle apps R12.
Thanks,
Ajay


Filed under , having 22 comments