全部標準API

序號 系統版本 模塊 應用場景 類型 API/接口 參數規格 樣例代碼 備註 登記者 登記時間 關鍵字
1 12.1.3 AP 付款覈銷 API ap_pay_invoice_pkg.ap_pay_invoice       趙楊 2013/3/30 付款/覈銷
2 12.1.3 AP 應付發票審批 API ap_approval_pkg.approval       趙楊 2013/3/30 發票/審批
3 12.1.3 AP 預付款覈銷 API ap_prepay_pkg.apply_prepay_fr_prepay       趙楊 2013/3/30 預付款/覈銷
4 12.1.3 AP 建立應付發票 API ap_import_invoices_pkg.import_invoices       趙楊 2013/3/30 發票/導入
5 12.1.3 AP 建立付款歷史記錄 API ap_reconciliation_pkg.insert_payment_history       趙楊 2013/3/30 付款歷史/導入
6 12.1.1 AP 建立供應商頭 API ap_vendor_pub_pkg.create_vendor p_vendor_rec使用   ap_vendor_pub_pkg.r_vendor_rec_type  l_vendor_rec.segment1                := '12345'; --supplier   number
      l_vendor_rec.vendor_name             := 'Test Supp 003';
        l_vendor_rec.vendor_type_lookup_code := 'COMPANY';
      l_vendor_rec.vendor_name_alt         := 'alter name 002';
      --
        l_vendor_rec.enforce_ship_to_location_code := 'WARNING';
      l_vendor_rec.receiving_routing_id          := 1;
        l_vendor_rec.inspection_required_flag      := 'Y'; --Match Approval Level
        l_vendor_rec.receipt_required_flag         := 'Y'; --Match Approval Level
      l_vendor_rec.qty_rcv_tolerance             := 1;
        l_vendor_rec.days_early_receipt_allowed    := 2; --number
        l_vendor_rec.days_late_receipt_allowed     := 3; --number
        l_vendor_rec.qty_rcv_exception_code        := 'REJECT'; --ap_suppliers.qty_rcv_exception_code%TYPE                          
        l_vendor_rec.receipt_days_exception_code   := 'REJECT';   --ap_suppliers.receipt_days_exception_code%TYPE,
   
      l_vendor_rec.start_date_active :=   SYSDATE;
      l_vendor_rec.end_date_active   := NULL;
   
        pos_vendor_pub_pkg.create_vendor(p_vendor_rec    => l_vendor_rec,
                                         x_return_status => x_return_status,
                                         x_msg_count     =>   x_msg_count,
                                         x_msg_data      =>   x_msg_data,
                                         x_vendor_id     =>   x_vendor_id,
                                         x_party_id      =>   x_party_id);
  蘇聯章 2013/3/31 供應商/供應商頭/導入
7 12.1.1 AP 驗證供應商頭 API ap_vendor_pub_pkg.validate_vendor p_vendor_rec使用   ap_vendor_pub_pkg.r_vendor_rec_type     蘇聯章 2013/3/31 供應商/供應商頭/驗證
8 12.1.1 AP 更新供應商頭 API ap_vendor_pub_pkg.update_vendor p_vendor_rec使用   ap_vendor_pub_pkg.r_vendor_rec_type     蘇聯章 2013/3/31 供應商/供應商頭/更新
9 12.1.1 AP 建立供應商地點 API ap_vendor_pub_pkg.create_vendor_site p_vendor_site_rec使用ap_vendor_pub_pkg.r_vendor_site_rec_type  l_vendor_site_rec.vendor_id := 61578;
      l_vendor_site_rec.org_id    := 84;
      --l_vendor_site_rec.vendor_site_id   := 49138;
        l_vendor_site_rec.vendor_site_code        := 'SHE_FAC';
      l_vendor_site_rec.ship_to_location_code   := 'SHE_FACTORY';
        l_vendor_site_rec.bill_to_location_code := 'SHE_FACTORY';
        l_vendor_site_rec.pay_site_flag           := 'Y';
        l_vendor_site_rec.purchasing_site_flag    := 'Y';
      l_vendor_site_rec.country               := 'TH';
        l_vendor_site_rec.party_site_name         := '0001'; --address name
      l_vendor_site_rec.address_line1         := 'Office';
      l_vendor_site_rec.city                  := 'BANKOK';
      pos_vendor_pub_pkg.create_vendor_site(p_vendor_site_rec   => l_vendor_site_rec,
                                              x_return_status   =>   x_return_status,
                                              x_msg_count       =>   x_msg_count,
                                              x_msg_data        =>   x_msg_data,
                                              x_vendor_site_id  =>   l_vendor_site_id,
                                              x_party_site_id   =>   l_party_site_id,
                                              x_location_id     =>   l_location_id);
  蘇聯章 2013/3/31 供應商/供應商地點/導入
10 12.1.1 AP 驗證供應商地點 API ap_vendor_pub_pkg.validate_vendor_site p_vendor_site_rec使用ap_vendor_pub_pkg.r_vendor_site_rec_type     蘇聯章 2013/3/31 供應商/供應商地點/驗證
11 12.1.1 AP 更新供應商地點 API ap_vendor_pub_pkg.update_vendor_site p_vendor_site_rec使用ap_vendor_pub_pkg.r_vendor_site_rec_type     蘇聯章 2013/3/31 供應商/供應商地點/更新
12 12.1.1 AP 建立供應商聯繫信息 API ap_vendor_pub_pkg.create_vendor_contact p_vendor_contact_rec使用ap_vendor_pub_pkg.r_vendor_contact_rec_type site:
      l_vendor_contact_rec.vendor_id         := 511018;
      l_vendor_contact_rec.vendor_site_id    := 115494;
        l_vendor_contact_rec.party_site_id       := 885872;
      l_vendor_contact_rec.org_party_site_id   := 885872;
      l_vendor_contact_rec.org_id            := 44;
        l_vendor_contact_rec.person_first_name := '003';
        l_vendor_contact_rec.person_last_name    := '003';
        pos_vendor_pub_pkg.create_vendor_contact(p_vendor_contact_rec => l_vendor_contact_rec,
                                                 x_return_status      =>   x_return_status,
                                                 x_msg_count          =>   x_msg_count,
                                                 x_msg_data           =>   x_msg_data,
                                                 x_vendor_contact_id  =>   x_vendor_contact_id,
                                                 x_per_party_id       =>   x_per_party_id,
                                                 x_rel_party_id       =>   x_rel_party_id,
                                                 x_rel_id             =>   x_rel_id,
                                                 x_org_contact_id     =>   x_org_contact_id,
                                                 x_party_site_id      => x_party_site_id);
此API能夠建立頭層和地點層的聯繫信息,取決於參數賦值。建立地點聯繫信息時須要有效的r_vendor_contact_rec_type.vendor_site_id和r_vendor_contact_rec_type.party_site_id 蘇聯章 2013/3/31 供應商/供應商聯繫信息/導入
13 12.1.1 AP 驗證供應商聯繫信息 API ap_vendor_pub_pkg.validate_vendor_contact p_vendor_contact_rec使用ap_vendor_pub_pkg.r_vendor_contact_rec_type     蘇聯章 2013/3/31 供應商/供應商聯繫信息/驗證
14 12.1.1 AP 更新供應商聯繫信息 API ap_vendor_pub_pkg.update_vendor_contact p_vendor_contact_rec使用ap_vendor_pub_pkg.r_vendor_contact_rec_type     蘇聯章 2013/3/31 供應商/供應商聯繫信息/更新
15 12.1.1 AP 建立Notes API ap_notes_pub.create_note       蘇聯章 2013/3/31 Notes/建立
16 11.5.0 AP 供應商導入 接口 AR.APXSUIMP   l_request_id   := fnd_request.submit_request('SQLAP',
                                                 'APXSUIMP',
                                                 '', 
                                                 '', 
                                                 FALSE, 
                                                 'NEW', 
                                                 1000, 
                                                 'N', 
                                                 'N', 
                                                 'N', 
                                                 chr(0));  
  黎法良 2013/3/31 供應商/導入
17 11.5.0 AP 供應商地點導入 接口 AR.APXSSIMP   g_site_request_id   := fnd_request.submit_request(application => l_application
                                                     ,program     =>   'APXSSIMP'
                                                     ,description => l_description
                                                     ,start_time  => NULL
                                                     ,sub_request => NULL
                                                     ,argument1   => 'NEW'
                                                     ,argument2   => '1000'
                                                     ,argument3   => 'N'
                                                     ,argument4   => 'N'
                                                     ,argument5   => 'N');
  黎法良 2013/3/31 供應商地點/導入
18 11.5.0 AP 供應商地點聯繫人導入 接口 AR.APXSCIMP   g_contact_request_id   := fnd_request.submit_request(application => l_application,
                                                         program     => 'APXSCIMP',
                                                         description => l_description,
                                                         start_time  => NULL,
                                                         sub_request => NULL,
                                                         argument1   => 'NEW',
                                                         argument2   => '1000',
                                                         argument3   => 'N',
                                                         argument4   => 'Y',
                                                         argument5   => 'N');
  黎法良 2013/3/31 供應商地點聯繫人/導入
19 11.5.0 AP 應付發票導入 接口 AR.APXIIMPT   v_request_id   := fnd_request.submit_request('SQLAP',
                                                 'APXIIMPT',
                                                 NULL,
                                                 NULL,
                                                 FALSE,
                                                 gc_source --Source
                                                ,NULL --p_batch_name --Group ID
                                                ,NULL --p_batch_name --Batch Name
                                                ,NULL --Hold Name
                                                ,NULL --Hold Reason
                                                ,NULL --GL Date
                                                ,'Y' --Purge
                                                ,'N' --p_trace_switch
                                                ,'N' --p_debug_switch
                                                ,'N' --Summary Report
                                                ,1000
                                                ,fnd_global.user_id,
  黎法良 2013/3/31 應付發票/導入
20 12.1.3 AR 貸項通知單核銷 API ar_cm_api_pub.apply_on_account       趙楊 2013/3/30 貸項通知單/覈銷
21 12.1.3 AR 收款覈銷 API ar_receipt_api_pub.apply       趙楊 2013/3/30 收款/覈銷
22 12.1.3 AR 收款撤銷覈銷 API ar_receipt_api_pub.unapply       趙楊 2013/3/30 收款/撤銷覈銷
23 11.5.0 AR 應收發票導入 接口 AR.RAXTRX   ln_request_id   := fnd_request.submit_request(application => 'AR',
                                                  program     =>   'RAXTRX',
                                                  description => NULL,
                                                  start_time  => NULL,
                                                  sub_request => FALSE,
                                                  argument1   => 'MAIN'   --Parallel Module Name
                                                 ,argument2   => 'T' --Running   Mode
                                                 ,argument3   =>   v_batch_src_id --Batch Source Id
                                                 ,argument4   => gc_source   --Batch Source Name
                                                 ,argument5   => p_gl_date   --Default Date
                                                 ,argument6   => NULL   --Transaction Flexfield
                                                 ,argument7   => NULL   --p_trx_type_id --Transaction Type
                                                 ,argument8   => NULL --(Low)   Bill To Customer Number
                                                 ,argument9   => NULL --(High)   Bill To Customer Number
                                                 ,argument10  => NULL --(Low)   Bill To Customer Name
                                                 ,argument11  => NULL --(High)   Bill To Customer Name
                                                 ,argument12  => NULL --p_gl_date   --(Low) GL Date
                                                 ,argument13  => NULL   --p_gl_date --(High) GL Date
                                                 ,argument14  => NULL --(Low)   Ship Date
                                                 ,argument15  => NULL --(High)   Ship Date
                                                 ,argument16  => NULL --(Low)   Transaction Number
                                                 ,argument17  => NULL --(High)   Transaction Number
                                                 ,argument18  => NULL --(Low)   Sales Order Number
                                                 ,argument19  => NULL --(High)   Sales Order Number
                                                 ,argument20  => NULL --(Low)   Invoice Date
                                                 ,argument21  => NULL --(High)   Invoice Date
                                                 ,argument22  => NULL --(Low)   Ship To Customer Number
                                                 ,argument23  => NULL --(High)   Ship To Customer Number
                                                 ,argument24  => NULL --(Low)   Ship To Customer Name
                                                 ,argument25  => NULL --(High)   Ship To Customer Name
                                                 ,argument26  => 'N' --Call   RAXTRX from RAXMTR flag
                                                 ,argument27  => 'Y' --Base   Due Date on Trx Date
                                                 ,argument28  => NULL --Due   Date Adjustment Days
                                                 ,argument29  => p_org_id   --Org Id
                                                  );
  黎法良 2013/3/31 應收發票/導入
24 12.1.3 AR 建立應收發票 API ar_invoice_api_pub.create_single_invoice       趙楊 2013/3/30 發票/導入
25 12.1.3 AR 建立應收收款 API AR_RECEIPT_API_PUB.create_cash       趙楊 2013/3/30 收款/導入
26 12.1.3 AR 建立客戶聯繫人 API hz_contact_point_v2pub.create_phone_contact_point       趙楊 2013/3/30 客戶/聯繫方式/添加
27 12.1.3 AR 格式化地址信息 API ARP_ADDR_PKG.FORMAT_ADDRESS   ARP_ADDR_PKG.FORMAT_ADDRESS(LOC.ADDRESS_STYLE,
                             LOC.ADDRESS1,
                             LOC.ADDRESS2,
                             LOC.ADDRESS3,
                             LOC.ADDRESS4,
                             LOC.CITY,
                             LOC.COUNTY,
                             LOC.STATE,
                             LOC.PROVINCE,
                           LOC.POSTAL_CODE,
                             TERR.TERRITORY_SHORT_NAME)
     FND_TERRITORIES_VL TERR,
     HZ_LOCATIONS       LOC
    AND LOC.COUNTRY = TERR.TERRITORY_CODE(+)
  趙楊 2013/3/30 地址格式
28 12.1.3 AR 建立客戶 API hz_party_v2pub.create_organization   DECLARE
      lrec_org     hz_party_v2pub.organization_rec_type;
      lrec_party   hz_party_v2pub.party_rec_type;
   
      l_return_status VARCHAR2(20);
      l_msg_count     NUMBER;
      l_msg_data      VARCHAR2(2000);
      l_party_id      NUMBER;
      l_party_number  VARCHAR2(2000) :=   'test-20121022-010';
      l_profile_id    NUMBER;
      l_last_succ     VARCHAR2(100);
   
      x_party_id NUMBER;
    BEGIN
        /*fnd_global.apps_initialize(user_id      => 0,
                                   resp_id      => 50695,
                                   resp_appl_id => 660);
      mo_global.init('ONT');*/
   
      lrec_party.status         := 'A';
      lrec_party.validated_flag :=   'N';
      lrec_party.party_number   := l_party_number;
   
      --party_rec
      lrec_org.created_by_module :=   'HZ_CPUI';
      lrec_org.organization_name :=   'SPA館003';
      lrec_org.known_as          := 'SPA館003的別名';
   
      lrec_org.party_rec      := lrec_party;
   
        hz_party_v2pub.create_organization('T',
                                           lrec_org,
                                           'CUSTOMER',
                                           l_return_status,
                                           l_msg_count,
                                           l_msg_data,
                                           x_party_id,
                                           l_party_number,
                                           l_profile_id);
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data || ','   ||
                             x_party_id);
   
      COMMIT;
    END;
  何雲 2013/4/3 客戶/建立
29 12.1.3 AR 更新客戶 API hz_party_v2pub.update_organization   DECLARE
      l_msg_count     NUMBER;
      l_profile_id    NUMBER;
      l_return_status   VARCHAR2(200);
      l_proc_step     VARCHAR2(200);
      l_msg_data      VARCHAR2(2000);
   
      l_rec_organization   hz_party_v2pub.organization_rec_type;
      l_rec_party        hz_party_v2pub.party_rec_type;
      l_obj_ver_number   NUMBER;
      l_last_succ        VARCHAR2(100);
    BEGIN
   
      BEGIN
        SELECT   object_version_number
          INTO l_obj_ver_number
          FROM hz_parties hp
         WHERE hp.party_id = 20055;
      EXCEPTION
        WHEN OTHERS THEN
          NULL;
      END;
   
      l_rec_party.party_id := 20055;
      --l_rec_party.status                   := p_status;
        l_rec_organization.organization_name := 'SPA館004';
      l_rec_organization.party_rec         := l_rec_party;
      l_rec_organization.known_as          := 'SPA館004的別名';
   
        hz_party_v2pub.update_organization(p_init_msg_list               => 'T',
                                           p_organization_rec              => l_rec_organization,
                                           p_party_object_version_number => l_obj_ver_number,
                                           x_profile_id                    => l_profile_id,
                                           x_return_status                 => l_return_status,
                                           x_msg_count                     => l_msg_count,
                                           x_msg_data                      => l_msg_data);
   
      dbms_output.put_line(l_return_status   || ':' || l_msg_data);
      COMMIT;
    END;
  何雲 2013/4/3 客戶/更新
30 12.1.3 AR 建立客戶地址 API hz_location_v2pub.create_location   l_loc_rec.country  := 'CN';
      l_loc_rec.address1 :=   '測試地址行001';
   
      l_loc_rec.created_by_module :=   'HZ_CPUI';
   
        hz_location_v2pub.create_location('T',
                                          l_loc_rec,
                                          l_location_id,
                                          l_return_status,
                                          l_msg_count,
                                          l_msg_data);
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/地址/建立
31 12.1.3 AR 更新客戶地址 API hz_location_v2pub.update_location   SELECT   hl.location_id,
             hl.object_version_number,
           cas.party_site_id,
           cas.object_version_number,
           cas.attribute1
      INTO l_location_id,
           l_version_number,
           l_party_site_id,
           l_site_version_number,
           l_site_attribute1
      FROM hz_locations hl,   hz_party_sites hps, hz_cust_acct_sites_all cas
     WHERE hps.location_id =   hl.location_id
       AND cas.party_site_id =   hps.party_site_id
       AND cas.cust_acct_site_id =   p_cust_acct_site_id;
   
    l_loc_rec.province := p_interface_data.province;
    l_loc_rec.city     :=   p_interface_data.city;
   
    IF p_site_use_code = 'BILL_TO' THEN
      l_loc_rec.country     :=   p_interface_data.bill_to_country;
      l_loc_rec.address1    :=   p_interface_data.bill_to_address_line1;
      l_loc_rec.address2    :=   p_interface_data.bill_to_address_line2;
      l_loc_rec.address3    :=   p_interface_data.bill_to_address_line3;
      l_loc_rec.address4    :=   p_interface_data.bill_to_address_line4;
      l_loc_rec.postal_code :=   p_interface_data.bill_to_postal_code;
    ELSIF p_site_use_code = 'SHIP_TO' THEN
      l_loc_rec.country     :=   p_interface_data.ship_to_country;
      l_loc_rec.address1    :=   p_interface_data.ship_to_address_line1;
      l_loc_rec.address2    :=   p_interface_data.ship_to_address_line2;
      l_loc_rec.address3    :=   p_interface_data.ship_to_address_line3;
      l_loc_rec.address4    :=   p_interface_data.ship_to_address_line4;
      l_loc_rec.postal_code :=   p_interface_data.ship_to_postal_code;
    END IF;
   
    l_loc_rec.location_id := l_location_id;
   
    hz_location_v2pub.update_location(fnd_api.g_false,
                                        l_loc_rec,
                                        l_version_number,
                                        l_return_status,
                                        l_msg_count,
                                        l_msg_data);
  何雲 2013/4/3 客戶/地址/更新
32 12.1.3 AR 建立party_site API hz_party_site_v2pub.create_party_site   l_party_site_rec.party_id                 := 20055;
        l_party_site_rec.location_id              := l_location_id;
          l_party_site_rec.identifying_address_flag := 'Y';
          l_party_site_rec.created_by_module        := 'HZ_CPUI';
     
          hz_party_site_v2pub.create_party_site('T',
                                                l_party_site_rec,
                                                l_party_site_id,
                                                l_party_site_number,
                                                l_return_status,
                                                l_msg_count,
                                                l_msg_data);
     
          dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/party_site/建立
33 12.1.3 AR 建立客戶地點 API hz_cust_account_site_v2pub.create_cust_acct_site   l_cust_acct_site_rec.cust_account_id   := 9043;
            l_cust_acct_site_rec.party_site_id       := l_party_site_id;
            l_cust_acct_site_rec.org_id              := 84;
            l_cust_acct_site_rec.status              := 'A';
            l_cust_acct_site_rec.created_by_module := 'HZ_CPUI';
            hz_cust_account_site_v2pub.create_cust_acct_site('T',
                                                             l_cust_acct_site_rec,
                                                             l_cust_acct_site_id,
                                                             l_return_status,
                                                             l_msg_count,
                                                             l_msg_data);
       
            dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/地點/建立
34 12.1.3 AR 建立客戶地點的業務用途 API hz_cust_account_site_v2pub.create_cust_site_use   bill_cust_site_use_rec.cust_acct_site_id   := l_cust_acct_site_id;
                bill_cust_site_use_rec.site_use_code     := 'BILL_TO';
                bill_cust_site_use_rec.location          := '測試收單地址行001';
                bill_cust_site_use_rec.primary_flag      := 'Y';
                bill_cust_site_use_rec.status            := 'A';
                bill_cust_site_use_rec.org_id            := 84;
                --bill_cust_site_use_rec.gl_id_rec           :=   p_rec_cust_sites.gl_rec_id;
                --bill_cust_site_use_rec.gl_id_rev           :=   p_rec_cust_sites.gl_rev_id;
                bill_cust_site_use_rec.price_list_id     := 9143;
                bill_cust_site_use_rec.payment_term_id := 5;
                --bill_cust_site_use_rec.primary_salesrep_id := p_rec_cust_sites.sales_person_id;
                --bill_cust_site_use_rec.tax_reference       :=   p_rec_cust_sites.tax_reference;
                --bill_cust_site_use_rec.tax_code := p_rec_cust_sites.tax_code;
           
                bill_cust_site_use_rec.created_by_module := 'HZ_CPUI';
           
                hz_cust_account_site_v2pub.create_cust_site_use('T',
                                                                bill_cust_site_use_rec,
                                                                l_customer_profile_rec,
                                                                '',
                                                                '',
                                                                l_site_use_id,
                                                                l_return_status,
                                                                l_msg_count,
                                                                l_msg_data);
           
                dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/業務用途/建立
35 12.1.3 AR 更新客戶地點的業務用途 API hz_cust_account_site_v2pub.update_cust_site_use   DECLARE
      cust_site_use_rec        hz_cust_account_site_v2pub.cust_site_use_rec_type;
      l_customer_profile_rec   hz_customer_profile_v2pub.customer_profile_rec_type;
   
      l_site_use_id   NUMBER;
      l_return_status   VARCHAR2(2000);
      l_msg_count     NUMBER;
      l_msg_data      VARCHAR2(2000);
      l_last_succ     VARCHAR2(100);
      l_exception EXCEPTION;
      l_exception_no_site EXCEPTION;
      l_object_version_number   NUMBER;
      x_return_code           VARCHAR2(100);
    BEGIN
        fnd_global.apps_initialize(user_id        => 0,
                                   resp_id      => 50695,
                                   resp_appl_id => 660);
      mo_global.init('ONT');
   
      SELECT hcsu.object_version_number
        INTO   l_object_version_number
        FROM hz_cust_site_uses_all   hcsu
       WHERE hcsu.site_use_id = 1330
         AND hcsu.org_id = 84;
   
      cust_site_use_rec.site_use_id       := 1330;
      cust_site_use_rec.cust_acct_site_id   := 1287;
      --cust_site_use_rec.location          := '測試收貨地址行002';
      cust_site_use_rec.status :=   'I';
      --cust_site_use_rec.org_id            := 84;
   
      --cust_site_use_rec.price_list_id   := 9137;
   
      --cust_site_use_rec.payment_term_id   := 4;
   
        hz_cust_account_site_v2pub.update_cust_site_use(p_init_msg_list         => 'T',
                                                        p_cust_site_use_rec     =>   cust_site_use_rec,
                                                        p_object_version_number => l_object_version_number,
                                                        x_return_status         =>   l_return_status,
                                                        x_msg_count             =>   l_msg_count,
                                                        x_msg_data              =>   l_msg_data);
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
   
      COMMIT;
    END;
  何雲 2013/4/3 客戶/業務用途/更新
36 12.1.3 AR 建立客戶配置文件 API hz_customer_profile_v2pub.create_customer_profile   l_customer_profile.status            := 'A';
        l_customer_profile.created_by_module := 'HZ_CPUI';
      l_customer_profile.party_id          := 20055;
        l_customer_profile.cust_account_id     := 9043;
     
        hz_customer_profile_v2pub.create_customer_profile(p_customer_profile_rec    => l_customer_profile,
                                                          x_cust_account_profile_id => l_cust_account_profile_id,
                                                          x_return_status           =>   l_return_status,
                                                          x_msg_count               =>   l_msg_count,
                                                          x_msg_data                =>   l_msg_data);
     
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/配置文件/建立
37 12.1.3 AR 建立客戶配置文件金額 API hz_customer_profile_v2pub.create_cust_profile_amt   l_cust_profile_amt.cust_account_profile_id  :=    /*l_cust_account_profile_id*/
       11041;
        l_cust_profile_amt.currency_code            := 'CNY';
        l_cust_profile_amt.overall_credit_limit     := 100;
        l_cust_profile_amt.cust_account_id          := 9043;
        l_cust_profile_amt.created_by_module        := 'HZ_CPUI';
   
        hz_customer_profile_v2pub.create_cust_profile_amt(p_cust_profile_amt_rec     => l_cust_profile_amt,
      x_cust_acct_profile_amt_id =>   l_cust_acct_profile_amt_id,
      x_return_status            => l_return_status,
      x_msg_count                => l_msg_count,
      x_msg_data                 => l_msg_data);
  何雲 2013/4/3 客戶/配置文件金額/建立
38 12.1.3 AR 更新客戶配置文件金額 API hz_customer_profile_v2pub.update_cust_profile_amt   l_cust_profile_amt.cust_acct_profile_amt_id   := 3040;
        l_cust_profile_amt.cust_account_profile_id  :=    /*l_cust_account_profile_id*/
       11041;
        l_cust_profile_amt.currency_code            := 'CNY';
      l_cust_profile_amt.overall_credit_limit     := 100;
        l_cust_profile_amt.cust_account_id          := 9043;
        l_cust_profile_amt.created_by_module        := 'HZ_CPUI';
   
        hz_customer_profile_v2pub.update_cust_profile_amt(p_cust_profile_amt_rec  => l_cust_profile_amt,
                                                          p_object_version_number => l_version,
                                                          x_return_status         =>   l_return_status,
                                                          x_msg_count             =>   l_msg_count,
                                                          x_msg_data              =>   l_msg_data);
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/配置文件金額/更新
39 12.1.3 AR 建立客戶賬戶 API hz_cust_account_v2pub.create_cust_account   l_cust_account_rec.account_number    := 'test_account_003';
        l_cust_account_rec.account_name        := 'test_account_name_003';
      l_cust_account_rec.status            := 'A';
        l_cust_account_rec.customer_type       := 'R';
        l_cust_account_rec.created_by_module := 'HZ_CPUI';
   
        l_organization_rec.party_rec.party_id := 20054;
   
        hz_cust_account_v2pub.create_cust_account(p_init_msg_list        => fnd_api.g_true,
                                                  p_cust_account_rec     =>   l_cust_account_rec,
                                                  p_organization_rec     =>   l_organization_rec,
                                                  p_customer_profile_rec => l_customer_profile_rec,
                                                  p_create_profile_amt   =>   fnd_api.g_true,
                                                  x_cust_account_id      =>   x_cust_account_id,
                                                  x_account_number       =>   l_account_number,
                                                  x_party_id             =>   l_party_id,
                                                  x_party_number         =>   l_party_number,
                                                  x_profile_id           =>   l_profile_id,
                                                  x_return_status        =>   l_return_status,
                                                  x_msg_count            =>   l_msg_count,
                                                  x_msg_data             =>   l_msg_data);
   
      dbms_output.put_line(l_return_status   || ':' || l_msg_data);
  何雲 2013/4/3 客戶/賬戶/建立
40 12.1.3 AR 更新客戶賬戶 API hz_cust_account_v2pub.update_cust_account   BEGIN
        SELECT cust_account_id,   object_version_number
          INTO l_cust_account_id,   l_object_version_num
          FROM hz_cust_accounts
         WHERE party_id = 20054
           AND account_number =   'test_account_003'
           AND rownum = 1;
      EXCEPTION
        WHEN OTHERS THEN
          l_cust_account_id    := NULL;
          l_object_version_num :=   NULL;
      END;
   
      IF l_cust_account_id IS NOT NULL   AND l_object_version_num IS NOT NULL THEN
          l_cust_account_rec.cust_account_id := l_cust_account_id;
          l_cust_account_rec.customer_type     := 'R';
        --l_cust_account_rec.status          := p_status;
        l_cust_account_rec.account_name   := 'test_account_name_003_new';
     
          hz_cust_account_v2pub.update_cust_account('T',
                                                    l_cust_account_rec,
                                                    l_object_version_num,
                                                    l_return_status,
                                                    l_msg_count,
                                                    l_msg_data);
      END IF;
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/賬戶/更新
41 12.1.3 AR 建立客戶賬戶關係 API hz_cust_account_v2pub.create_cust_acct_relate   l_cust_acct_relate_rec.cust_account_id          := x_cust_account_id;
        l_cust_acct_relate_rec.related_cust_account_id  := 9043;
        l_cust_acct_relate_rec.customer_reciprocal_flag := 'Y';
        l_cust_acct_relate_rec.bill_to_flag             := 'Y';
        l_cust_acct_relate_rec.ship_to_flag             := 'Y';
        l_cust_acct_relate_rec.created_by_module        := 'HZ_CPUI';
   
        hz_cust_account_v2pub.create_cust_acct_relate(p_init_msg_list        => fnd_api.g_true,
                                                      p_cust_acct_relate_rec => l_cust_acct_relate_rec,
                                                      x_return_status        =>   l_return_status,
                                                      x_msg_count            =>   l_msg_count,
                                                      x_msg_data             =>   l_msg_data);
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/賬戶關係/建立
42 12.1.3 AR 更新客戶賬戶關係 API hz_cust_account_v2pub.update_cust_acct_relate   l_cust_acct_relate_rec.cust_account_id         := l_cust_account_id;
        l_cust_acct_relate_rec.related_cust_account_id := 9043;
        --l_cust_acct_relate_rec.customer_reciprocal_flag := 'N';
      l_cust_acct_relate_rec.bill_to_flag   := 'N';
      l_cust_acct_relate_rec.ship_to_flag   := 'N';
      l_cust_acct_relate_rec.status       := 'I';
   
      BEGIN
        SELECT car.object_version_number
          INTO l_object_version_num
          FROM hz_cust_acct_relate   car
         WHERE car.cust_account_id = l_cust_account_id
           AND   car.related_cust_account_id = 9043
           AND rownum = 1;
      EXCEPTION
        WHEN OTHERS THEN
          l_object_version_num :=   NULL;
      END;
   
      hz_cust_account_v2pub.update_cust_acct_relate(p_init_msg_list         => fnd_api.g_true,
                                                      p_cust_acct_relate_rec  =>   l_cust_acct_relate_rec,
                                                      p_object_version_number => l_object_version_num,
                                                      x_return_status         =>   l_return_status,
                                                      x_msg_count             =>   l_msg_count,
                                                      x_msg_data              =>   l_msg_data);
   
        dbms_output.put_line(l_return_status || ':' || l_msg_data);
  何雲 2013/4/3 客戶/賬戶關係/更新
43 12.1.3 AR 建立客戶聯繫人 API hz_party_v2pub.create_person   lrec_person.person_first_name   := '李四-014';
      lrec_person.created_by_module :=   'HZ_CPUI';
   
      lrec_party.status         := 'A';
      lrec_party.validated_flag :=   'N';
      lrec_party.party_number   := l_party_number;
   
      lrec_person.party_rec :=   lrec_party;
   
        hz_party_v2pub.create_person(p_person_rec       => lrec_person,
                                     p_party_usage_code => 'ORG_CONTACT',
                                     x_party_id         => x_party_id,
                                     x_party_number     =>   l_party_number,
                                     x_profile_id       =>   l_profile_id,
                                     x_return_status    =>   l_return_status,
                                     x_msg_count        =>   l_msg_count,
                                     x_msg_data         =>   l_msg_data);
  何雲 2013/4/3 客戶/聯繫人/建立
44 12.1.3 AR 更新客戶聯繫人 API hz_party_v2pub.update_person   SELECT   hr.subject_id, hp.object_version_number
          INTO l_person_id,   l_person_version
          FROM hz_cust_account_roles   hcar, hz_relationships hr, hz_parties hp
         WHERE hcar.party_id =   hr.party_id
           AND hr.directional_flag =   'F'
           AND hr.subject_id =   hp.party_id
           AND hcar.cust_account_role_id   = p_cust_account_role_id;
     
        lrec_person.person_first_name :=   p_interface_data.contact_name;
        --lrec_person.created_by_module   := g_created_by_module;
     
        lrec_party.party_id       := l_person_id;
        lrec_party.status         := 'A';
        lrec_party.validated_flag :=   'N';
     
        lrec_person.party_rec :=   lrec_party;
     
        hz_party_v2pub.update_person(p_person_rec                  => lrec_person,
                                       p_party_object_version_number => l_person_version,
                                       x_profile_id                    => l_profile_id,
                                       x_return_status                 => l_return_status,
                                       x_msg_count                     => l_msg_count,
                                       x_msg_data                      => l_msg_data);
  何雲 2013/4/3 客戶/聯繫人/更新
45 12.1.3 AR 建立客戶與聯繫人的關係 API hz_relationship_v2pub.create_relationship_with_usg   lrec_relationship.subject_type       := 'PERSON';
      lrec_relationship.subject_id         := x_party_id;
        lrec_relationship.subject_table_name := 'HZ_PARTIES';
      lrec_relationship.object_type        := 'ORGANIZATION';
      lrec_relationship.object_id          := 32045;
        lrec_relationship.object_table_name    := 'HZ_PARTIES';
      lrec_relationship.status             := 'A';
        lrec_relationship.created_by_module    := 'HZ_CPUI';
        lrec_relationship.relationship_code    := 'CONTACT_OF';
      lrec_relationship.relationship_type  := 'CONTACT';
      --lrec_relationship.party_rec          := lrec_party;
   
      hz_relationship_v2pub.create_relationship_with_usg(p_relationship_rec         => lrec_relationship,
                                                           x_relationship_id          =>   l_relationship_id,
                                                           x_party_id                 =>   x_party_id,
                                                           x_party_number             =>   l_party_number,
                                                           x_return_status            =>   l_return_status,
                                                           x_msg_count                =>   l_msg_count,
                                                           x_msg_data                 =>   l_msg_data,
                                                           p_contact_party_id         =>   NULL,
                                                           p_contact_party_usage_code => NULL);
  何雲 2013/4/3 客戶/聯繫人/關聯關係
46 12.1.3 AR 建立客戶賬戶角色(用途) API hz_cust_account_role_v2pub.create_cust_account_role   lrec_role.party_id          := x_party_id;
      lrec_role.cust_account_id   := 11043;
      lrec_role.cust_acct_site_id :=   1367;
      lrec_role.status            := 'A';
      lrec_role.created_by_module :=   'HZ_CPUI';
      lrec_role.role_type         := 'CONTACT';
   
        hz_cust_account_role_v2pub.create_cust_account_role(p_cust_account_role_rec   => lrec_role,
                                                            x_cust_account_role_id  =>   l_role_id,
                                                            x_return_status         =>   l_return_status,
                                                            x_msg_count             =>   l_msg_count,
                                                            x_msg_data              =>   l_msg_data);
  何雲 2013/4/3 客戶/賬戶角色/建立
47 12.1.3 AR 建立聯繫方式 API hz_contact_point_v2pub.create_contact_point   IF   p_type = 'CELL_PHONE' THEN
            l_contact_point_rec_type.contact_point_type := 'PHONE';
            l_phone_rec.phone_line_type                   := 'MOBILE';
          l_phone_rec.phone_number                    :=   p_interface_data.cell_phone;
        ELSIF p_type = 'PHONE' THEN
            l_contact_point_rec_type.contact_point_type := 'PHONE';
            l_phone_rec.phone_line_type                 := 'GEN';
          l_phone_rec.phone_number                    :=   p_interface_data.phone;
        ELSIF p_type = 'SHOP_TEL' THEN
            l_contact_point_rec_type.contact_point_type := 'PHONE';
            l_phone_rec.phone_line_type                 := 'GEN_SHOP';
          l_phone_rec.phone_number                    :=   p_interface_data.shop_tel;
        ELSIF p_type = 'EMAIL' THEN
            l_contact_point_rec_type.contact_point_type := 'EMAIL';
          l_email_rec.email_address                   := p_interface_data.email;
        END IF;
     
          l_contact_point_rec_type.status            := 'A';
          l_contact_point_rec_type.owner_table_name  := p_owner_table;
          l_contact_point_rec_type.owner_table_id    := p_owner_id;
          l_contact_point_rec_type.created_by_module :=   g_created_by_module;
     
          hz_contact_point_v2pub.create_contact_point(p_contact_point_rec =>   l_contact_point_rec_type,
                                                      p_email_rec         =>   l_email_rec,
                                                      p_phone_rec         =>   l_phone_rec,
                                                      x_contact_point_id  =>   l_contact_point_id,
                                                      x_return_status     =>   l_return_status,
                                                      x_msg_count         =>   l_msg_count,
                                                      x_msg_data          =>   l_msg_data);
  何雲 2013/4/3 客戶/聯繫方式/建立
48 12.1.3 AR 更新聯繫方式 API hz_contact_point_v2pub.update_contact_point   IF   p_type = 'CELL_PHONE' THEN
            l_contact_point_rec_type.contact_point_type := 'PHONE';
            l_phone_rec.phone_line_type                   := 'MOBILE';
          l_phone_rec.phone_number                    :=   p_interface_data.cell_phone;
        ELSIF p_type = 'PHONE' THEN
            l_contact_point_rec_type.contact_point_type := 'PHONE';
            l_phone_rec.phone_line_type                 := 'GEN';
          l_phone_rec.phone_number                    :=   p_interface_data.phone;
        ELSIF p_type = 'SHOP_TEL' THEN
            l_contact_point_rec_type.contact_point_type := 'PHONE';
            l_phone_rec.phone_line_type                 := 'GEN_SHOP';
          l_phone_rec.phone_number                    :=   p_interface_data.shop_tel;
        ELSIF p_type = 'EMAIL' THEN
            l_contact_point_rec_type.contact_point_type := 'EMAIL';
          l_email_rec.email_address                   := p_interface_data.email;
        END IF;
     
          l_contact_point_rec_type.status           := 'A';
          l_contact_point_rec_type.contact_point_id := p_contact_point_id;
          l_contact_point_rec_type.primary_flag     := 'Y';
          --l_contact_point_rec_type.created_by_module :=   g_created_by_module;
     
          hz_contact_point_v2pub.update_contact_point(p_contact_point_rec     => l_contact_point_rec_type,
                                                      p_object_version_number => l_object_version_number,
                                                      p_email_rec             =>   l_email_rec,
                                                      p_phone_rec             =>   l_phone_rec,
                                                      x_return_status         =>   l_return_status,
                                                      x_msg_count             =>   l_msg_count,
                                                      x_msg_data              =>   l_msg_data);
  何雲 2013/4/3 客戶/聯繫方式/更新
49 12.1.3 BOM 複製工藝路線 API bom_copy_routing.copy_routing   DECLARE
      l_routing_sequence_id NUMBER :=   bom_operation_sequences_s.nextval;
    BEGIN
        fnd_global.apps_initialize(user_id        => 1111,
                                   resp_id      => 50657,
                                   resp_appl_id => 706);
        bom_copy_routing.copy_routing(to_sequence_id   => 131006,   --l_routing_sequence_id,
                                    from_sequence_id   => 94002,
                                      from_org_id      => 81,
                                      to_org_id        => 81,
                                      to_item_id       =>   3008,
                                      direction        => 1,
                                      to_alternate     =>   'HFV',
                                      rev_date         =>   SYSDATE);
        dbms_output.put_line(l_routing_sequence_id);
    END;
  趙楊 2013/3/30 工藝路線
50 12.1.3 BOM 建立工藝路線 API bom_rtg_pub.process_rtg   "--init
        g_rtg_header_rec :=   bom_rtg_pub.g_miss_rtg_header_rec;
        g_rtg_revs_tbl   := bom_rtg_pub.g_miss_rtg_revision_tbl;
        g_op_tbl         :=   bom_rtg_pub.g_miss_operation_tbl;
        g_op_res_tbl     :=   bom_rtg_pub.g_miss_op_resource_tbl;
        g_sub_op_res_tbl :=   bom_rtg_pub.g_miss_sub_resource_tbl;
        g_nwk_tbl        := bom_rtg_pub.g_miss_op_network_tbl;
     
        --assigment value
          g_rtg_header_rec.assembly_item_name       := p_assembly_item_name;
          g_rtg_header_rec.organization_code        := p_organization_code; --rtg_header_rec.ORGANIZATION_CODE
          g_rtg_header_rec.alternate_routing_code := p_alternate;   --rtg_header_rec.ALTERNATE_ROUTING_DESIGNATOR
        g_rtg_header_rec.eng_routing_flag       := p_eng_routing_flag; --   2=Engineering routing 1=Manufacturing routing
          --g_rtg_header_rec.common_assembly_item_name :=   rtg_header_rec.common_item_number;
        g_rtg_header_rec.routing_comment   := p_routing_comment;
          --g_rtg_header_rec.completion_subinventory   := rtg_header_rec.completion_subinventory;
          --g_rtg_header_rec.completion_location_name  := rtg_header_rec.location_name;
        --g_rtg_header_rec.line_code                 :=   rtg_header_rec.line_code;
          --g_rtg_header_rec.cfm_routing_flag          := rtg_header_rec.cfm_routing_flag;
          g_rtg_header_rec.mixed_model_map_flag := p_mixed_model_map_flag;   --rtg_header_rec.mixed_model_map_flag;
        --g_rtg_header_rec.priority                  :=   rtg_header_rec.priority;
          --g_rtg_header_rec.total_cycle_time          :=   rtg_header_rec.total_product_cycle_time;
        g_rtg_header_rec.ctp_flag                  := p_ctp_flag;   --rtg_header_rec.ctp_flag;
        g_rtg_header_rec.original_system_reference   := p_original_system_ref; --rtg_header_rec.original_system_reference; --   newly added
          g_rtg_header_rec.transaction_type          := 'CREATE';
          --g_rtg_header_rec.delete_group_name         := rtg_header_rec.delete_group_name;   -- newly added
        --g_rtg_header_rec.dg_description            := rtg_header_rec.dg_description;   -- newly added
          --g_rtg_header_rec.ser_start_op_seq          := rtg_header_rec.serialization_start_op;   -- newly added
        --g_rtg_header_rec.row_identifier   := g_rtg_header_rec.original_system_reference; -- newly added ********
        --g_rtg_header_rec.return_status  := '';
     
        --call api
        bom_rtg_pub.process_rtg(p_bo_identifier      => 'RTG',
                                  p_api_version_number => 1.0,
                                  p_init_msg_list      =>   TRUE,
                                  p_rtg_header_rec     =>   g_rtg_header_rec,
                                  p_rtg_revision_tbl   =>   g_rtg_revs_tbl,
                                  p_operation_tbl      =>   g_op_tbl,
                                  p_op_resource_tbl    =>   g_op_res_tbl,
                                  p_sub_resource_tbl   =>   g_sub_op_res_tbl,
                                  p_op_network_tbl     => g_nwk_tbl,
                                  x_rtg_header_rec     =>   g_rtg_header_rec,
                                  x_rtg_revision_tbl   =>   g_rtg_revs_tbl,
                                  x_operation_tbl      =>   g_op_tbl,
                                  x_op_resource_tbl    =>   g_op_res_tbl,
                                  x_sub_resource_tbl   => g_sub_op_res_tbl,
                                  x_op_network_tbl     =>   g_nwk_tbl,
                                  x_return_status      =>   l_ret_status,
                                  x_msg_count          =>   l_msg_count,
                                  p_debug              =>   'N',
                                  p_output_dir         =>   'none',
                                  p_debug_filename     =>   'none');
  趙楊 2013/3/30 工藝路線/導入
51 12.1.3 BOM 建立物料清單 API BOM_BO_PUB.PROCESS_BOM   "--   BOM
          l_bom_header_rec.transaction_type        := 'CREATE';
          l_bom_header_rec.organization_code       := l_cur_mfg_org_code;
          l_bom_header_rec.assembly_item_name      := 'CN92777';
          l_bom_header_rec.alternate_bom_code      := 'SBOM';
          l_bom_header_rec.bom_implementation_date := SYSDATE;
       
          l_bom_component_tbl(l_index).transaction_type := 'CREATE';
          l_bom_component_tbl(l_index).organization_code :=   l_bom_header_rec.organization_code;
          l_bom_component_tbl(l_index).assembly_item_name :=   l_bom_header_rec.assembly_item_name;
          l_bom_component_tbl(l_index).alternate_bom_code :=   l_bom_header_rec.alternate_bom_code;
          l_bom_component_tbl(l_index).item_sequence_number := 10;
          l_bom_component_tbl(l_index).component_item_name := 'SB56349';
          l_bom_component_tbl(l_index).quantity_per_assembly := 123;
          l_bom_component_tbl(l_index).start_effective_date :=   l_bom_header_rec.bom_implementation_date;*/
     
          BOM_BO_PUB.PROCESS_BOM(P_BO_IDENTIFIER          => 'BOM',
                                 P_API_VERSION_NUMBER     =>   1.0,
                                 P_INIT_MSG_LIST          =>   TRUE,
                                 P_BOM_HEADER_REC         =>   P_BOM_HEADER_REC,
                                 P_BOM_COMPONENT_TBL      =>   P_BOM_COMPONENT_TBL,
                                 X_BOM_HEADER_REC         =>   X_BOM_HEADER_REC,
                                 X_BOM_REVISION_TBL       =>   X_BOM_REVISION_TBL,
                                 X_BOM_COMPONENT_TBL      =>   X_BOM_COMPONENT_TBL,
                                 X_BOM_REF_DESIGNATOR_TBL => X_BOM_REF_DESIGNATOR_TBL,
                                 X_BOM_SUB_COMPONENT_TBL  =>   X_BOM_SUB_COMPONENT_TBL,
                                 X_BOM_COMP_OPS_TBL       => X_BOM_COMP_OPS_TBL,
                                 X_RETURN_STATUS          =>   X_RETURN_STATUS,
                               X_MSG_COUNT              => X_MSG_COUNT,
                                 P_DEBUG                  =>   'Y',
                                 P_OUTPUT_DIR             =>   '/usr/tmp');
     
        --Result
        IF X_RETURN_STATUS <>   FND_API.G_RET_STS_SUCCESS THEN
            ERROR_HANDLER.GET_MESSAGE_LIST(X_MESSAGE_LIST =>   X_MESSAGE_LIST);
          FOR I IN 1 ..   X_MESSAGE_LIST.COUNT LOOP
            XXFND_CONC_UTL.LOG_MSG('BO   Identifier       : ' ||   X_MESSAGE_LIST(I)
                                     .BO_IDENTIFIER);
              XXFND_CONC_UTL.LOG_MSG('Organization ID : ' || X_MESSAGE_LIST(I)
                                     .ORGANIZATION_ID);
              XXFND_CONC_UTL.LOG_MSG('Entity ID              : ' || X_MESSAGE_LIST(I)
                                     .ENTITY_ID);
              XXFND_CONC_UTL.LOG_MSG('Message Text      : ' ||
                                     SUBSTR(X_MESSAGE_LIST(I).MESSAGE_TEXT,
                                            1,
                                            200));
              XXFND_CONC_UTL.LOG_MSG('Entity Index        : ' || X_MESSAGE_LIST(I)
                                     .ENTITY_INDEX);
              XXFND_CONC_UTL.LOG_MSG('Message Type     : ' || X_MESSAGE_LIST(I)
                                     .MESSAGE_TYPE);
            XXFND_CONC_UTL.LOG_MSG('Table   Name        : ' ||   X_MESSAGE_LIST(I)
                                     .TABLE_NAME);
            XXFND_CONC_UTL.LOG_MSG('Row   Identifier    : ' ||   X_MESSAGE_LIST(I)
                                     .ROW_IDENTIFIER);
          END LOOP;
       
          IF (X_RETURN_STATUS =   FND_API.G_RET_STS_UNEXP_ERROR) THEN
            RAISE   FND_API.G_EXC_UNEXPECTED_ERROR;
          ELSIF (X_RETURN_STATUS =   FND_API.G_RET_STS_ERROR) THEN
            RAISE   FND_API.G_EXC_ERROR;
          END IF;
       
        ELSE
            XXFND_CONC_UTL.LOG_MSG(X_BOM_HEADER_REC.ASSEMBLY_ITEM_NAME);
       
        END IF;
  趙楊 2013/3/30 BOM/物料清單/導入
52 12.1.1 BOM 流式工藝路線繪圖 API bom_op_network_util.perform_writes       蘇聯章 2013/3/31 Flow   Routing/連線繪圖
53 12.1.1 BOM 建立ECO API Eng_Eco_PUB.Process_Eco       蘇聯章 2013/3/31 ECO/導入
54 12.0.6 BOM 物料清單展開 API bompexpl.exploder_userexit   bompexpl.exploder_userexit(verify_flag       => NULL,
                                 org_id            =>   p_org_id,
                                 order_by          => 1,
                                 grp_id            =>   x_group_id,
                                 session_id        =>   NULL,
                                 levels_to_explode => 10000000,
                                 bom_or_eng        => 1,
                               impl_flag         => 1,
                                 plan_factor_flag  =>   NULL,
                                 explode_option    =>   p_explode_option, --1:all, 2:current, 3:current and future
                                 module            => 2,
                                 cst_type_id       =>   NULL,
                                 std_comp_flag     => 2,
                                 expl_qty          => 1,
                                 item_id           =>   p_item_id,
                                 alt_desg          =>   NULL,
                                 comp_code         =>   NULL,
                                 rev_date          =>   to_char(SYSDATE,'yyyy/mm/dd hh24:mi:ss'),
                                 err_msg           =>   l_error_message,
                                 ERROR_CODE        =>   l_error_code);
  黎法良 2013/3/31 物料清單展開
55 12.0.6 BOM 物料成本導入/更新 接口 BOM.CSTPCIMP   v_num_request_id   := fnd_request.submit_request(application => 'BOM',
                                                     program     =>   'CSTPCIMP',
                                                     description => NULL,
                                                     start_time  => NULL,
                                                     sub_request => FALSE,
                                                     argument1   => 1, --Import   cost only
                                                     argument2   => 2, --Mode to   run this request
                                                     argument3   => 1, --Group ID   option
                                                     argument4   => 1, --Group ID   Dummy
                                                     argument5   => v_num_tmp,   --Group ID
                                                     argument6   => l_cost_type,   --Cost type to import to
                                                     argument7   =>   i_chr_delete_flag --Delete successful rows
                                                     );
  黎法良 2013/3/31 物料成本/導入/更新
56 12.0.6 BOM 物料清單導入/更新 接口 BOM.BMCOIN   l_request_id   := fnd_request.submit_request('BOM',
                                                 'BMCOIN',
                                                  '',
                                                  to_char(SYSDATE, 'YYYY/MM/DD HH24:MI:SS'),
                                                  FALSE,
                                                  l_organization_id,
                                                  2,   --All organizations(N)
                                                  2,   --Import Routing(N)
                                                  1,   --Import BOM(Y)
                                                  2,   --Delete Processed   Rows(N)
                                                  g_request_id,
                                                  chr(0));
  黎法良 2013/3/31 物料清單/導入/更新
57 12.0.6 BOM 工藝路線導入/更新 接口 BOM.BMCOIN   l_request_id   := fnd_request.submit_request(application => 'BOM',
                                                 program     =>   'BMCOIN',
                                                 description => NULL,
                                                 start_time  => NULL,
                                                 sub_request => FALSE,
                                                 argument1   =>   l_organization_id, --Organization id
                                                 argument2   => 2, --All   organizations(N)
                                                 argument3   => 1, --Import   Routing(Y)
                                                 argument4   => 2, --Import   BOM(N)
                                                 argument5   => 1 --Delete   Processed Rows
                                                 );
  黎法良 2013/3/31 工藝路線/導入/更新
58 12.1.3 BOM ECO導入 接口 BOM.ENGCHGIMP 接口表:bom_inventory_comps_interface
    eng_revised_items_interface
    eng_eng_changes_interface
fnd_request.submit_request('ENG',
                                                       'ENGCHGIMP',
                                                       NULL,
                                                       NULL,
                                                       FALSE,
                                                       l_eco_rec.organization_id,
                                                       1,
                                                       1,
                                                       chr(0))
  羅建波 2013/4/3 ECO導入
59 12.1.3 CE Bank   Statement銀行對帳單導入 接口 CE.ARPLABIM 接口表:
    ce_statement_headers_int_all
    ce_statement_lines_interface
    錯誤表:
    ce_header_interface_errors
    ce_line_interface_errors
   
DECLARE
      l_iface_h_rec   ce_statement_headers_int_all%ROWTYPE;
      l_iface_l_rec   ce_statement_lines_interface%ROWTYPE;
      l_user_id     NUMBER := 0; --User ID
    BEGIN
      --頭表
      l_iface_h_rec.last_update_date :=   SYSDATE;
      l_iface_h_rec.last_updated_by  := l_user_id;
      l_iface_h_rec.creation_date    := SYSDATE;
      l_iface_h_rec.created_by       := l_user_id;
   
      l_iface_h_rec.org_id                := 81;
      l_iface_h_rec.statement_number      := 'CMTEST000004';
      l_iface_h_rec.bank_account_num      := '00648708404001';
      l_iface_h_rec.bank_name             := '中國銀行';
      l_iface_h_rec.bank_branch_name      := '合肥市經開區分理處';
      l_iface_h_rec.statement_date        := SYSDATE;
      l_iface_h_rec.control_begin_balance   := 1000;
      l_iface_h_rec.control_total_dr      := 100; --Payment
      l_iface_h_rec.control_total_cr      := 50; --Receipt
        l_iface_h_rec.control_end_balance     := 950; --control_end_balance = control_begin_balance - control_total_dr   + control_total_cr
        l_iface_h_rec.record_status_flag      := 'N';
      l_iface_h_rec.currency_code         := 'CNY';
      INSERT INTO   ce_statement_headers_int_all VALUES l_iface_h_rec;
   
      --行表
      l_iface_l_rec.last_update_date :=   SYSDATE;
      l_iface_l_rec.last_updated_by  := l_user_id;
      l_iface_l_rec.creation_date    := SYSDATE;
      l_iface_l_rec.created_by       := l_user_id;
   
      l_iface_l_rec.statement_number :=   'CMTEST000004';
      l_iface_l_rec.bank_account_num :=   '00648708404001';
      l_iface_l_rec.line_number      := 1;
      l_iface_l_rec.trx_date         := SYSDATE;
      l_iface_l_rec.trx_code         := 'PAY';   --根據定義,決定究竟是Receipt仍是Payment
      l_iface_l_rec.amount           := 50; --sum(receipt   amount)-sum(Payment amount)=control_total_cr-control_total_dr 
   
      INSERT INTO   ce_statement_lines_interface VALUES l_iface_l_rec;
    END;
   
功能導航   N: Cash Management/Bank Reconciliation/Bank Statements
    官方文檔 115ceug.pdf:Oracle Cash Management User Guide
蘇聯章 2013/4/8 銀行對帳單/導入
60 12.0.6 CST 物料成本導入/更新 API cst_item_cost_import_interface.start_item_cost_import_process   cst_item_cost_import_interface.start_item_cost_import_process(error_number   => l_error_num,
                                                                    i_next_value => l_cst_lists,
                                                                    i_grp_id     =>   l_cst_lists,
                                                                    i_del_option => 2, -- not delete records after successful   import
                                                                    i_cost_type  =>   rec_cost_type.cost_type,
                                                                    i_run_option => p_run_option --Mode to run this request, 1: insert   only mode, 2: rem and replace mode
                                                                    );
Mode   to run this request, 1: insert only mode, 2: rem and replace mode 黎法良 2013/3/31 物料成本/導入/更新
61 12.1.3 FND 獲取關鍵性彈性域組合說明 API fnd_flex_keyval.concatenated_descriptions   FUNCTION   get_key_concatenated_desc(p_appl_short_name VARCHAR2,
                                           p_key_flex_code     VARCHAR2,
                                           p_coa_id          NUMBER,
                                           p_accid           NUMBER,
                                           p_data_set        NUMBER DEFAULT   NULL)
        RETURN VARCHAR2 IS
        lv_desc  VARCHAR2(2000);
        lb_value BOOLEAN;
      BEGIN
     
        lb_value :=   fnd_flex_keyval.validate_ccid(appl_short_name    => p_appl_short_name,
                                                    key_flex_code    =>   p_key_flex_code,
                                                    structure_number => p_coa_id,
                                                    combination_id   =>   p_accid,
                                                    data_set         =>   p_data_set);
     
        IF lb_value THEN
          lv_desc := fnd_flex_keyval.concatenated_descriptions;
        END IF;
     
        RETURN lv_desc;
      END get_key_concatenated_desc;
  趙楊 2013/3/30 彈性域/說明
62 12.1.3 FND 驗證鍵值彈性域 API fnd_flex_descval.validate_desccols   FUNCTION   validate_desc_cols(pi_appl_short_name      IN VARCHAR2
                                   ,pi_desc_flex_name     IN   VARCHAR2
                                   ,pi_validation_date    IN DATE   DEFAULT SYSDATE
                                   ,pi_enabled_activation IN BOOLEAN DEFAULT TRUE
                                   ,pi_resp_appl_id       IN NUMBER   DEFAULT NULL
                                 ,pi_resp_id            IN NUMBER DEFAULT NULL
                                 ,
                                  -- the   following params are dff count and values
                                    pi_attributes_count   IN NUMBER   DEFAULT 15
                                   ,pi_attribute_category IN VARCHAR2 DEFAULT NULL
                                   ,pi_attribute1         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute2         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute3         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute4         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute5         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute6         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute7         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute8         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute9         IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute10        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute11        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute12        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute13        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute14        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute15        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute16        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute17        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute18        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute19        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute20        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute21        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute22        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute23        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute24        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute25        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute26        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute27        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute28        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute29        IN   VARCHAR2 DEFAULT NULL
                                   ,pi_attribute30        IN   VARCHAR2 DEFAULT NULL
                                   ,po_attr_ids           OUT   fnd_flex_server1.valueidarray
                                    --,po_err_seg_num        OUT   NUMBER
                                   ,po_err_msg OUT VARCHAR2) RETURN BOOLEAN IS
        lb_dummy BOOLEAN;
      BEGIN
     
        -- clear column values buffer
          fnd_flex_descval.clear_column_values;
     
        -- set context value
          fnd_flex_descval.set_context_value(pi_attribute_category);
     
        IF pi_attributes_count > 30 OR   pi_attributes_count <= 0 THEN
            raise_application_error(-20001
                                   ,'Invalid value pi_attributes_count when calling   validate_dff_value');
        END IF;
     
        IF pi_attributes_count >= 1   THEN
          fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE1'
                                             ,column_value => pi_attribute1);
        END IF;
        IF pi_attributes_count >= 2   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE2'
                                             ,column_value => pi_attribute2);
        END IF;
        IF pi_attributes_count >= 3   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE3'
                                             ,column_value => pi_attribute3);
        END IF;
        IF pi_attributes_count >= 4   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE4'
                                             ,column_value => pi_attribute4);
        END IF;
        IF pi_attributes_count >= 5   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE5'
                                             ,column_value => pi_attribute5);
        END IF;
        IF pi_attributes_count >= 6   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE6'
                                             ,column_value => pi_attribute6);
        END IF;
        IF pi_attributes_count >= 7   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE7'
                                             ,column_value => pi_attribute7);
        END IF;
        IF pi_attributes_count >= 8   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE8'
                                             ,column_value => pi_attribute8);
        END IF;
        IF pi_attributes_count >= 9   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE9'
                                             ,column_value => pi_attribute9);
        END IF;
        IF pi_attributes_count >= 10   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE10'
                                             ,column_value => pi_attribute10);
        END IF;
        IF pi_attributes_count >= 11   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE11'
                                             ,column_value => pi_attribute11);
        END IF;
        IF pi_attributes_count >= 12   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE12'
                                             ,column_value => pi_attribute12);
        END IF;
        IF pi_attributes_count >= 13   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE13'
                                             ,column_value => pi_attribute13);
        END IF;
        IF pi_attributes_count >= 14   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE14'
                                             ,column_value => pi_attribute14);
        END IF;
        IF pi_attributes_count >= 15   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE15'
                                             ,column_value => pi_attribute15);
        END IF;
        IF pi_attributes_count >= 16   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE16'
                                             ,column_value => pi_attribute16);
        END IF;
        IF pi_attributes_count >= 17   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE17'
                                             ,column_value => pi_attribute17);
        END IF;
        IF pi_attributes_count >= 18   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE18'
                                             ,column_value => pi_attribute18);
        END IF;
        IF pi_attributes_count >= 19   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE19'
                                             ,column_value => pi_attribute19);
        END IF;
        IF pi_attributes_count >= 20   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE20'
                                             ,column_value => pi_attribute20);
        END IF;
        IF pi_attributes_count >= 21   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE21'
                                             ,column_value => pi_attribute21);
        END IF;
        IF pi_attributes_count >= 22   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE22'
                                             ,column_value => pi_attribute22);
        END IF;
        IF pi_attributes_count >= 23   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE23'
                                             ,column_value => pi_attribute23);
        END IF;
        IF pi_attributes_count >= 24   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE24'
                                             ,column_value => pi_attribute24);
        END IF;
        IF pi_attributes_count >= 25   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE25'
                                             ,column_value => pi_attribute25);
        END IF;
        IF pi_attributes_count >= 26   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE26'
                                             ,column_value => pi_attribute26);
        END IF;
        IF pi_attributes_count >= 27   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE27'
                                             ,column_value => pi_attribute27);
        END IF;
        IF pi_attributes_count >= 28   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE28'
                                             ,column_value => pi_attribute28);
        END IF;
        IF pi_attributes_count >= 29   THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE29'
                                             ,column_value => pi_attribute29);
        END IF;
        IF pi_attributes_count = 30 THEN
            fnd_flex_descval.set_column_value(column_name  => 'ATTRIBUTE30'
                                             ,column_value => pi_attribute30);
        END IF;
     
        -- Use standard API to validate   attribute values
        lb_dummy :=   fnd_flex_descval.validate_desccols(appl_short_name    => pi_appl_short_name
                                                        ,desc_flex_name     =>   pi_desc_flex_name
                                                        ,values_or_ids      => 'V'
                                                        , /* We always transfer dff values for validation   */validation_date    =>   pi_validation_date
                                                        ,enabled_activation => pi_enabled_activation
                                                        ,resp_appl_id       =>   pi_resp_appl_id
                                                        ,resp_id            =>   pi_resp_id);
     
        IF NOT lb_dummy THEN
          --po_err_seg_num :=   fnd_flex_descval.error_segment;
          po_err_msg := 'Attribute' ||   fnd_flex_descval.error_segment || ':' ||
                          fnd_flex_descval.error_message;
          RETURN FALSE;
        END IF;
     
        -- init return table
        FOR i IN 1 .. pi_attributes_count   LOOP
          po_attr_ids(i) := '';
        END LOOP;
     
        -- Set attributes id
        -- NOTE: 1.   fnd_flex_descval.segment_count always >=1;
        --       2. We donot need attribute_category   id, context has no id.
        FOR i IN 1 ..   fnd_flex_descval.segment_count LOOP
          IF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE1' THEN
            po_attr_ids(1) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE2' THEN
            po_attr_ids(2) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE3' THEN
            po_attr_ids(3) := fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE4' THEN
            po_attr_ids(4) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE5' THEN
            po_attr_ids(5) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE6' THEN
            po_attr_ids(6) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE7' THEN
            po_attr_ids(7) :=   fnd_flex_descval.segment_id(i);
          ELSIF fnd_flex_descval.segment_column_name(i)   = 'ATTRIBUTE8' THEN
            po_attr_ids(8) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE9' THEN
            po_attr_ids(9) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE10' THEN
            po_attr_ids(10) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE11' THEN
            po_attr_ids(11) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE12' THEN
            po_attr_ids(12) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE13' THEN
            po_attr_ids(13) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE14' THEN
            po_attr_ids(14) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE15' THEN
            po_attr_ids(15) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE16' THEN
            po_attr_ids(16) :=   fnd_flex_descval.segment_id(i);
          ELSIF fnd_flex_descval.segment_column_name(i)   = 'ATTRIBUTE17' THEN
            po_attr_ids(17) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE18' THEN
            po_attr_ids(18) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE19' THEN
            po_attr_ids(19) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE20' THEN
            po_attr_ids(20) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE21' THEN
            po_attr_ids(21) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE22' THEN
            po_attr_ids(22) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE23' THEN
            po_attr_ids(23) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE24' THEN
            po_attr_ids(24) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE25' THEN
            po_attr_ids(25) :=   fnd_flex_descval.segment_id(i);
          ELSIF fnd_flex_descval.segment_column_name(i)   = 'ATTRIBUTE26' THEN
            po_attr_ids(26) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE27' THEN
            po_attr_ids(27) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE28' THEN
            po_attr_ids(28) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE29' THEN
            po_attr_ids(29) :=   fnd_flex_descval.segment_id(i);
          ELSIF   fnd_flex_descval.segment_column_name(i) = 'ATTRIBUTE30' THEN
            po_attr_ids(30) :=   fnd_flex_descval.segment_id(i);
          END IF;
        END LOOP;
     
        --po_err_seg_num := '';
        po_err_msg := '';
        RETURN TRUE;
     
      EXCEPTION
        WHEN OTHERS THEN
          po_err_msg := gvc_tab1 ||
                        '**Error03.91:   Raise error when validate DFF.' ||
                          fnd_global.newline || gvc_tab1 || -sqlcode || ',' ||
                        REPLACE(SQLERRM,   gvc_new_line, gvc_new_line || gvc_tab1);
          RETURN FALSE;
      END;
  蘇聯章 2013/3/31 彈性域/驗證
63 12.1.3 FND 獲取幣種格式掩碼 API fnd_currency.get_format_mask       趙楊 2013/3/30 幣種/掩碼
64 12.1.3 GL 匯率轉換 API gl_currency_api.get_rate       趙楊 2013/3/30 匯率/幣種
65 12.1.3 GL 查詢單段賬戶組合的描述 API gl_flexfields_pkg.get_description_sql   SELECT   gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,
                                                   1,
                                                   gcc.segment1)
      FROM gl_code_combinations gcc
  何雲 2013/4/3 賬戶組合/描述/單段
66 12.1.3 GL 查詢完整賬戶組合的描述 API gl_flexfields_pkg.get_concat_description   SELECT   gl_flexfields_pkg.get_concat_description(gcc.chart_of_accounts_id,
                                                      gcc.code_combination_id)
      FROM gl_code_combinations gcc
  何雲 2013/4/3 賬戶組合/描述
67 12.1.3 GL 幣種金額轉換 API gl_currency_api.convert_amount   gl_currency_api.convert_amount   (
            x_from_currency        VARCHAR2,
            x_to_currency        VARCHAR2,
            x_conversion_date    DATE,--通常取期間最後一天
            x_conversion_type    VARCHAR2 DEFAULT   NULL,--轉換類型,通常是Corporate
            x_amount        NUMBER )
  陳範冬 2013/4/1 幣種/金額轉換
68 12.1.3 GL 日記帳導入 接口 SQLGL.GLLEZL gl_interface
    gl_interface_control
DECLARE
      l_iface_rec             gl_interface%ROWTYPE;
      l_request_id            NUMBER;
      l_set_of_books_id       NUMBER := 2021;
      l_user_je_source_name   gl_je_sources_tl.user_je_source_name%TYPE   := '人工';
      l_user_je_category_name   gl_je_categories_tl.user_je_category_name%TYPE := '記賬憑證';
      l_je_source_name          gl_je_sources_tl.je_source_name%TYPE;
      l_interface_run_id      NUMBER;
    BEGIN
   
        fnd_global.apps_initialize(user_id        => 0,
                                   resp_id      => 20434,
                                   resp_appl_id => 101);
   
      --submit request
      SELECT MAX(jes.je_source_name)
        INTO l_je_source_name
        FROM gl_je_sources_vl jes
       WHERE jes.user_je_source_name =   l_user_je_source_name;
   
      SELECT   gl_interface_control_s.nextval INTO l_interface_run_id FROM dual;
   
      SELECT   gl_interface_control_s.nextval
        INTO l_iface_rec.group_id
        FROM dual;
   
      l_iface_rec.status                := 'NEW';
      l_iface_rec.set_of_books_id       := l_set_of_books_id;
      l_iface_rec.accounting_date       := SYSDATE + 1; --有效日期
      l_iface_rec.date_created          := SYSDATE;
      l_iface_rec.period_name           := '2012-12'; --期間
      l_iface_rec.created_by            := fnd_global.user_id;
      l_iface_rec.actual_flag           := 'A';
        l_iface_rec.user_je_source_name     := l_user_je_source_name;
      l_iface_rec.user_je_category_name   := l_user_je_category_name;
      l_iface_rec.reference1            := 'TestBatchName010';
      l_iface_rec.reference4            := 'Test JL first name   010001';
      l_iface_rec.reference5            := 'Reference5'; --頭說明
      l_iface_rec.reference10           := 'Reference10'; --行說明
      l_iface_rec.currency_code         := 'CNY';
   
      --dr
      l_iface_rec.code_combination_id :=   48809;
      l_iface_rec.entered_dr          := 100;
      l_iface_rec.accounted_dr        := 100;
      l_iface_rec.entered_cr          := NULL;
      l_iface_rec.accounted_cr        := NULL;
      INSERT INTO gl_interface VALUES   l_iface_rec;
   
      --cr
      l_iface_rec.code_combination_id :=   48809;
      l_iface_rec.entered_dr          := NULL;
      l_iface_rec.accounted_dr        := NULL;
      l_iface_rec.entered_cr          := 100;
      l_iface_rec.accounted_cr        := 100;
      INSERT INTO gl_interface VALUES   l_iface_rec;
   
      --start test
      l_iface_rec.status                := 'NEW';
      l_iface_rec.set_of_books_id       := l_set_of_books_id;
      l_iface_rec.accounting_date       := SYSDATE + 1; --有效日期
      l_iface_rec.date_created          := SYSDATE;
      l_iface_rec.period_name           := '2012-12'; --期間
      l_iface_rec.created_by            := fnd_global.user_id;
      l_iface_rec.actual_flag           := 'A';
      l_iface_rec.user_je_source_name   := l_user_je_source_name;
      l_iface_rec.user_je_category_name   := l_user_je_category_name;
      l_iface_rec.reference1            := 'TestBatchName010';
      l_iface_rec.reference4            := 'Test JL first name   010002';
      l_iface_rec.reference5            := 'Reference5'; --頭說明
      l_iface_rec.reference10           := 'Reference10'; --行說明
      l_iface_rec.currency_code         := 'CNY';
   
      --dr
      l_iface_rec.code_combination_id :=   48809;
      l_iface_rec.entered_dr          := 100;
      l_iface_rec.accounted_dr        := 100;
      l_iface_rec.entered_cr          := NULL;
      l_iface_rec.accounted_cr        := NULL;
      INSERT INTO gl_interface VALUES   l_iface_rec;
   
      --cr
      l_iface_rec.code_combination_id :=   48809;
      l_iface_rec.entered_dr          := NULL;
      l_iface_rec.accounted_dr        := NULL;
      l_iface_rec.entered_cr          := 100;
      l_iface_rec.accounted_cr        := 100;
      INSERT INTO gl_interface VALUES   l_iface_rec;
      --end test
   
      INSERT INTO   gl_interface_control
        (je_source_name, group_id,   interface_run_id, set_of_books_id, status)
      VALUES
        (l_je_source_name,
         l_iface_rec.group_id,
         l_interface_run_id,
         l_set_of_books_id,
         'S');
   
      l_request_id :=   fnd_request.submit_request('SQLGL',
                                                   'GLLEZL',
                                                   '',
                                                   to_char(SYSDATE,
                                                           'YYYY/MM/DD HH24:MI:SS'),
                                                   FALSE,
                                                   l_interface_run_id,
                                                   l_set_of_books_id, --賬套id
                                                   'N',
                                                   NULL,
                                                   NULL,
                                                   'N',
                                                   'O',
                                                   chr(0));
   
      COMMIT;
      dbms_output.put_line('Request ID '   || l_request_id);
    END;
  何雲 2013/4/3 日記帳/導入
69 12.1.1 HR 建立HR職務 API hr_job_api.create_job    hr_job_api.create_job(p_validate              => FALSE,
                              p_business_group_id     =>   0,
                              p_date_from             =>   to_date('1-1-1950',
                                                                 'MM-DD-RRRR'),
                              p_job_group_id          =>   1,
                              p_segment1              =>   'HEA',
                              p_segment2              =>   'SPPM',
                              p_segment3              =>   'SECTION MANAGER',
                              p_language_code         =>   hr_api.userenv_lang,
                            p_job_id                => x_job_id,
                              p_object_version_number => x_object_version_number,
                              p_job_definition_id     => x_job_definition_id,
                            p_name                  => x_name);
  蘇聯章 2013/3/31 HR   JOB/建立
70 12.1.1 HR 更新HR分配 API hr_assignment_api.update_emp_asg_criteria    hr_assignment_api.update_emp_asg_criteria(p_effective_date          => SYSDATE,
                                                  p_datetrack_update_mode   =>   hr_api.g_correction,
                                                  p_assignment_id           =>   1630,
                                                  p_validate                =>   FALSE,
                                                  p_called_from_mass_update => FALSE,
                                                  p_grade_id                =>   hr_api.g_number,
                                                  --p_position_id               => 4142,
                                                  p_job_id          => 3083,   --x_job_id,
                                                  p_payroll_id      =>   hr_api.g_number,
                                                  p_location_id     =>   hr_api.g_number,
                                                  p_organization_id => 84,
                                                  --p_segment1                       =>'SHE FAC',
                                                  p_pay_basis_id                   => hr_api.g_number,
                                                  p_object_version_number          => l_object_version_number,
                                                  p_special_ceiling_step_id        => x_special_ceiling_step_id,
                                                  p_people_group_id                => x_people_group_id,
                                                  p_soft_coding_keyflex_id         => x_soft_coding_keyflex_id,
                                                  p_group_name                     => x_group_name,
                                                  p_effective_start_date           => x_effective_start_date,
                                                  p_effective_end_date             => x_effective_end_date,
                                                  p_org_now_no_manager_warning     => x_org_now_no_manager_warning,
                                                  p_other_manager_warning          => x_other_manager_warning,
                                                  p_spp_delete_warning             => x_spp_delete_warning,
                                                  p_entries_changed_warning        => x_entries_changed_warning,
                                                  p_tax_district_changed_warning =>   x_tax_district_changed_warning,
                                                  p_concatenated_segments          => x_concatenated_segments,
                                                  p_gsp_post_process_warning       => x_gsp_post_process_warning);
hr_job_api.create_job建立完成後就已經建立的了assign,因此assign信息只用更新 蘇聯章 2013/3/31 HR   Job Assign/更新
71 12.1.1 HR 建立職位 API hr_position_api.create_position   hr_position_api.create_position(p_validate               => FALSE,
                                        p_job_id                 =>   92,
                                        p_organization_id        =>   84,
                                        p_date_effective         =>   SYSDATE,
                                        p_working_hours          =>   40,
                                        p_frequency              =>   'W',
                                        p_time_normal_start      =>   '09:00',
                                        p_time_normal_finish     =>   '17:30',
                                        p_location_id            =>   144,
                                        p_segment1               =>   'SHE_HQ',
                                        p_segment2               =>   'Account - Finance Division',
                                        p_segment3               =>   'Acting Department Manager',
                                        p_position_id            =>   x_position_id,
                                        p_object_version_number  =>   x_object_version_number,
                                        p_position_definition_id => x_position_definition_id,
                                        p_name                   =>   x_name);
  蘇聯章 2013/3/31 HR/職位/建立
72 12.1.1 HR 建立員工 API hr_employee_api.create_employee    hr_employee_api.create_employee(p_validate                  => FALSE,
                                          p_business_group_id           => p_data_rec.business_group_id,
                                          p_hire_date                   => p_data_rec.start_working_date,
                                          p_last_name                   => p_data_rec.name_english,
                                          p_sex                         => p_data_rec.sex,
                                          p_person_type_id            =>   p_data_rec.employee_type_id,
                                          p_date_of_birth               => p_data_rec.date_of_birth,
                                          p_employee_number             => l_employee_number,
                                          p_attribute1                  => p_data_rec.name_thai,
                                          p_attribute2                  => p_data_rec.ldap_id,
                                          p_person_id                   => x_person_id,
                                          p_assignment_id               => x_assignment_id,
                                          p_per_object_version_number => x_per_object_version_number,
                                          p_asg_object_version_number => x_asg_object_version_number,
                                          p_per_effective_start_date    => x_per_effective_start_date,
                                          p_per_effective_end_date      => x_per_effective_end_date,
                                          p_full_name                   => x_full_name,
                                          p_per_comment_id              => x_per_comment_id,
                                          p_assignment_sequence         => x_assignment_sequence,
                                          p_assignment_number           => x_assignment_number,
                                          p_name_combination_warning    => x_name_combination_warning,
                                          p_assign_payroll_warning      => x_assign_payroll_warning,
                                          p_orig_hire_warning           => x_orig_hire_warning);
  蘇聯章 2013/3/31 HR/員工/建立
73 12.1.1 HR  解僱僱員 APi hr_ex_employee_api.actual_termination_emp    hr_ex_employee_api.actual_termination_emp(p_validate                   => FALSE,
                                                    p_effective_date               => g_sysdate,
                                                    p_period_of_service_id         => l_period_of_service_id,
                                                    p_object_version_number        => l_object_version_number,
                                                    p_actual_termination_date      => p_data_rec.resign_date,
                                                    p_last_standard_process_date => l_last_standard_process_date,
                                                    p_leaving_reason               => p_data_rec.resign_reason_code,
                                                    p_supervisor_warning           => x_supervisor_warning,
                                                    p_event_warning                => x_event_warning,
                                                    p_interview_warning            => x_interview_warning,
                                                    p_review_warning               => x_review_warning,
                                                    p_recruiter_warning            => x_recruiter_warning,
                                                    p_asg_future_changes_warning => x_asg_future_changes_warning,
                                                    p_entries_changed_warning      => x_entries_changed_warning,
                                                    p_pay_proposal_warning         => x_pay_proposal_warning,
                                                    p_dod_warning                  => x_dod_warning,
                                                    p_alu_change_warning           => x_alu_change_warning);
  蘇聯章 2013/3/31 HR/僱員/解僱
74 12.1.1 IBY 建立供應商頭/地點付款方法 API iby_disbursement_setup_pub.create_external_payee p_ext_payee_tab使用iby_disbursement_setup_pub.external_payee_tab_type   處理結果返回給參數x_ext_payee_status_tab,使用類型iby_disbursement_setup_pub.ext_payee_create_tab_type 蘇聯章 2013/3/31 供應商/付款方法
75 12.1.1 IBY 更行供應商頭/地點付款方法 API iby_disbursement_setup_pub.update_external_payee p_ext_payee_tab使用iby_disbursement_setup_pub.external_payee_tab_type;
    p_ext_payee_id_tab使用iby_disbursement_setup_pub.ext_payee_id_tab_type
  處理結果返回給參數x_ext_payee_status_tab,使用類型iby_disbursement_setup_pub.ext_payee_update_tab_type 蘇聯章 2013/3/31 供應商/付款方法
76 12.1.1 IBY 建立銀行 API iby_ext_bankacct_pub.create_ext_bank   iby_ext_bankacct_pub.create_ext_bank(p_api_version   => 1.0,
                                           p_init_msg_list => p_init_msg_list,
                                           p_ext_bank_rec  =>   p_extbank_rec_type,
                                           x_bank_id       =>   l_bank_id,
                                           x_return_status => x_return_status,
                                           x_msg_count     =>   x_msg_count,
                                           x_msg_data      =>   x_msg_data,
                                           x_response      =>   x_response);
  蘇聯章 2013/3/31 銀行/建立
77 12.1.1 IBY 更行銀行 API iby_ext_bankacct_pub.update_ext_bank       蘇聯章 2013/3/31 銀行/更新
78 12.1.1 IBY 建立銀行分行 API iby_ext_bankacct_pub.create_ext_bank_branch   iby_ext_bankacct_pub.create_ext_bank_branch(p_api_version         => p_api_version,
                                                  p_init_msg_list       =>   p_init_msg_list,
                                                  p_ext_bank_branch_rec => p_ext_bank_branch_rec,
                                                  x_branch_id           =>   l_branch_id,
                                                  x_return_status       =>   x_return_status,
                                                  x_msg_count           =>   x_msg_count,
                                                  x_msg_data            =>   x_msg_data,
                                                  x_response            =>   x_response);
  蘇聯章 2013/3/31 銀行分行/建立
79 12.1.1 IBY 更新銀行分行 API iby_ext_bankacct_pub.update_ext_bank_branch       蘇聯章 2013/3/31 銀行分行/更新
80 12.1.1 IBY 建立銀行帳戶 API iby_ext_bankacct_pub.create_ext_bank_acct   iby_ext_bankacct_pub.create_ext_bank_acct(p_api_version       => 1.0,
                                                p_init_msg_list     =>   p_init_msg_list,
                                                p_ext_bank_acct_rec => p_ext_bank_acct_rec,
                                                p_association_level => 'SS',
                                                p_supplier_site_id  =>   p_supplier_site_id,
                                                p_party_site_id     =>   p_party_site_id,
                                                p_org_id            =>   p_org_id,
                                                p_org_type          =>   'OPERATING_UNIT',
                                                x_acct_id           =>   l_acct_id,
                                                x_return_status     => x_return_status,
                                                x_msg_count         =>   x_msg_count,
                                                x_msg_data          =>   x_msg_data,
                                                x_response          =>   x_response);
  蘇聯章 2013/3/31 銀行帳戶/建立
81 12.1.1 IBY 更新銀行帳戶 API iby_ext_bankacct_pub.create_ext_bank_acct       蘇聯章 2013/3/31 銀行帳戶/更新
82 12.1.3 IBY 檢查銀行是否存在 API iby_ext_bankacct_pub.check_bank_exist   iby_ext_bankacct_pub.check_bank_exist(p_api_version   => 1.0,
                                                p_init_msg_list => fnd_api.g_true,
                                                p_country_code  =>   p_interface_data.bill_to_country,
                                                p_bank_name     =>   p_interface_data.bank,
                                                p_bank_number   =>   NULL,
                                                x_response      =>   r_response,
                                                x_bank_id       =>   x_bank_id,
                                                x_end_date      =>   v_end_date,
                                                x_return_status => x_return_status,
                                                x_msg_count     =>   v_msg_count,
                                                x_msg_data      =>   v_msg_data);
  何雲 2013/4/3 銀行/檢查
83 12.1.3 IBY 檢查支行是否存在 API iby_ext_bankacct_pub.check_ext_bank_branch_exist   iby_ext_bankacct_pub.check_ext_bank_branch_exist(p_api_version   => 1.0,
                                                           p_init_msg_list => fnd_api.g_true,
                                                           p_bank_id       =>   x_bank_id,
                                                           p_branch_name   =>   p_interface_data.branch,
                                                           p_branch_number => NULL,
                                                           x_response      =>   r_response,
                                                           x_branch_id     =>   x_branch_id,
                                                           x_end_date      =>   v_end_date,
                                                           x_return_status => x_return_status,
                                                           x_msg_count     =>   v_msg_count,
                                                           x_msg_data      =>   v_msg_data);
  何雲 2013/4/3 銀行/支行/檢查
84 12.1.3 IBY 檢查銀行帳戶是否存在 API iby_ext_bankacct_pub.check_ext_acct_exist   v_ext_bank_acct_rec.bank_id   := x_bank_id;
    v_ext_bank_acct_rec.branch_id := x_branch_id;
    v_ext_bank_acct_rec.country_code          := p_interface_data.bill_to_country;
    v_ext_bank_acct_rec.acct_owner_party_id := v_party_id;
    v_ext_bank_acct_rec.bank_account_num      := p_interface_data.bank_account;
    --v_ext_bank_acct_rec.currency              := 'CNY';
    iby_ext_bankacct_pub.check_ext_acct_exist(p_api_version       => 1.0,
                                                    p_init_msg_list     =>   fnd_api.g_true,
                                                    p_ext_bank_acct_rec => v_ext_bank_acct_rec,
                                                    x_acct_id           =>   x_bank_acct_id,
                                                    x_start_date        =>   v_start_date,
                                                    x_end_date          =>   v_end_date,
                                                    x_return_status     =>   x_return_status,
                                                    x_msg_count         =>   v_msg_count,
                                                    x_msg_data          =>   v_msg_data,
                                                    x_response          =>   r_response);
  何雲 2013/4/3 銀行/帳戶/檢查
85 12.1.3 INV 建立物料搬運單頭 API inv_move_order_pub.create_move_order_header       趙楊 2013/3/30 物料搬運單/導入
86 12.1.3 INV 建立保留 API inv_reservation_form_pkg.create_reservation       趙楊 2013/3/30 保留/導入
87 12.1.3 INV 釋放保留 API inv_reservation_form_pkg.delete_reservation       趙楊 2013/3/30 保留/釋放
88 12.1.3 INV 建立物料 API inv_item_grp.create_item   inv_item_grp.create_item(p_commit        => fnd_api.g_false,
                               p_item_rec      =>   l_item_rec,
                               x_item_rec      =>   l_out_rec,
                               x_return_status => l_return_status,
                               x_error_tbl     =>   l_error_tbl,
                               p_template_name => rec.template_name);
  趙楊 2013/3/30 物料/導入
89 12.1.3 INV 更新物料 API inv_item_grp.update_item   inv_item_grp.update_item(p_commit        => fnd_api.g_false,
                               p_item_rec      =>   l_item_rec,
                               x_item_rec      =>   l_out_rec,
                               x_return_status => l_return_status,
                               x_error_tbl     =>   l_error_tbl,
                               p_template_name => rec.template_name);
  趙楊 2013/3/30 物料/更新
90 12.0.6 INV 物料編碼導入/更新 接口 INV.INCOIN   ln_request_id   := fnd_request.submit_request('INV',
                                                  'INCOIN',
                                                  '',
                                                  to_char(SYSDATE,
                                                          'YYYY/MM/DD HH24:MI:SS'),
                                                  FALSE,
                                                  gn_to_org_id,
                                                  2, --No
                                                  1, --Validate Items
                                                  1,
                                                  1,
                                                  p_process_id,
                                                  p_tran_mode,--1 CREATE 2 UPDATE
                                                  chr(0));
可附帶版本導入 黎法良 2013/3/31 物料編碼/導入/更新
91 12.1.3 INV 建立物料類別 API inv_item_category_pub.create_category_assignment   inv_item_category_pub.create_category_assignment(p_api_version       => '1.0',
                                                       p_init_msg_list     =>   fnd_api.g_true,
                                                       p_commit            =>   fnd_api.g_true,
                                                       x_return_status     =>   l_return_status,
                                                       x_errorcode         =>   l_errorcode,
                                                       x_msg_count         =>   l_msg_count,
                                                       x_msg_data          =>   l_msg_data,
                                                       p_category_id       =>   rec.category_id,
                                                       p_category_set_id   => rec.category_set_id,
                                                       p_inventory_item_id => rec.inventory_item_id,
                                                       p_organization_id   =>   rec.organization_id);
  趙楊 2013/3/30 物料類別/導入
92 12.1.3 INV 更新物料類別 API inv_item_category_pub.update_category_assignment   inv_item_category_pub.update_category_assignment(p_api_version       => '1.0',
                                                       p_init_msg_list     =>   fnd_api.g_true,
                                                       p_commit            =>   fnd_api.g_true,
                                                       x_return_status     =>   l_return_status,
                                                       x_errorcode         =>   l_errorcode,
                                                       x_msg_count         =>   l_msg_count,
                                                       x_msg_data          =>   l_msg_data,
                                                       p_category_id       =>   rec.category_id,
                                                       p_old_category_id   => l_old_category_id,
                                                       p_category_set_id   =>   rec.category_set_id,
                                                       p_inventory_item_id => rec.inventory_item_id,
                                                       p_organization_id   =>   rec.organization_id);
  趙楊 2013/3/30 物料類別/更新
93 12.0.6 INV 物料類別分配導入 接口 INV.INV_ITEM_CAT_ASSIGN_OI   v_num_request_id   := fnd_request.submit_request(application => 'INV',
                                                     program     =>   'INV_ITEM_CAT_ASSIGN_OI',
                                                     description => NULL,
                                                     start_time  => NULL,
                                                     sub_request => FALSE,
                                                     argument1   =>   v_num_tmp,--rec.batch_id, --Record Set Id
                                                     argument2   => 1, --Upload   Processed Records
                                                     argument3   => 1 --Delete   Processed Records
                                                     );
  黎法良 2013/3/31 物料類別分配/導入
94 12.1.3 INV 建立物料目錄 API inv_item_catalog_elem_pub.process_item_descr_elements       趙楊 2013/3/30 物料目錄/導入
95 12.0.6 INV 建立物料默認子庫 API inv_item_sub_default_pkg.insert_upd_item_sub_defaults   inv_item_sub_default_pkg.insert_upd_item_sub_defaults(p_organization_id   => l_item_rec.organization_id,
                                                            p_inventory_item_id => l_out_rec.inventory_item_id,
                                                            p_subinventory_code => l_receiving_subinv,
                                                            p_default_type      => 2,   --1. default shipping subinventory; 2. default receiving subinventory
                                                            p_creation_date     =>   SYSDATE,
                                                            p_created_by        => g_created_by,
                                                            p_last_update_date  =>   SYSDATE,
                                                            p_last_updated_by   =>   g_last_updated_by,
                                                            p_process_code      =>   'INSERT',
                                                            p_commit            =>   fnd_api.g_true,
                                                            x_return_status     =>   l_return_status,
                                                            x_msg_count         =>   l_msg_count,
                                                            x_msg_data          =>   x_msg_data);
被INVIDIT2.Insert_Default_SubInventories調用,因此也能夠用這個 黎法良 2013/3/31 物料默認子庫/導入
96 12.1.3 INV 建立物料交叉參考 API mtl_cross_references_pub.process_xref       蘇聯章 2013/3/31 物料交叉參考/建立
97 12.1.1 INV 建立批次 API inv_lot_api_pub.create_inv_lot       蘇聯章 2013/3/31 批次/建立
98 12.1.3 INV 更新批次狀態 API inv_material_status_pub.update_status   l_status_update_rec.organization_id   := p_organization_id;
          l_status_update_rec.inventory_item_id := p_inventory_item_id;
          l_status_update_rec.lot_number          := p_lot_number;
          l_status_update_rec.status_id           := p_status_id;
          l_status_update_rec.update_method       := p_update_method;
          l_status_update_rec.creation_date       := SYSDATE;
          l_status_update_rec.created_by          := nvl(fnd_global.user_id, -1);
        l_status_update_rec.last_updated_by   := nvl(fnd_global.user_id, -1);
          l_status_update_rec.last_update_date    := SYSDATE;
          l_status_update_rec.last_update_login := nvl(fnd_global.login_id,   -1);
     
          inv_material_status_pub.update_status(p_api_version_number =>   1,
                                                p_init_msg_lst       =>   fnd_api.g_false,
                                                p_commit             =>   fnd_api.g_false,
                                                x_return_status      =>   x_return_status,
                                                x_msg_count          =>   x_msg_count,
                                                x_msg_data           =>   x_msg_data,
                                                p_object_type        => 'O',
                                                p_status_rec         =>   l_status_update_rec);
  何雲 2013/4/3 批次/狀態/更新
99 12.1.3 INV 獲取現有量 API inv_quantity_tree_pub.query_quantities   「--at   first ,clear cache
          inv_quantity_tree_pub.clear_quantity_cache;
          inv_quantity_tree_pub.query_quantities(p_api_version_number      => 1.0,
                                                 p_init_msg_lst            =>   fnd_api.g_false,
                                                 x_return_status           =>   l_return_status,
                                                 x_msg_count               =>   l_msg_count,
                                                 x_msg_data                =>   l_msg_data,
                                                 p_organization_id         =>   p_organization_id,
                                                 p_inventory_item_id       =>   p_inventory_item_id,
                                                 p_tree_mode               =>   3,
                                                 p_is_revision_control     =>   l_is_revision_control,
                                                 p_is_lot_control          =>   l_is_lot_control,
                                                 p_is_serial_control       =>   l_is_serial_control,
                                                 p_grade_code              =>   NULL,
                                                 p_demand_source_type_id   =>   -1,
                                                 p_demand_source_header_id => -1,
                                                 p_demand_source_line_id   =>   -1,
                                                 p_demand_source_name      =>   NULL,
                                                 p_lot_expiration_date     =>   SYSDATE,
                                                 p_revision                =>   NULL,
                                                 p_lot_number              =>   p_lot_number,
                                                 p_subinventory_code       =>   p_subinventory,
                                                 p_locator_id              =>   p_locator_id,
                                                 p_onhand_source           =>   3,
                                                 x_qoh                     =>   l_qty_on_hand,
                                                 x_rqoh                    =>   l_qty_res_on_hand,
                                                 x_qr                      =>   l_qty_res,
                                                 x_qs                      =>   l_qty_sug,
                                                 x_att                     =>   l_qty_att,
                                                 x_atr                     =>   l_qty_available_to_reserve,
                                                 x_sqoh                    =>   l_sqty_on_hand,
                                                 x_srqoh                   =>   l_sqty_res_on_hand,
                                                 x_sqr                     =>   l_sqty_res,
                                                 x_sqs                     =>   l_sqty_sug,
                                                 x_satt                    =>   l_sqty_att,
                                                 x_satr                    =>   l_sqty_available_to_reserve);
  趙楊 2013/3/30 現有量
100 12.0.6 INV 建立物料事務處理 API mtl_online_transaction_pub.process_online   l_success   := mtl_online_transaction_pub.process_online(p_transaction_header_id =>   l_iface_rec.transaction_header_id,
                                                             p_timeout               =>   l_timeout,
                                                             p_error_code            =>   l_error_code,
                                                             p_error_explanation     =>   l_error_explanation);
期初現有量導入可經過物料事務處理的別名入庫、出庫或者組織間轉移來實現 黎法良 2013/3/31 物料事務處理/現有量/導入
101 12.1.3 INV 建立現有量(物料事務處理) API     inv_txn_manager_pub.process_transactions   DECLARE
      l_mti_row   mtl_transactions_interface%ROWTYPE;
      l_id      NUMBER := -1;
      l_user_id NUMBER := 26673;
      l_outcome boolean := false;
      l_mtli_row   mtl_transaction_lots_interface%rowtype;
      l_error_code        VARCHAR2(4000);
      l_error_explanation   VARCHAR2(4000);
    BEGIN
      SELECT mtl_material_transactions_s.nextval   INTO l_id FROM dual;
     
        --插入mtl_transactions_interface
      l_mti_row.transaction_interface_id   := l_id;
   
      l_mti_row.last_update_date  := SYSDATE;
      l_mti_row.last_updated_by   := l_user_id;
      l_mti_row.creation_date     := SYSDATE;
      l_mti_row.created_by        := l_user_id;
      l_mti_row.last_update_login :=   -1;
   
      l_mti_row.transaction_header_id :=   l_id;
   
      l_mti_row.transaction_mode    := 3;--通常都爲3
      l_mti_row.process_flag        := 1;--通常都爲1
      l_mti_row.transaction_type_id :=   35; --投料--物料事務處理類型id
   
      /*
      帳戶別名雜項,用別名ID即disposition_id
      帳戶雜項,用帳戶ID即code_combination_id
      WIP物料事務,用任務ID即wip_entity_id
        SO物料事務,用mtl_sales_orders.sales_order_id
      子庫轉移或組織間轉移,爲空
      */
      l_mti_row.transaction_source_id :=   32936523;--工單號--WIP事務處理
   
      l_mti_row.organization_id :=   650;--庫存組織id
   
      l_mti_row.inventory_item_id    := 15867632;--物料id
      l_mti_row.subinventory_code    := 'L11101';--子庫從
      l_mti_row.transaction_quantity :=   -1;--減小爲負數
      l_mti_row.transaction_uom      := 'PCS';--單位的code
   
      l_mti_row.transaction_date :=   SYSDATE;
      l_mti_row.source_code      := 'Test Only';--自定義,用於追溯
      l_mti_row.source_header_id :=   987654321;--自定義,用於追溯
      l_mti_row.source_line_id   := 987654321;--自定義,用於追溯
   
      INSERT INTO   mtl_transactions_interface VALUES l_mti_row;
     
        --插入mtl_transaction_lots_interface
      l_mtli_row.last_update_date  := SYSDATE;
      l_mtli_row.last_updated_by   := l_user_id;
      l_mtli_row.creation_date     := SYSDATE;
      l_mtli_row.created_by        := l_user_id;
      l_mtli_row.last_update_login :=   -1;
     
      l_mtli_row.transaction_interface_id   := l_mti_row.transaction_interface_id;
      l_mtli_row.lot_number               := 'nl0000003';--批次號
        l_mtli_row.transaction_quantity       := l_mti_row.transaction_quantity;
      l_mtli_row.source_code              := l_mti_row.source_code;
      l_mtli_row.source_line_id           := l_mti_row.source_line_id;
   
      INSERT INTO   inv.mtl_transaction_lots_interface VALUES l_mtli_row;
     
      --調用API進行事務處理
      l_outcome :=   mtl_online_transaction_pub.process_online(p_transaction_header_id =>   l_mti_row.transaction_header_id,
                                                               p_timeout               =>   100,
                                                               p_error_code            =>   l_error_code,
                                                               p_error_explanation     =>   l_error_explanation);
     
      /*x_retval :=   inv_txn_manager_pub.process_transactions(p_api_version      => 1.0,
                                                               p_init_msg_list    =>   fnd_api.g_false,
                                                               p_commit           =>   fnd_api.g_false, --not commit
                                                               p_validation_level => fnd_api.g_valid_level_full,
                                                               x_return_status    =>   x_return_status,
                                                               x_msg_count        =>   x_msg_count,
                                                               x_msg_data         =>   x_msg_data,
                                                               x_trans_count      =>   x_trans_count,
                                                               p_table            =>   1,
                                                               p_header_id        =>   l_mti_row.transaction_header_id);*/
     
      IF (l_outcome = FALSE) THEN
        dbms_output.put_line('Failed to   process the transaction');
        dbms_output.put_line('Error code:   ' || l_error_code);
        dbms_output.put_line('Error   message: ' || l_error_explanation);
        DELETE   inv.mtl_transactions_interface
         WHERE transaction_header_id =   l_mti_row.transaction_header_id;
        COMMIT;
      ELSE
        dbms_output.put_line('Transaction   with header id ' ||
                               to_char(l_mti_row.transaction_header_id) ||
                             ' has been   processed successfully');
        COMMIT;
      END IF;
    END;
  何雲 2013/4/3 物料事務處理/導入
102 12.1.3 INV 建立現有量(物料事務處理) API mtl_online_transaction_pub.process_online   DECLARE
      l_mti_row   mtl_transactions_interface%ROWTYPE;
      l_id      NUMBER := -1;
      l_user_id NUMBER := 26673;
      l_outcome boolean := false;
      l_mtli_row   mtl_transaction_lots_interface%rowtype;
      l_error_code        VARCHAR2(4000);
      l_error_explanation   VARCHAR2(4000);
    BEGIN
      SELECT mtl_material_transactions_s.nextval   INTO l_id FROM dual;
     
        --插入mtl_transactions_interface
      l_mti_row.transaction_interface_id   := l_id;
   
      l_mti_row.last_update_date  := SYSDATE;
      l_mti_row.last_updated_by   := l_user_id;
      l_mti_row.creation_date     := SYSDATE;
      l_mti_row.created_by        := l_user_id;
      l_mti_row.last_update_login :=   -1;
   
      l_mti_row.transaction_header_id :=   l_id;
   
      l_mti_row.transaction_mode    := 3;--通常都爲3
      l_mti_row.process_flag        := 1;--通常都爲1
      l_mti_row.transaction_type_id :=   35; --投料--物料事務處理類型id
   
      /*
      帳戶別名雜項,用別名ID即disposition_id
      帳戶雜項,用帳戶ID即code_combination_id
      WIP物料事務,用任務ID即wip_entity_id
        SO物料事務,用mtl_sales_orders.sales_order_id
      子庫轉移或組織間轉移,爲空
      */
      l_mti_row.transaction_source_id :=   32936523;--工單號--WIP事務處理
   
      l_mti_row.organization_id :=   650;--庫存組織id
   
      l_mti_row.inventory_item_id    := 15867632;--物料id
      l_mti_row.subinventory_code    := 'L11101';--子庫從
      l_mti_row.transaction_quantity :=   -1;--減小爲負數
      l_mti_row.transaction_uom      := 'PCS';--單位的code
   
      l_mti_row.transaction_date :=   SYSDATE;
      l_mti_row.source_code      := 'Test Only';--自定義,用於追溯
      l_mti_row.source_header_id :=   987654321;--自定義,用於追溯
      l_mti_row.source_line_id   := 987654321;--自定義,用於追溯
   
      INSERT INTO   mtl_transactions_interface VALUES l_mti_row;
     
        --插入mtl_transaction_lots_interface
      l_mtli_row.last_update_date  := SYSDATE;
      l_mtli_row.last_updated_by   := l_user_id;
      l_mtli_row.creation_date     := SYSDATE;
      l_mtli_row.created_by        := l_user_id;
      l_mtli_row.last_update_login :=   -1;
     
      l_mtli_row.transaction_interface_id   := l_mti_row.transaction_interface_id;
      l_mtli_row.lot_number               := 'nl0000003';--批次號
        l_mtli_row.transaction_quantity       := l_mti_row.transaction_quantity;
      l_mtli_row.source_code              := l_mti_row.source_code;
      l_mtli_row.source_line_id           := l_mti_row.source_line_id;
   
      INSERT INTO   inv.mtl_transaction_lots_interface VALUES l_mtli_row;
     
      --調用API進行事務處理
      l_outcome :=   mtl_online_transaction_pub.process_online(p_transaction_header_id =>   l_mti_row.transaction_header_id,
                                                               p_timeout               =>   100,
                                                               p_error_code            =>   l_error_code,
                                                               p_error_explanation     =>   l_error_explanation);
     
      /*x_retval :=   inv_txn_manager_pub.process_transactions(p_api_version      => 1.0,
                                                               p_init_msg_list    =>   fnd_api.g_false,
                                                               p_commit           =>   fnd_api.g_false, --not commit
                                                               p_validation_level => fnd_api.g_valid_level_full,
                                                               x_return_status    =>   x_return_status,
                                                               x_msg_count        =>   x_msg_count,
                                                               x_msg_data         =>   x_msg_data,
                                                               x_trans_count      =>   x_trans_count,
                                                               p_table            =>   1,
                                                               p_header_id        =>   l_mti_row.transaction_header_id);*/
     
      IF (l_outcome = FALSE) THEN
        dbms_output.put_line('Failed to   process the transaction');
        dbms_output.put_line('Error code:   ' || l_error_code);
        dbms_output.put_line('Error   message: ' || l_error_explanation);
        DELETE   inv.mtl_transactions_interface
         WHERE transaction_header_id =   l_mti_row.transaction_header_id;
        COMMIT;
      ELSE
        dbms_output.put_line('Transaction   with header id ' ||
                               to_char(l_mti_row.transaction_header_id) ||
                             ' has been   processed successfully');
        COMMIT;
      END IF;
    END;
  何雲 2013/4/3 物料事務處理/導入
103 12.1.1 INV 現有量導入(物料事務處理) 接口 INV.INCTCW   INSERT   INTO mtl_transactions_interface VALUES lt_trx_interface;
    INSERT INTO mtl_transaction_lots_interface VALUES lt_trx_lots_interface;
物料事務處理爲雜項接收或帳戶別名接收 蘇聯章 2013/3/31 現有量/導入
104 12.1.3 INV 物料轉移(物料事務處理) 接口 INV.INCTCW 接口表:mtl_material_transactions或者mtl_material_transactions_temp
   
fnd_request.submit_request('INV',
                                                     'INCTCW',
                                                     NULL,
                                                     NULL,
                                                     NULL,
                                                     l_iface_rec.transaction_header_id,
                                                     '2',
                                                     '',
                                                     '',
                                                     chr(0))
  羅建波 2013/4/3 物料轉移
105 12.1.3 INV 物料事務處理:PO接收 接口 PO.RCVTPO 接口表:rcv_headers_interface,rcv_transactions_interface
    請求:手工提交Receiving Transaction Processor
fnd_transaction.synchronous(l_time_out,   -- timeout in seconds
                                                      l_outcome, -- out variable indicating Success/Warning/Error
                                                      l_message, -- out variable with a descriptive message
                                                      'PO',
                                                      'RCVTPO',
                                                      'ONLINE',
                                                      p_batch_id, -- group_id in rcv_transactions_interface
                                                      g_org_id, -- inventory organization_id,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      NULL);
代碼爲ONLINE形式,速度會提升不少 羅建波 2013/4/3 PO接收\入庫
106 12.1.3 INV 工單完工入庫 API inv_txn_manager_pub.process_transactions 接口表:mtl_transactions_interface,
    cst_comp_snap_interface
    API:
inv_txn_manager_pub.process_transactions(p_api_version      => 1.0,
                                                                       p_init_msg_list    =>   fnd_api.g_false,
                                                                       p_commit           =>   fnd_api.g_false,
                                                                       p_validation_level => fnd_api.g_valid_level_full,
                                                                       x_return_status    =>   x_return_status,
                                                                       x_msg_count        =>   x_msg_count,
                                                                       x_msg_data         =>   x_msg_data,
                                                                       x_trans_count      =>   l_trx_count,
                                                                       p_table            =>   1,
                                                                       p_header_id        =>   l_transaction_header_id);
  羅建波 2013/4/3 工單完工入庫
107 12.0.6 INV 獲取物料單位轉換率 API inv_convert.inv_um_conversion   inv_convert.inv_um_conversion(from_unit   => '個',
                                    to_unit   => 'KG',
                                    item_id   => 1502,
                                    uom_rate  => l_convs);
使用是注意:函數在沒有找到轉換率時會返回-99999 黎法良 2013/3/31 獲取物料單位轉換率/函數
108 11.5.0 INV 獲取公司間開票轉移價格 API mtl_intercompany_invoices.get_transfer_price     Oracle標準開放API,默認是不作任何處理返回NULL,對於項目特定需求,可對該API進行開發 黎法良 2013/3/31 獲取現有量
109 12.1.3 INV 修改處理物料搬運單的分配數量函數 API INV_TO_FORM_TROLIN.VALIDATE_AND_WRITE   DECLARE
      X_RETURN_STATUS VARCHAR2(10);
      X_MSG_COUNT     NUMBER;
      X_MSG_DATA      VARCHAR2(100);
   
      X_CREATION_DATE     DATE;
      X_CREATED_BY        NUMBER;
      X_LAST_UPDATE_DATE  DATE;
      X_LAST_UPDATED_BY   NUMBER;
      X_LAST_UPDATE_LOGIN NUMBER;
   
    BEGIN
        APPS.INV_TO_FORM_TROLIN.VALIDATE_AND_WRITE(X_RETURN_STATUS,
                                                   X_MSG_COUNT,
                                                   X_MSG_DATA,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   SYSDATE,
                                                   NULL,
                                                   'BYSH111',
                                                   NULL,
                                                   223489,
                                                   22708,
                                                   778988,
                                                   1,
                                                   3,
                                                   NULL,
                                                   86,
                                                   NULL,
                                                   115,
                                                   NULL,
                                                   70,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   SYSDATE,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   'XYSH111',
                                                   NULL,
                                                   NULL,
                                                   'KG',
                                                   144,
                                                   4,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   115,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   'T',
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   NULL,
                                                   X_CREATION_DATE,
                                                   X_CREATED_BY,
                                                   X_LAST_UPDATE_DATE,
                                                   X_LAST_UPDATED_BY,
                                                   X_LAST_UPDATE_LOGIN);
                   COMMIT;
                     dbms_output.put_line('X_RETURN_STATUS ' || X_RETURN_STATUS );
                     dbms_output.put_line('X_MSG_COUNT ' || X_MSG_COUNT );
                     dbms_output.put_line('X_MSG_DATA ' || X_MSG_DATA );
                     dbms_output.put_line('X_CREATION_DATE ' || X_CREATION_DATE );
                     dbms_output.put_line('X_CREATED_BY ' || X_CREATED_BY );
                     dbms_output.put_line('X_LAST_UPDATE_DATE ' || X_LAST_UPDATE_DATE   );
                     dbms_output.put_line('X_LAST_UPDATED_BY ' || X_LAST_UPDATED_BY   );
                     dbms_output.put_line('X_LAST_UPDATE_LOGIN ' || X_LAST_UPDATE_LOGIN   );
    END;
   
  徐衝 2013/4/2 修改分配數量
110 12.1.3 INV 處理物料搬運單 API inv_pick_wave_pick_confirm_pub.pick_confirm         l_mold_tbl(l_count) :=   inv_mo_line_detail_util.query_row(rec_h.transaction_temp_id);
            l_mold_tbl(l_count).last_update_date := SYSDATE;
            l_mold_tbl(l_count).last_updated_by := fnd_global.user_id;
            l_mold_tbl(l_count).creation_date := SYSDATE;
          l_mold_tbl(l_count).created_by   := fnd_global.user_id;
         
        END LOOP;
     
     
          inv_pick_wave_pick_confirm_pub.pick_confirm(p_api_version_number =>   l_api_version,
                                                      p_init_msg_list      =>   l_init_msg_list,
                                                      p_commit             =>   l_commit,
                                                      x_return_status      =>   x_return_status,
                                                      x_msg_count          =>   x_msg_count,
                                                      x_msg_data           =>   x_msg_data,
                                                      p_move_order_type    =>   l_move_order_type,
                                                      p_transaction_mode   =>   l_transaction_mode,
                                                      p_trolin_tbl         =>   l_trolin_tbl,
                                                      p_mold_tbl           =>   l_mold_tbl,
                                                      x_mmtt_tbl           =>   x_mmtt_tbl,
                                                      x_trolin_tbl         =>   x_trolin_tbl,
                                                      p_transaction_date   =>   SYSDATE);
  徐衝 2013/4/2 處理物料搬運單
111 12.1.3 INV 獲得物料搬運單行的相關信息  API inv_mo_line_detail_util.query_row       徐衝 2013/4/2 物料搬運單行
112 12.1.3 INV 建立物料搬運單行 API inv_move_order_pub.create_move_order_lines   FOR   i IN 1 .. p_mo_line_rec_tbl.count LOOP
          l_trolin_tbl(i) :=   inv_move_order_pub.g_miss_trolin_rec;
          l_trolin_tbl(i).line_number :=   i;
          l_trolin_tbl(i).header_id :=   x_trohdr_rec.header_id;
            l_trolin_tbl(i).inventory_item_id := p_mo_line_rec_tbl(i)
                                                 .inventory_item_id;
            l_trolin_tbl(i).transaction_type_id := p_mo_line_rec_tbl(i)
                                                   .transaction_type_id;
          l_trolin_tbl(i).date_required   := nvl(p_mo_line_rec_tbl(i)
                                                 .date_required,
                                                 x_trohdr_rec.date_required);
          l_trolin_tbl(i).uom_code :=   p_mo_line_rec_tbl(i).uom_code;
          l_trolin_tbl(i).quantity :=   p_mo_line_rec_tbl(i).quantity;
          l_trolin_tbl(i).organization_id   := p_organization_id;
            l_trolin_tbl(i).from_subinventory_code := p_mo_line_rec_tbl(i)
                                                      .from_subinventory_code;
          l_trolin_tbl(i).from_locator_id   := p_mo_line_rec_tbl(i)
                                               .from_locator_id;
            l_trolin_tbl(i).to_subinventory_code := p_mo_line_rec_tbl(i)
                                                    .to_subinventory_code;
          l_trolin_tbl(i).to_locator_id   := p_mo_line_rec_tbl(i).to_locator_id;
          l_trolin_tbl(i).to_account_id   := p_mo_line_rec_tbl(i).to_account_id;
          l_trolin_tbl(i).line_status :=   p_mo_line_rec_tbl(i).line_status;
          l_trolin_tbl(i).status_date :=   p_mo_line_rec_tbl(i).status_date;
          l_trolin_tbl(i).lot_number :=   p_mo_line_rec_tbl(i).lot_number;
          l_trolin_tbl(i).db_flag :=   fnd_api.g_true;
          l_trolin_tbl(i).operation :=   inv_globals.g_opr_create;
          l_trolin_tbl(i).attribute_category   := p_mo_line_rec_tbl(i)
                                                  .attribute_category;
          l_trolin_tbl(i).attribute1 :=   p_mo_line_rec_tbl(i).attribute1;
          l_trolin_tbl(i).attribute2 :=   p_mo_line_rec_tbl(i).attribute2;
          l_trolin_tbl(i).attribute3 :=   p_mo_line_rec_tbl(i).attribute3;
          l_trolin_tbl(i).attribute4 :=   p_mo_line_rec_tbl(i).attribute4;
          l_trolin_tbl(i).attribute5 :=   p_mo_line_rec_tbl(i).attribute5;
          l_trolin_tbl(i).attribute6 :=   p_mo_line_rec_tbl(i).attribute6;
          l_trolin_tbl(i).attribute7 :=   p_mo_line_rec_tbl(i).attribute7;
          l_trolin_tbl(i).attribute8 :=   p_mo_line_rec_tbl(i).attribute8;
          l_trolin_tbl(i).attribute9 :=   p_mo_line_rec_tbl(i).attribute9;
          l_trolin_tbl(i).attribute10 :=   p_mo_line_rec_tbl(i).attribute10;
          l_trolin_tbl(i).attribute11 :=   p_mo_line_rec_tbl(i).attribute11;
          l_trolin_tbl(i).attribute12 :=   p_mo_line_rec_tbl(i).attribute12;
          l_trolin_tbl(i).attribute13 :=   p_mo_line_rec_tbl(i).attribute13;
          l_trolin_tbl(i).attribute14 :=   p_mo_line_rec_tbl(i).attribute14;
          l_trolin_tbl(i).attribute15 :=   p_mo_line_rec_tbl(i).attribute15;
          ---
          l_trolin_tbl(i).created_by :=   g_user_id;
          l_trolin_tbl(i).creation_date   := SYSDATE;
          l_trolin_tbl(i).last_updated_by   := g_user_id;
            l_trolin_tbl(i).last_update_date := SYSDATE;
          l_trolin_tbl(i).last_update_login   := g_login_id;
          l_trolin_tbl(i).program_id :=   g_prog_id;
            l_trolin_tbl(i).program_application_id := g_prog_appl_id;
            l_trolin_tbl(i).program_update_date := SYSDATE;
          l_trolin_tbl(i).request_id :=   g_request_id;
        END LOOP;
     
          inv_move_order_pub.create_move_order_lines(p_api_version_number =>   1.0,
                                                     p_init_msg_list      =>   fnd_api.g_true,
                                                     p_return_values      =>   fnd_api.g_false,
                                                     p_commit             =>   fnd_api.g_false,
                                                     x_return_status      =>   x1_return_status,
                                                     x_msg_count          =>   x1_msg_count,
                                                     x_msg_data           =>   x1_msg_data,
                                                     p_trolin_tbl         =>   l_trolin_tbl,
                                                     p_trolin_val_tbl     =>   l_trolin_val_tbl,
                                                     x_trolin_tbl         =>   x_trolin_tbl,
                                                     x_trolin_val_tbl     =>   x_trolin_val_tbl,
                                                     p_validation_flag    =>   inv_move_order_pub.g_validation_yes);
  何雲 2013/4/3 MO/行/建立
113 12.1.3 INV 爲物料搬運單生成分配(也能夠順帶處理物料搬運單) API inv_replenish_detail_pub.line_details_pub 參數p_auto_pick_confirm給true將自動處理物料搬運單 inv_replenish_detail_pub.line_details_pub(p_line_id               =>   rec.line_id,--物料搬運單行id
                                                      x_number_of_rows        =>   x_number_of_rows,
                                                      x_detailed_qty          =>   x_detailed_qty,
                                                      x_return_status         =>   x_return_status,
                                                      x_msg_count             =>   x_msg_count,
                                                      x_msg_data              => x_return_msg,
                                                      x_revision              =>   x_revision,
                                                      x_locator_id            =>   x_locator_id,
                                                      x_transfer_to_location  =>   x_transfer_to_location,
                                                      x_lot_number            =>   x_lot_number,
                                                      x_expiration_date       =>   x_expiration_date,
                                                      x_transaction_temp_id   =>   x_transaction_temp_id,
                                                      p_transaction_header_id => NULL,
                                                      p_transaction_mode      =>   NULL,
                                                      p_move_order_type       =>   rec.move_order_type,
                                                      p_serial_flag           =>   fnd_api.g_false,
                                                      p_plan_tasks            =>   FALSE,
                                                      p_auto_pick_confirm     =>   FALSE,
                                                      p_commit                =>   FALSE);
產生的分配記錄位於如下兩張表,其中批次表能夠刪除後本身添加記錄以改變出貨批次:
    mtl_material_transactions_temp
    mtl_transaction_lots_temp
何雲 2013/4/3 MO/分配/處理
114 12.1.3 INV 查詢物料搬運單行 API inv_trolin_util.query_rows 能夠按MO行id查詢單行記錄,也能夠按MO頭id查詢多行記錄 l_trolin_tbl   := inv_trolin_util.query_rows(p_line_id => rec.line_id);   何雲 2013/4/3 MO/行/查詢
115 12.1.3 INV 查詢物料搬運單分配 API inv_mo_line_detail_util.query_rows 能夠按MO行明細id查詢單行記錄,也能夠按MO行id查詢多行記錄 l_mold_tbl   := inv_mo_line_detail_util.query_rows(p_line_id => rec.line_id);   何雲 2013/4/3 MO/分配/查詢
116 12.1.3 INV 建立貨位 API inv_loc_wms_pub.create_locator   inv_loc_wms_pub.create_locator(x_return_status            => x_return_status,
                                             x_msg_count                =>   x_msg_count,
                                             x_msg_data                 =>   x_msg_data,
                                             x_inventory_location_id    =>   l_location_id,
                                             x_locator_exists           =>   l_locator_exists,
                                             p_organization_id          =>   p_organization_id,
                                             p_organization_code        =>   NULL,
                                             p_concatenated_segments    =>   l_concatenated_segments,
                                             p_description              =>   NULL,
                                             p_inventory_location_type  =>   l_locator_type,
                                             p_picking_order            =>   NULL,
                                             p_location_maximum_units   =>   NULL,
                                             p_subinventory_code        =>   p_subinventory,
                                             p_location_weight_uom_code => NULL,
                                             p_max_weight               =>   NULL,
                                             p_volume_uom_code          =>   NULL,
                                             p_max_cubic_area           =>   NULL,
                                             p_x_coordinate             =>   NULL,
                                             p_y_coordinate             =>   NULL,
                                             p_z_coordinate             =>   NULL,
                                             p_physical_location_id     =>   NULL,
                                             p_pick_uom_code            =>   NULL,
                                             p_dimension_uom_code       =>   NULL,
                                             p_length                   =>   NULL,
                                             p_width                    =>   NULL,
                                             p_height                   =>   NULL,
                                             p_status_id                =>   1,
                                             p_dropping_order           =>   NULL,
                                             p_attribute_category       =>   NULL,
                                             p_attribute1               =>   NULL,
                                             p_attribute2               =>   NULL,
                                             p_attribute3               =>   NULL,
                                             p_attribute4               =>   NULL,
                                             p_attribute5               =>   NULL,
                                             p_attribute6               =>   NULL,
                                             p_attribute7               =>   NULL,
                                             p_attribute8               =>   NULL,
                                             p_attribute9               =>   NULL,
                                             p_attribute10              =>   NULL,
                                             p_attribute11              =>   NULL,
                                             p_attribute12              =>   NULL,
                                             p_attribute13              =>   NULL,
                                             p_attribute14              =>   NULL,
                                             p_attribute15              =>   NULL,
                                             p_alias                    =>   NULL);
  羅建波 2013/4/3 貨位建立
117 12.1.3 JTF 建立CRM資源 API jtf_rs_resource_pub.create_resource   jtf_rs_resource_pub.create_resource(p_api_version          => 1.0,
                                            p_init_msg_list        =>   fnd_api.g_false,
                                            p_commit               =>   fnd_api.g_false,
                                            p_category             =>   'EMPLOYEE',
                                            p_source_id            =>   l_person_id,
                                            p_source_name          => 'x   test 1,',
                                            p_resource_name        => 'x   test 1,',
                                            p_start_date_active    =>   SYSDATE,
                                            p_end_date_active      =>   NULL,
                                            x_return_status        =>   x_return_status,
                                            x_msg_count            =>   x_msg_count,
                                            x_msg_data             =>   x_msg_data,
                                            x_resource_id          =>   x_resource_id,
                                            x_resource_number      =>   x_resource_number)
參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-03 蘇聯章 2013/3/31 CRM   資源/建立
118 12.1.3 JTF 建立銷售人員 API jtf_rs_salesreps_pub.create_salesrep    jtf_rs_salesreps_pub.create_salesrep(p_api_version          => 1.0,
                                             p_init_msg_list        =>   fnd_api.g_true,
                                             p_commit               =>   fnd_api.g_false,
                                             p_resource_id          =>   100010143,
                                             p_sales_credit_type_id => 1,
                                             p_status               =>   'A',
                                             p_start_date_active    =>   SYSDATE - 1,
                                             p_end_date_active      =>   NULL,
                                             --p_org_id               =>   84,
                                             --p_set_of_books_id      =>   2023,
                                             p_salesrep_number      =>   '900964',
                                             x_return_status        =>   x_return_status,
                                             x_msg_count            =>   x_msg_count,
                                             x_msg_data             =>   x_msg_data,
                                             x_salesrep_id          =>   x_salesrep_id);
參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-04 蘇聯章 2013/3/31 銷售人員/建立
119 12.1.3 JTF 建立CRM資源成員關係 API jtf_rs_grp_membership_pub.create_group_membership   jtf_rs_grp_membership_pub.create_group_membership(p_api_version   => 1.0,
                                                          p_init_msg_list => fnd_api.g_true,
                                                          p_commit        =>   fnd_api.g_false,
                                                          p_resource_id   =>   100004140,
                                                          p_group_id      => 100000047,
                                                          p_role_id       =>   NULL,
                                                          p_start_date    =>   NULL,
                                                          p_end_date      =>   NULL,
                                                          x_return_status => x_return_status,
                                                          x_msg_count     =>   x_msg_count,
                                                          x_msg_data      =>   x_msg_data);
參考Oracle CRM   Application Foundation API Reference Guide Release 11i, Part No. A90092-05 蘇聯章 2013/3/31 CRM資源成員關係/建立
120 12.1.3 JTF 建立CRM資源角色關聯 API jtf_rs_role_relate_pub.create_resource_role_relate    jtf_rs_role_relate_pub.create_resource_role_relate(p_api_version        => 1.0,
      p_init_msg_list      => fnd_api.g_true,
      p_commit             => fnd_api.g_false,
      p_role_resource_type =>   'RS_INDIVIDUAL',
      p_role_resource_id   => 100005134 ,
      p_role_id            => 32,
      p_role_code          => 'SALES_REP',
      p_start_date_active  => SYSDATE,
      p_end_date_active    => NULL,
      x_return_status      => x_return_status,
      x_msg_count          => x_msg_count,
      x_msg_data           => x_msg_data,
      x_role_relate_id =>   p_role_relate_id);
參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-06 蘇聯章 2013/3/31 CRM資源角色關聯/建立
121 12.1.3 JTF 建立CRM資源組 API jtf_rs_groups_pub.create_resource_group     參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-07 蘇聯章 2013/4/8 CRM資源組/建立
122 12.1.3 JTF 建立CRM任務 API jtf_tasks_pub.create_task     參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-07 蘇聯章 2013/4/8 CRM任務/建立
123 12.1.3 JTF 建立CRM任務分配 API jtf_tasks_assignments_pub.create_task_assignment     參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-07 蘇聯章 2013/4/8 CRM任務分配/建立
124 12.1.3 JTF 建立CRM任務參照 API jtf_tasks_references_pub.create_references     參考Oracle   CRM Application Foundation API Reference Guide Release 11i, Part No.   A90092-07 蘇聯章 2013/4/8 CRM任務參照建立
125 12.1.3 MRP 建立採購規則 API mrp_sourcing_rule_pub.process_sourcing_rule       何雲 2013/4/3 採購規則/建立
126 12.1.3 MRP 建立採購規則分配 API mrp_src_assignment_pub.process_assignment       何雲 2013/4/3 採購規則/分配/建立
127 12.1.3 ONT 建立發貨 API wsh_delivery_details_pub.autocreate_deliveries       趙楊 2013/3/30 發貨
128 12.1.3 ONT 訂單導入,更新,取消,暫掛 API oe_order_pub.process_order       趙楊 2013/3/30 訂單/導入/更新/取消/暫掛
129 12.1.3 ONT 訂單行導入,更新,取消 API OE_ORDER_PUB.PROCESS_LINE       趙楊 2013/3/30 訂單行/導入/更新/取消
130 12.1.3 ONT 刪除訂單頭 API OE_ORDER_PUB.DELETE_ORDER       趙楊 2013/3/30 訂單/刪除
131 12.1.3 ONT 刪除訂單行 API OE_ORDER_PUB.DELETE_LINE       趙楊 2013/3/30 訂單行/刪除
132 12.1.3 PA 更新項目成員 API PA_PROJECT_PARTIES_PUB.UPDATE_PROJECT_PARTY       趙楊 2013/3/30 項目/更新/成員
133 12.1.3 PA 建立項目成員 API PA_PROJECT_PARTIES_PUB.CREATE_PROJECT_PARTY       趙楊 2013/3/30 項目/導入/成員
134 12.1.3 PA 建立(複製)項目 API PA_PROJECT_CORE1.COPY_PROJECT       趙楊 2013/3/30 項目/導入
135 12.1.3 PA 建立項目客戶 API PA_PROJECTS_MAINT_PVT.CREATE_CUSTOMER       趙楊 2013/3/30 項目/導入/客戶
136 12.1.3 PA 建立(複製)項目週期 API PA_RETENTION_UTIL.COPY_RETENTION_SETUP       趙楊 2013/3/30 項目/導入/週期
137 12.1.3 PA 建立任務 API PA_PROJECT_PUB.ADD_TASK   PA_PROJECT_PUB.ADD_TASK(P_API_VERSION_NUMBER    => 1.0,
                                  P_MSG_COUNT             =>   X_MSG_COUNT,
                                  P_MSG_DATA              =>   X_MSG_DATA,
                                  P_RETURN_STATUS         =>   X_RETURN_STATUS,
                                  P_PM_PRODUCT_CODE       =>   NULL,
                                  P_PA_PROJECT_ID         =>   P_PROJECT_ID,
                                  P_PM_TASK_REFERENCE     =>   P_TASK_NAME ||
                                                             P_PARENT_TASK_ID,
                                  P_PA_TASK_NUMBER        =>   P_TASK_NUMBER,
                                  P_TASK_NAME             =>   P_TASK_NAME,
                                  P_TASK_DESCRIPTION      =>   P_TASK_DESCRIPTION,
                                  P_SCHEDULED_START_DATE  =>   P_SCHEDULED_START_DATE,
                                  P_SCHEDULED_FINISH_DATE => P_SCHEDULED_FINISH_DATE,
                                  P_PA_PARENT_TASK_ID     =>   P_PARENT_TASK_ID,
                                  P_STRUCTURE_VERSION_ID  =>   P_STRUCTURE_VERSION_ID,
                                  --p_financial_task_flag  =>   'Y',
                                  P_STRUCTURE_TYPE        =>   'WORKPLAN',
                                  P_PA_PROJECT_ID_OUT     =>   X_PROJECT_ID,
                                  P_PA_PROJECT_NUMBER_OUT => X_PROJECT_NUMBER,
                                  P_TASK_TYPE             =>   P_TASK_TYPE,
                                  P_TASK_ID               =>   X_TASK_ID
                                  /*p_tasks_dff             =>   'Y',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          p_attribute3            =>   'CKD Parts Design'*/);
  趙楊 2013/3/30 任務/導入
138 12.1.3 PA 更新任務 API PA_TASK_PVT1.UPDATE_TASK       趙楊 2013/3/30 任務/更新
139 12.1.3 PA 建立任務分配 API PA_TASK_ASSIGNMENTS_PUB.CREATE_TASK_ASSIGNMENTS       趙楊 2013/3/30 任務分配/資源/導入
140 12.1.3 PA 刪除任務 API PA_PROJECT_PUB.DELETE_TASK       趙楊 2013/3/30 任務/刪除
141 12.1.3 PA 建立項目客戶 API PA_CUSTOMERS_CONTACTS_PUB.CREATE_PROJECT_CUSTOMER       趙楊 2013/3/30 項目/導入/客戶
142 12.1.3 PA 更新項目客戶 API PA_CUSTOMERS_CONTACTS_PUB.UPDATE_PROJECT_CUSTOMER       趙楊 2013/3/30 項目/更新/客戶
143 12.1.3 PA 建立項目協議 API PA_AGREEMENT_PUB.CREATE_AGREEMENT   SELECT   PA_AGREEMENTS_S.NEXTVAL
            INTO   P_AGREEMENT_IN_REC.AGREEMENT_ID
            FROM DUAL;
       
            P_AGREEMENT_IN_REC.CUSTOMER_ID             := P_CUSTOMER_ID;
          P_AGREEMENT_IN_REC.CUSTOMER_NUM            := L_CUSTOMER_NUM;
            P_AGREEMENT_IN_REC.AGREEMENT_NUM           := P_AGREEMENT_NUM;
            P_AGREEMENT_IN_REC.AGREEMENT_TYPE          := 'Original Agreement';
            P_AGREEMENT_IN_REC.PM_AGREEMENT_REFERENCE  := P_AGREEMENT_IN_REC.AGREEMENT_NUM;
          P_AGREEMENT_IN_REC.AMOUNT                  :=   P_ALLOCATED_AMOUNT;
          P_AGREEMENT_IN_REC.TERM_ID                 := 4;
            P_AGREEMENT_IN_REC.REVENUE_LIMIT_FLAG      := 'N';
            P_AGREEMENT_IN_REC.OWNED_BY_PERSON_ID      := L_OWNER_BY_PERSON_ID;
          P_AGREEMENT_IN_REC.AGREEMENT_CURRENCY_CODE   := P_CURRENCY_CODE;
            P_AGREEMENT_IN_REC.INVOICE_LIMIT_FLAG      := 'N';
          P_AGREEMENT_IN_REC.CUSTOMER_ORDER_NUMBER   := P_CUST_ORDER_NUMBER;
            P_AGREEMENT_IN_REC.ADVANCE_REQUIRED        := 'N';
            P_AGREEMENT_IN_REC.START_DATE              := P_EFFECTIVE_DATE;
       
          PA_AGREEMENT_PUB.CREATE_AGREEMENT(P_API_VERSION_NUMBER   => 1.0,
                                              P_COMMIT             =>   'F',
                                              P_INIT_MSG_LIST      =>   'F',
                                              P_MSG_COUNT          =>   X_MSG_COUNT,
                                              P_MSG_DATA           =>   X_MSG_DATA,
                                              P_RETURN_STATUS      =>   X_RETURN_STATUS,
                                              P_PM_PRODUCT_CODE    => 'PA_PROJECT',
                                              P_AGREEMENT_IN_REC   =>   P_AGREEMENT_IN_REC,
                                              P_AGREEMENT_OUT_REC  =>   P_AGREEMENT_OUT_REC,
                                              P_FUNDING_IN_TBL     => P_FUNDING_IN_TBL,
                                              P_FUNDING_OUT_TBL    =>   P_FUNDING_OUT_TBL);
       
          X_AGREEMENT_ID :=   P_AGREEMENT_OUT_REC.AGREEMENT_ID;
  趙楊 2013/3/30 項目/導入/協議
144 12.1.3 PA 建立協議行 API PA_AGREEMENT_PUB.ADD_FUNDING     趙楊 2013/3/30 項目/導入/協議行
145 12.1.3 PA 批量導入任務 API PA_TASK_PUB1.COPY_TASKS_IN_BULK       趙楊 2013/3/30 任務/批量/導入
146 12.1.3 PA 更新計劃版本 API PA_TASK_PUB1.UPDATE_SCHEDULE_VERSION       趙楊 2013/3/30 計劃/版本/更新
147 12.1.3 PA 建立計劃版本 API PA_TASK_PUB1.CREATE_SCHEDULE_VERSION       趙楊 2013/3/30 計劃/版本/建立
148 12.1.3 PA 更新結構狀態 API PA_PROJECT_PUB.CHANGE_STRUCTURE_STATUS       趙楊 2013/3/30 項目/版本/發佈
149 12.1.3 PA 更新版本屬性 API PA_PROJECT_STRUCTURE_PUB1.Update_Structure_Version_Attr       趙楊 2013/3/30 項目/版本/更新
150 12.1.3 PA 更改項目狀態 API PA_PROJECTS_MAINT_PUB.PROJECT_STATUS_CHANGE   PA_PROJECTS_MAINT_PUB.PROJECT_STATUS_CHANGE(P_INIT_MSG_LIST    => FND_API.G_TRUE,
                                                          P_COMMIT           =>   FND_API.G_FALSE,
                                                          P_VALIDATE_ONLY    =>   FND_API.G_TRUE,
                                                          P_VALIDATION_LEVEL => FND_API.G_VALID_LEVEL_FULL,
                                                          P_DEBUG_MODE       =>   'N',
                                                          P_CALLING_MODULE   =>   'SELF_SERVICE',
                                                          P_PROJECT_ID       =>   REC_HEAD.PROJECT_ID,
                                                          P_NEW_STATUS_CODE  =>   1000,
                                                          P_COMMENT          => NULL,
                                                          X_RETURN_STATUS    =>   X_RETURN_STATUS,
                                                          X_MSG_COUNT        =>   X_MSG_COUNT,
                                                          X_MSG_DATA         =>   X_MSG_DATA);
  羅建波 2013/4/3 project   stutas change
151 12.1.3 PA 更新任務狀態 API pa_status_pub.update_progress    pa_status_pub.update_progress(p_api_version_number    => 1.0,
                                        p_init_msg_list         =>   fnd_api.g_true,
                                        p_commit                =>   fnd_api.g_false,
                                        p_return_status         =>   x_return_status,
                                        p_msg_count             =>   x_msg_count,
                                        p_msg_data              =>   x_msg_data,
                                        p_project_id            =>   l_project_id,
                                        p_task_id               =>   l_task_id,
                                        p_as_of_date            =>   l_as_of_date,
                                        p_percent_complete      =>   l_percent_completes,
                                        p_object_id             =>   l_task_id,
                                        p_object_version_id     =>   p_element_version_id,
                                        p_object_type           =>   'PA_TASKS',
                                        p_task_status            =>   p_task_status,/*124 not start,125 in progress, 127 completed */
                                        p_actual_start_date     =>   p_actual_start_date,
                                        p_actual_finish_date    =>   p_actual_finish_date,
                                        p_estimated_start_date  =>   p_estimated_start_date,
                                        p_estimated_finish_date => p_estimated_finish_date,
                                        p_structure_type        =>   'WORKPLAN');
  陳範冬 2013/4/4 任務/更新
152 12.1.3 PA 獲取WBS最新版本 API pa_project_structure_utils.get_latest_wp_version   pa_project_structure_utils.get_latest_wp_version(project_id)   陳範冬 2013/4/4 WBS最新版本
153 12.1.3 PA 獲取WBS當前版本 API pa_project_structure_utils.get_current_working_ver_id   pa_project_structure_utils.get_current_working_ver_id(p_project_id)   陳範冬 2013/4/4 WBS當前版本
154 12.1.3 PO 建立autosourcing API begin   PO_AUTOSOURCE_SV . REQIMPORT_SOURCING ( 'INVENTORY' , :request_id ,
      :l_multi_dist_flag ) ; END ;
      趙楊 2013/3/30 來源補充規則
155 12.1.3 PO 關閉訂單 API po_actions.close_po   注意輸入的ACTION參數值爲PO_DOCUMENT_ACTION_PVT的全局變量   趙楊 2013/3/30 訂單/關閉/狀態
156 12.1.1 PO 一攬子採購協議導入 接口 PO.POXPDOI   v_num_request_id   := fnd_request.submit_request (
                        application =>   'PO',
                        program =>   'POXPDOI',
                        description =>   NULL,
                        start_time =>   NULL,
                        sub_request =>   FALSE,
                        argument1 =>   NULL,  --Default Buyer
                        argument2 =>   'Blanket',  --Document Type
                        argument3 =>   NULL,  --Document SubType
                        argument4 =>   'N',  --Create or Update Items
                        argument5 =>   'N',  --Create Sourcing Rules
                        argument6 =>   'Approved',  --Approval Status
                        argument7 =>   NULL,   --Release Generation   Method
                        argument8 =>   v_num_tmp,   --Batch Id
                        argument9 =>   fnd_profile.VALUE('ORG_ID'),  --ORG   Id
                        argument10 =>   NULL);
  蘇聯章 2013/3/31 採購訂單/一攬子採購協議/BPA
157 12.1.1 PO 標準採購訂單導入 接口 PO.POXPOPDOI   v_num_request_id   := fnd_request.submit_request(application => 'PO',
                                                     program     =>   'POXPOPDOI',
                                                     description => NULL,
                                                     start_time  => NULL,
                                                     sub_request => FALSE,
                                                     argument1   => NULL,   --Default Buyer
                                                     argument2   => 'STANDARD',   --Document Type
                                                     argument3   => NULL,   --Document SubType
                                                     argument4   => 'N', --Create   or Update Items
                                                     argument5   => NULL, --Create   Sourcing Rules
                                                     argument6   => 'APPROVED',   --Approval Status
                                                     argument7   => NULL,   --Release Generation Method
                                                     argument8   => v_num_tmp,   --Batch Id
                                                     argument9   =>   fnd_profile.VALUE('ORG_ID'), --ORG Id
                                                     argument10  => NULL);
  蘇聯章 2013/3/31 採購訂單/標準採購訂單
158 11.5.0 PO BPA發放取消 API po_document_control_pub.control_document   po_document_control_pub.control_document(1.0,   -- p_api_version
                                               fnd_api.g_true, -- p_init_msg_list
                                               fnd_api.g_true, -- p_commit
                                               l_api_return_status, -- x_return_status
                                               'PO', -- p_doc_type
                                               'STANDARD', -- p_doc_subtype
                                               NULL, -- p_doc_id
                                               po_rec.document_num, -- p_doc_num
                                               NULL, -- p_release_id
                                               NULL, -- p_release_num
                                               NULL, -- p_doc_line_id
                                               po_rec.line_num, -- p_doc_line_num     --------
                                               NULL, -- p_doc_line_loc_id--------
                                               po_rec.shipment_num, -- p_doc_shipment_num-------
                                               'CANCEL', -- p_action
                                               SYSDATE, -- p_action_date
                                               NULL, -- p_cancel_reason
                                               'Y', -- p_cancel_reqs_flag
                                               NULL, -- p_print_flag
                                               NULL); -- p_note_to_vendor
  黎法良 2013/3/31 BPA發放/取消
159 11.5.0 PO 取消標準採購訂單 API po_document_control_pub.control_document   po_document_control_pub.control_document(1.0,   -- p_api_version
                                               fnd_api.g_true, -- p_init_msg_list
                                               fnd_api.g_true, -- p_commit
                                               l_api_return_status, -- x_return_status
                                               'RELEASE', -- p_doc_type
                                               'BLANKET', --p_doc_subtype: 'BLANKET','STANDARD','SCHEDULED'
                                               NULL, -- p_doc_id
                                               release_rec.document_num, -- p_doc_num
                                               NULL, -- p_release_id
                                               release_rec.release_num, -- p_release_num
                                               NULL, -- p_doc_line_id
                                               NULL,--3, -- p_doc_line_num     --------
                                               NULL, -- p_doc_line_loc_id--------
                                               release_rec.shipment_num, --1, -- p_doc_shipment_num-------
                                               'CANCEL', -- p_action
                                               SYSDATE, -- p_action_date
                                               NULL, -- p_cancel_reason
                                               'Y', -- p_cancel_reqs_flag
                                               NULL, -- p_print_flag
                                               NULL); -- p_note_to_vendor
  黎法良 2013/3/31 標準採購訂單/取消
160 11.5.0 PO 更新BPA發放 API po_change_api1_s.update_po   l_result   := po_change_api1_s.update_po(x_po_number           => po_rec.document_num,
                                             x_release_number      =>   NULL,
                                             x_revision_number     =>   po_rec.revision_num,
                                             x_line_number         =>   po_rec.line_num,
                                             x_shipment_number     =>   po_rec.shipment_num,
                                             new_quantity          =>   po_rec.new_quantity,
                                             new_price             =>   po_rec.new_price,
                                             new_promised_date     =>   fnd_conc_date.string_to_date(po_rec.new_promised_date),
                                             launch_approvals_flag => po_rec.launch_approvals_flag,
                                             update_source         =>   NULL,
                                             version               =>   '1.0',
                                             x_override_date       =>   NULL,
                                             x_api_errors          =>   l_api_errors,
                                             p_buyer_name          =>   NULL);
注意版本號,若是原來是審批狀態,那麼更新後版本號加一 黎法良 2013/3/31 BPA發放/更新
161 11.5.0 PO 更新標準採購訂單 API po_change_api1_s.update_po   l_result   := po_change_api1_s.update_po(x_po_number           =>   release_rec.document_num,
                                             x_release_number      =>   release_rec.release_num,
                                             x_revision_number     =>   release_rec.revision_num,
                                             x_line_number         =>   release_rec.line_num,
                                             x_shipment_number     =>   release_rec.shipment_num,
                                             new_quantity          => release_rec.new_quantity,
                                             new_price             =>   release_rec.new_price,
                                             new_promised_date     =>   fnd_conc_date.string_to_date(release_rec.new_promised_date),
                                             launch_approvals_flag => release_rec.launch_approvals_flag,
                                             update_source         =>   NULL,
                                             version               =>   '1.0',
                                             x_override_date       => NULL,
                                             x_api_errors          =>   l_api_errors,
                                             p_buyer_name          =>   NULL);
注意版本號,若是原來是審批狀態,那麼更新後版本號加一 黎法良 2013/3/31 標準採購訂單/更新
162 11.5.0 PO PR自動建立PO API PO_INTERFACE_S.create_documents   PO_INTERFACE_S.create_documents(p_api_version             => 1.0,
                                      x_return_status           => l_return_status,
                                      x_msg_count               =>   l_msg_count,
                                    x_msg_data                => l_msg_data,
                                      p_batch_id                =>   x_interface_header_id,
                                      p_req_operating_unit_id   =>   l_requesting_org_id,
                                      p_purch_operating_unit_id => l_purchasing_org_id,
                                      x_document_id             =>   x_document_id,
                                      x_number_lines            =>   x_num_lines_processed,
                                      x_document_number         =>   l_document_number,
                                    --   Bug 3648268 Use lookup code instead of hardcoded value
                                      p_document_creation_method => 'AUTOCREATE');   
這是標準功能「自動建立」From代碼底層調用的包 黎法良 2013/3/31 PR自動建立PO/導入
163 11.5.0 PO 獲取OU本位幣 API po_currency_sv.get_functional_currency_code   po_currency_sv.get_functional_currency_code(:parameter.po_org_id,:parameter.po_ou_currency_code);   黎法良 2013/3/31 獲取OU本位幣/函數
164 11.5.0 PO 獲取兩OU本位幣匯率 API po_currency_sv.get_cross_ou_rate   l_rate   := po_currency_sv.get_cross_ou_rate(p_from_ou_id => p_pr_org_id,
                                                 p_to_ou_id   => p_po_org_id);
  黎法良 2013/3/31 獲取兩OU本位幣匯率/函數
165 12.1.3 PO 建立採購申請 API po_create_requisition_sv.process_requisition   DECLARE
      l_header_rec   po_create_requisition_sv.header_rec_type;
      l_line_rec   po_create_requisition_sv.line_tbl_type;
      l_status     VARCHAR2(240);
      l_count      NUMBER;
      l_msg        VARCHAR2(4000);
    BEGIN
        /*fnd_global.apps_initialize(user_id => 1151, resp_id => 50717,   resp_appl_id => 201);
      mo_global.init('M');  */
   
      l_header_rec.org_id               := 81;--PR所屬OU
      l_header_rec.type_lookup_code     := 'INTERNAL';--PR的類型,此處爲內部
      l_header_rec.preparer_id          := 61;--編制者
      l_header_rec.authorization_status   := 'APPROVED';--要建立的PR狀態,此處爲已批准
      l_header_rec.created_by           := 1151;--WHO字段
      l_header_rec.creation_date        := SYSDATE;--WHO字段
      l_header_rec.last_update_date     := SYSDATE;--WHO字段
      l_header_rec.last_updated_by      := 1151;--WHO字段
      l_header_rec.last_update_login    := -1;--WHO字段
   
      --下面僅展現單行PR,多行可類推
      l_line_rec(1).line_num :=   '1';--PR行號
      l_line_rec(1).line_type_id :=   1;--行類型
      l_line_rec(1).item_id :=   8001;--物料
      l_line_rec(1).item_revision :=   0;--物料版本
      l_line_rec(1).category_id :=   2133;--物料類別
      l_line_rec(1).item_description :=   '富麗成品01';--物料描述
      l_line_rec(1).uom_code :=   'EA';--採購單位
      l_line_rec(1).quantity :=   10;--採購數量
      l_line_rec(1).unit_price :=   100;--單價
      l_line_rec(1).need_by_date :=   SYSDATE + 1;--需求日期
      l_line_rec(1).suggested_buyer_id :=   82;--建議購買者
      l_line_rec(1).rate_date :=   SYSDATE;--匯率日期
      l_line_rec(1).destination_type_code   := 'INVENTORY';--目的地類型,此處爲庫存
      l_line_rec(1).to_person_id :=   61;--申請人
      l_line_rec(1).destination_organization_id   := 92;--目的庫存組織
        l_line_rec(1).deliver_to_location_id := 368;--發運目的地
      l_line_rec(1).source_type_code :=   'INVENTORY';--來源類型,此處爲庫存
        l_line_rec(1).source_organization_id := 91;--來源組織
      l_line_rec(1).created_by :=   1151;--WHO字段
      l_line_rec(1).creation_date :=   SYSDATE;--WHO字段
      l_line_rec(1).last_update_date :=   SYSDATE;--WHO字段
      l_line_rec(1).last_updated_by :=   1151;--WHO字段
      l_line_rec(1).last_update_login :=   -1;--WHO字段
   
        po_create_requisition_sv.process_requisition(px_header_rec   => l_header_rec,
                                                     px_line_table   =>   l_line_rec,
                                                     x_return_status => l_status,
                                                     x_msg_count     =>   l_count,
                                                     x_msg_data      =>   l_msg);
   
      --dbms_output.put_line(l_status ||   ':' || l_msg);
      --l_msg :=   fnd_msg_pub.get_detail(fnd_msg_pub.g_first, fnd_api.g_false);
      dbms_output.put_line(l_status ||   ':' || l_msg);
      COMMIT;
    END;
  何雲 2013/4/3 PR/建立
166 12.1.3 PO PO接收/PO退貨/RMA接收 接口 PO.RVCTP rcv_headers_interface
    rcv_transactions_interface
    mtl_transaction_lots_interface
    錯誤信息表:
    po_interface_errors
/*此爲PO接收的例子*/
        l_iface_hdr_rec.last_update_date    := SYSDATE;
      l_iface_hdr_rec.last_updated_by   := l_user_id;
      l_iface_hdr_rec.creation_date     := SYSDATE;
      l_iface_hdr_rec.created_by        := l_user_id;
      l_iface_hdr_rec.last_update_login   := l_login;
   
      l_iface_rcv_rec.last_update_date  := SYSDATE;
        l_iface_rcv_rec.last_updated_by     := l_user_id;
      l_iface_rcv_rec.creation_date     := SYSDATE;
      l_iface_rcv_rec.created_by        := l_user_id;
      l_iface_rcv_rec.last_update_login   := l_login;
   
      SELECT   po.rcv_headers_interface_s.nextval
        INTO   l_iface_hdr_rec.header_interface_id
        FROM dual;
   
      IF x_group_id IS NULL THEN
        SELECT   po.rcv_interface_groups_s.nextval
          INTO   l_iface_hdr_rec.group_id
          FROM dual;
      ELSE
        l_iface_hdr_rec.group_id :=   x_group_id;
      END IF;
   
        l_iface_hdr_rec.processing_status_code    := 'PENDING';
        l_iface_hdr_rec.receipt_source_code       := 'VENDOR';
        l_iface_hdr_rec.transaction_type          := 'NEW';
        l_iface_hdr_rec.auto_transact_code        := 'RECEIVE';
      l_iface_hdr_rec.receipt_num             := NULL; --Automatic   Number
      l_iface_hdr_rec.vendor_id               := p_vendor_id;
      l_iface_hdr_rec.vendor_site_id          := p_vendor_site_id;   --Optional
        l_iface_hdr_rec.expected_receipt_date     := p_expected_receipt_date;
        l_iface_hdr_rec.validation_flag           := 'Y';
      l_iface_hdr_rec.ship_to_organization_id   := p_to_organization_id;
   
      INSERT INTO   po.rcv_headers_interface VALUES l_iface_hdr_rec;
   
      FOR i IN 1 .. p_rcv_transaction_rec_tbl.count   LOOP
     
        SELECT   rcv_transactions_interface_s.nextval
          INTO   l_iface_rcv_rec.interface_transaction_id
          FROM dual;
     
          l_iface_rcv_rec.header_interface_id       := l_iface_hdr_rec.header_interface_id;
        l_iface_rcv_rec.group_id                :=   l_iface_hdr_rec.group_id;
        l_iface_rcv_rec.processing_status_code  := 'PENDING';
          l_iface_rcv_rec.transaction_status_code := 'PENDING';
        l_iface_rcv_rec.processing_mode_code    := 'BATCH';
          l_iface_rcv_rec.validation_flag           := 'Y';
        l_iface_rcv_rec.receipt_source_code     := 'VENDOR';
        l_iface_rcv_rec.vendor_id               := p_vendor_id;
          l_iface_rcv_rec.vendor_site_id            := p_vendor_site_id; --Optional
     
        l_iface_rcv_rec.source_document_code   := 'PO';
        l_iface_rcv_rec.po_header_id         :=   p_rcv_transaction_rec_tbl(i)
                                                  .po_header_id;
        l_iface_rcv_rec.po_line_id           :=   p_rcv_transaction_rec_tbl(i)
                                                  .po_line_id;
          l_iface_rcv_rec.po_line_location_id    := p_rcv_transaction_rec_tbl(i)
                                                  .po_line_location_id;
          l_iface_rcv_rec.po_release_id          := p_rcv_transaction_rec_tbl(i)
                                                  .po_release_id;
     
        l_iface_rcv_rec.transaction_type      := 'RECEIVE';
          l_iface_rcv_rec.auto_transact_code      := 'DELIVER';
        l_iface_rcv_rec.destination_type_code   := 'INVENTORY';
     
        l_iface_rcv_rec.category_id      := p_rcv_transaction_rec_tbl(i)
                                              .category_id;
        l_iface_rcv_rec.item_id          :=   p_rcv_transaction_rec_tbl(i).item_id;
        l_iface_rcv_rec.transaction_date   := p_rcv_transaction_rec_tbl(i)
                                              .transaction_date;
        l_iface_rcv_rec.quantity         :=   p_rcv_transaction_rec_tbl(i)
                                              .quantity;
          l_iface_rcv_rec.unit_of_measure    := p_rcv_transaction_rec_tbl(i)
                                              .unit_of_measure; --Not Code
     
          l_iface_rcv_rec.to_organization_id    := p_to_organization_id;
        l_iface_rcv_rec.ship_to_location_id   := p_rcv_transaction_rec_tbl(i)
                                                 .ship_to_location_id;
        l_iface_rcv_rec.location_id         :=   p_rcv_transaction_rec_tbl(i)
                                                 .location_id;
        l_iface_rcv_rec.subinventory        := p_rcv_transaction_rec_tbl(i)
                                                 .subinventory;
        l_iface_rcv_rec.locator_id          :=   p_rcv_transaction_rec_tbl(i)
                                                 .locator_id;
     
          l_iface_rcv_rec.interface_source_code    := p_rcv_transaction_rec_tbl(i)
                                                      .interface_source_code;
          l_iface_rcv_rec.interface_source_line_id :=   p_rcv_transaction_rec_tbl(i)
                                                      .interface_source_line_id;
     
        INSERT INTO   po.rcv_transactions_interface VALUES l_iface_rcv_rec;
     
        FOR j IN 1 ..   p_rcv_transaction_rec_tbl(i).lot_number.count LOOP
            l_iface_lot_rec.last_update_date    := SYSDATE;
            l_iface_lot_rec.last_updated_by     := l_user_id;
            l_iface_lot_rec.creation_date       := SYSDATE;
          l_iface_lot_rec.created_by        := l_user_id;
            l_iface_lot_rec.last_update_login := l_login;
       
          SELECT   mtl_material_transactions_s.nextval
            INTO   l_iface_lot_rec.transaction_interface_id
            FROM dual;
       
            l_iface_lot_rec.product_code             := 'RCV';
            l_iface_lot_rec.product_transaction_id :=   l_iface_rcv_rec.interface_transaction_id;
          l_iface_lot_rec.lot_number             :=   p_rcv_transaction_rec_tbl(i)
                                                      .lot_number(j);
            l_iface_lot_rec.transaction_quantity     := p_rcv_transaction_rec_tbl(i)
                                                      .lot_qty(j);
          l_iface_lot_rec.primary_quantity       := p_rcv_transaction_rec_tbl(i)
                                                      .lot_qty(j);
       
          INSERT INTO   mtl_transaction_lots_interface VALUES l_iface_lot_rec;
       
        END LOOP;
      END LOOP;
   
      l_request_id :=   fnd_request.submit_request(application => 'PO',
                                                   program     => 'RVCTP',
                                                   sub_request => FALSE,
                                                   argument1   => 'BATCH',
                                                   argument2   => p_group_id);
   
      IF l_request_id > 0 THEN
     
        COMMIT;
     
        x_return_msg := x_return_msg   ||
                        'Success to   submit request:request id is ' ||
                        l_request_id ||   '.' || g_line_end;
     
        l_request_flag :=   fnd_concurrent.wait_for_request(request_id => l_request_id,
                                                            INTERVAL   => 5,
                                                            phase      => l_phase,
                                                            status     => l_status,
                                                            dev_phase  =>   l_dev_phase,
                                                            dev_status => l_dev_status,
                                                            message    =>   l_message);
        IF l_request_flag THEN
          IF l_dev_status = 'NORMAL'   THEN
         
            x_return_status := 'S';
         
            FOR rec_msg IN (SELECT   pie.error_message,
                                     nvl(rti.po_header_id, rti.oe_order_header_id) po_header_id,
                                     nvl(rti.po_line_id, rti.oe_order_line_id) po_line_id,
                                     rti.item_id
                              FROM   po_interface_errors        pie,
                                     rcv_transactions_interface rti
                             WHERE   pie.interface_line_id =
                                     rti.interface_transaction_id
                               AND   pie.batch_id = p_group_id) LOOP
              x_return_status :=   'E';
              x_return_msg    := substrb(x_return_msg || l_index || ':'   ||
                                           rec_msg.error_message || '(header id:' ||
                                           rec_msg.po_header_id || ',line id:' ||
                                           rec_msg.po_line_id || ',item id:' ||
                                           rec_msg.item_id || ').' || g_line_end,
                                           1,
                                           3500);
              l_index         := l_index + 1;
              EXIT WHEN   lengthb(x_return_msg) >= 3500;
            END LOOP;
         
          ELSE
         
            x_return_status := 'E';
         
            x_return_msg := x_return_msg   ||
                            'Exceptions   happen during execution of the request(request id:' ||
                            l_request_id   || ').' || g_line_end;
         
            FOR rec_msg IN (SELECT   pie.error_message,
                                     nvl(rti.po_header_id, rti.oe_order_header_id) po_header_id,
                                     nvl(rti.po_line_id, rti.oe_order_line_id) po_line_id,
                                     rti.item_id
                              FROM   po_interface_errors        pie,
                                     rcv_transactions_interface rti
                             WHERE   pie.interface_line_id =
                                     rti.interface_transaction_id
                               AND   pie.batch_id = p_group_id) LOOP
              x_return_status :=   'E';
              x_return_msg    := substrb(x_return_msg || l_index || ':'   ||
                                           rec_msg.error_message || '(header id:' ||
                                           rec_msg.po_header_id || ',line id:' ||
                                           rec_msg.po_line_id || ',item id:' ||
                                           rec_msg.item_id || ').' || g_line_end,
                                           1,
                                           3500);
              l_index         := l_index + 1;
              EXIT WHEN   lengthb(x_return_msg) >= 3500;
            END LOOP;
         
          END IF;
        ELSE
          x_return_status := 'E';
          x_return_msg    := x_return_msg ||
                             'The request   has not been finished yet and the result is unknown.' ||
                               g_line_end;
        END IF;
      ELSE
        x_return_status := 'E';
        x_return_msg    := x_return_msg ||
                           'Fail to   submit request to process data in interface.' ||
                             g_line_end;
      END IF;
  何雲 2013/4/3 PO/RMA/接收
167 12.1.3 SR 建立服務請求 API cs_servicerequest_pub.create_servicerequest       陳範冬 2013/4/4 建立服務請求
168 12.1.3 SR 更新服務請求 API cs_servicerequest_pub.update_servicerequest       陳範冬 2013/4/4 更新服務請求
169 12.1.3 SR 更新服務請求狀態 API cs_servicerequest_pub.update_status       陳範冬 2013/4/4 更新服務請求狀態
170 12.1.3 SR 更新服務問題編碼 API cs_servicerequest_pub.update_problem_code       陳範冬 2013/4/4 更新服務問題編碼
171 12.1.3 SR 服務任務建立/更新/鎖定/刪除 API jtf_task_assignments_pub.create_task_assignment
    jtf_task_assignments_pub.update_task_assignment
    jtf_task_assignments_pub.lock_task_assignment
    jtf_task_assignments_pub.delete_task_assignment
      陳範冬 2013/4/4 SR新增/更新/鎖定/刪除SR任務
172 12.1.3 SR 建立例程 API csi_item_instance_pub.create_item_instance       陳範冬 2013/4/4 建立例程
173 12.1.3 SR 更新例程 API csi_item_instance_pub.update_item_instance       陳範冬 2013/4/4 更新例程
174 12.1.3 SR 終止例程 API csi_item_instance_pub.expire_item_instance       陳範冬 2013/4/4 終止例程
175 12.1.3 SR 複製例程 API csi_item_instance_pub.copy_item_instance       陳範冬 2013/4/4 複製例程
176 12.0.6 WIP 離散任務導入 接口 WIP.WICMLP   l_request_id   := fnd_request.submit_request(application => 'WIP',
                                                 program     =>   'WICMLP',
                                                 description => NULL,
                                                 start_time  => NULL,
                                                 sub_request => FALSE,
                                                 argument1   =>   l_group_id,
                                                 argument2   => 0,
                                                 argument3   => 'Yes');
WICMLP請求是調用到wip_massload_pub.massloadjobs來實現 黎法良 2013/3/31 離散任務/導入
177 12.0.6 WIP 離散任務導入 API wip_massload_pub.massloadjobs   wip_massload_pub.massloadjobs(p_groupid         => l_group_id,
                                    p_validationlevel => 0,
                                    p_commitflag      => 0, --0   false
                                    x_returnstatus    =>   l_return_status,
                                    x_errormsg        =>   l_error_msg);
  黎法良 2013/3/31 離散任務/導入
178 12.0.6 WMS LPN重用 API wms_container_pub.reuse_lpns     PROCEDURE reuse_lpn(x_return_status            OUT NOCOPY VARCHAR2,
                            x_return_message           OUT   NOCOPY VARCHAR2,
                            p_organization_id          IN   NUMBER,
                          p_lpn_id                   IN NUMBER,
                            p_clear_containter_item_id IN VARCHAR) IS
        PRAGMA   AUTONOMOUS_TRANSACTION;
        l_msg_count         NUMBER;
        l_msg_data          VARCHAR2(1000);
        l_clear_attributes  VARCHAR2(10) := 'Y';
        l_unpack_inner_lpns VARCHAR2(10)   := 'N';
     
        x_msg_list VARCHAR2(2000) :=   NULL;
      BEGIN
        x_return_status  := fnd_api.g_ret_sts_success;
        x_return_message := NULL;
          wms_container_pub.reuse_lpns(p_api_version              => 1,
                                       p_init_msg_list            =>   fnd_api.g_true,
                                       x_return_status            =>   x_return_status,
                                       x_msg_count                =>   l_msg_count,
                                       x_msg_data                 =>   l_msg_data,
                                       p_lpn_id                   =>   p_lpn_id,
                                       p_clear_attributes         =>   l_clear_attributes,
                                       p_new_org_id               =>   p_organization_id,
                                       p_unpack_inner_lpns        =>   l_unpack_inner_lpns,
                                       p_clear_containter_item_id => nvl(p_clear_containter_item_id,
                                                                         'N'));
        IF x_return_status <>   fnd_api.g_ret_sts_success THEN
          IF fnd_msg_pub.count_msg >=   1 THEN
            FOR i IN 1 ..   fnd_msg_pub.count_msg LOOP
              x_return_message :=   substr(x_return_message ||
                                           fnd_msg_pub.get_detail(i, 'F') || ';',
                                           1,
                                           2000);
            END LOOP;
          END IF;
        END IF;
        COMMIT;
      EXCEPTION
        WHEN OTHERS THEN
          x_return_message :=   SQLERRM;
      END reuse_lpn;
  徐衝 2013/4/2 LPN重用
179 12.1.3 WMS 建立LPN API inv_rcv_common_apis.create_lpn             inv_rcv_common_apis.create_lpn(p_organization_id =>   rec_h.organization_id,
                                             p_lpn             =>   cux_wms_rcv_trn_lpn_s.nextval,
                                             p_lpn_id          =>   x_lpn_id,
                                             x_return_status   =>   x_return_status,
                                             x_msg_data        =>   x_msg_data);
          
  徐衝 2013/4/2 建立LPN
180 12.1.3 WSH 爲銷售訂單建立批號 API wsh_picking_batches_pub.create_batch autocreate_delivery_flag爲Y將自動建立交貨號;
    auto_pick_confirm_flag爲Y將自動處理物料搬運單
SELECT   wpr.organization_id,
               wpr.autocreate_delivery_flag,
               wpr.autodetail_pr_flag,
             wpr.autopack_flag,
             wpr.append_flag,
               wpr.include_planned_lines,
               wpr.ac_delivery_criteria,
               wpr.task_planning_flag,
               wpr.auto_pick_confirm_flag,
               wpr.existing_rsvs_only_flag,
               wpr.dynamic_replenishment_flag,
               wpr.backorders_only_flag,
             wpr.allocation_method,
               wpr.pick_grouping_rule_id,
               wpr.pick_sequence_rule_id,
               wpr.default_stage_subinventory,
               wpr.pick_from_subinventory,
               wpr.pick_from_locator_id
        INTO   l_batch_info_rec.organization_id, --挑庫庫存組織
               l_batch_info_rec.autocreate_delivery_flag, --自動建立交貨號
               l_batch_info_rec.autodetail_pr_flag,
             l_batch_info_rec.autopack_flag,
               l_batch_info_rec.append_flag,
               l_batch_info_rec.include_planned_lines,
               l_batch_info_rec.ac_delivery_criteria,
               l_batch_info_rec.task_planning_flag,
               l_batch_info_rec.auto_pick_confirm_flag, --自動處理物料搬運單
               l_batch_info_rec.existing_rsvs_only_flag,
               l_batch_info_rec.dynamic_replenishment_flag,
             l_batch_info_rec.backorders_only_flag,
               l_batch_info_rec.allocation_method,
               l_batch_info_rec.pick_grouping_rule_id,
               l_batch_info_rec.pick_sequence_rule_id,
               l_batch_info_rec.default_stage_subinventory,
               l_batch_info_rec.pick_from_subinventory, --挑庫來源子庫
               l_batch_info_rec.pick_from_locator_id --挑庫來源貨位
        FROM wsh_picking_rules wpr
       WHERE wpr.picking_rule_id = l_picking_rule_id;
   
      --如下限制挑庫發放的範圍
        l_batch_info_rec.delivery_detail_id       := l_delivery_detail_id;
        l_batch_info_rec.order_header_id          := l_oe_header_id;
        l_batch_info_rec.category_set_id            := NULL;
      l_batch_info_rec.category_id              := NULL;
        l_batch_info_rec.from_scheduled_ship_date := NULL;
        l_batch_info_rec.to_scheduled_ship_date   := NULL;
        l_batch_info_rec.from_requested_date        := NULL;
        l_batch_info_rec.to_requested_date        := NULL;
   
        wsh_picking_batches_pub.create_batch(p_api_version   => l_api_version,
                                             p_init_msg_list => fnd_api.g_false,
                                             p_commit        =>   fnd_api.g_false,
                                             x_return_status => x_return_status,
                                             x_msg_count     =>   x_msg_count,
                                             x_msg_data      =>   x_msg_data,
                                             p_batch_rec     =>   l_batch_info_rec,
                                             x_batch_id      =>   x_batch_id);
  何雲 2013/4/3 SO/批/建立
181 12.1.3 WSH 發放銷售訂單 API wsh_picking_batches_pub.release_batch   wsh_picking_batches_pub.release_batch(p_api_version   => 1.0,
                                                p_init_msg_list => fnd_api.g_false,
                                                p_commit        =>   fnd_api.g_false,
                                                x_return_status => x_return_status,
                                                x_msg_count     =>   l_msg_count,
                                                x_msg_data      =>   x_return_msg,
                                                p_batch_id      =>   x_batch_id,
                                                p_release_mode  => 'ONLINE',   --CONCURRENT / ONLINE
                                                x_request_id    =>   x_request_id);
  何雲 2013/4/3 SO/發放
182 12.1.3 WSH 建立交貨號 API wsh_delivery_autocreate.autocreate_deliveries   l_line_rows(1)   := p_delivery_detail_id;
     
          wsh_delivery_autocreate.autocreate_deliveries(p_line_rows         => l_line_rows,
                                                        p_init_flag         =>   'Y',
                                                        p_pick_release_flag => 'Y',
                                                        x_del_rows          =>   l_del_rows,
                                                        x_grouping_rows     =>   l_grouping_rows,
                                                        x_return_status     =>   x_return_status);
     
        IF l_del_rows.count > 0   THEN
          x_delivery_id :=   l_del_rows(1);
        END IF;
     
        IF x_return_status <>   wsh_util_core.g_ret_sts_success THEN
          x_return_msg := x_return_msg ||   'Fail to autocreate deliveries.';
        END IF;
  何雲 2013/4/3 SO/交貨號/建立
183 12.1.3 WSH 發運確認銷售訂單 API wsh_deliveries_pub.delivery_action   wsh_deliveries_pub.delivery_action(p_api_version_number   => 1,
                                             p_init_msg_list      =>   fnd_api.g_false,
                                             x_return_status      =>   x_return_status,
                                             x_msg_count          =>   l_msg_count,
                                             x_msg_data           =>   l_msg_data,
                                             p_action_code        =>   p_action_code,--CONFIRM爲發運確認
                                             p_delivery_id        =>   p_delivery_id,--按交貨號發運確認
                                             p_delivery_name      =>   p_delivery_name,--可空
                                             p_sc_actual_dep_date => p_sc_actual_dep_date,--發運確認日期
                                             p_sc_report_set_id   =>   p_sc_report_set_id,--報表集
                                             p_sc_rule_id         =>   p_sc_rule_id,--發運確認規則
                                             x_trip_id            =>   x_trip_id,
                                             x_trip_name          =>   x_trip_name);
  何雲 2013/4/3 SO/發運確認
184 12.1.3 XLA 建立分錄 API xla_journal_entries_pub_pkg.create_journal_entry_header
    xla_journal_entries_pub_pkg.create_journal_entry_line
    xla_journal_entries_pub_pkg.complete_journal_entry
      趙楊 2013/3/30 XLA/分錄/建立
185 12.1.3 INV 庫存客戶物料導入 接口 INV.INVCIINT
    INV.INVCIINTX
接口表
    Mtl_Ci_Interface,Mtl_Ci_Xrefs_Interface
    趙楊 2013/6/3 INV/庫存客戶物料/導入
186 12.1.3 PO PO關閉頭 API po_action.close_po     傳入ACTION爲'FINAL   CLOSE' 趙楊 2013/7/13 PO/PO關閉頭
187 12.1.3 ONT 獲取訂單頭附屬欄位信息 API OE_OE_TOTAL_SUMMARY.ORDER_TOTALS       陳範冬 2013/9/9 OM/訂單頭附屬字段信息
188 12.x.x FND 獲取關鍵性彈性域組合ccid API fnd_flex_ext.get_ccid   SELECT   fnd_flex_ext.get_ccid(application_short_name => 'OFA',
                                   key_flex_code          =>   'LOC#',
                                   structure_number       =>   101,
                                   validation_date        =>   to_char(SYSDATE,
                                                                     'YYYY/MM/DD HH24:MI:SS'),
                                   concatenated_segments  =>   '1001.10.0101010101001.321.910')
      FROM dual;
若是組合已經存在,返回ccid,若是不存在,則建立該組合後返回ccid 陳範冬 2013/9/9 FND/關鍵性彈性域組合ccid
189 12.x.x FA 資產分配 API fa_transfer_pub.do_transfer       陳範冬 2013/9/9 FA/資產分配
190 12.x.x FA 資產報廢 API fa_retirement_pub.do_retirement   DECLARE
      l_trans_rec        fa_api_types.trans_rec_type;
      l_dist_trans_rec   fa_api_types.trans_rec_type;
      l_asset_hdr_rec    fa_api_types.asset_hdr_rec_type;
      l_asset_retire_rec   fa_api_types.asset_retire_rec_type;
      l_asset_dist_tbl   fa_api_types.asset_dist_tbl_type;
      l_subcomp_tbl      fa_api_types.subcomp_tbl_type;
      l_inv_tbl          fa_api_types.inv_tbl_type;
      --====================
      p_line_id NUMBER := 8;
   
      CURSOR cur_asset IS
        SELECT his.asset_id,   his.book_type_code, fb.cost
       
          FROM fa_distribution_history   his
              ,cux_fa_dept_lines_all   cfl
              ,fa_books                fb
       
         WHERE cfl.from_distribution_id =   his.distribution_id
           AND fb.asset_id =   his.asset_id
           AND fb.book_type_code =   his.book_type_code
           AND cfl.line_id =   p_line_id;
      l_asset_rec   cur_asset%ROWTYPE;
      --====================
      l_return_status VARCHAR2(1);
      l_mesg_count    NUMBER;
      l_mesg          VARCHAR2(4000);
    BEGIN
      --init
      l_trans_rec        := NULL;
      l_dist_trans_rec   := NULL;
      l_asset_hdr_rec    := NULL;
      l_asset_retire_rec := NULL;
      l_asset_dist_tbl.delete;
      l_subcomp_tbl.delete;
      l_inv_tbl.delete;
   
      fa_srvr_msg.init_server_message;
   
      OPEN cur_asset;
      FETCH cur_asset
        INTO l_asset_rec;
      CLOSE cur_asset;
   
      l_asset_hdr_rec.asset_id        := l_asset_rec.asset_id;
      l_asset_hdr_rec.book_type_code  := l_asset_rec.book_type_code;
      l_asset_retire_rec.cost_retired :=   l_asset_rec.cost;
      --
        l_asset_retire_rec.calculate_gain_loss := fnd_api.g_true;   --是否當即計算損益
      -- Get standard who info
      l_trans_rec.who_info.last_updated_by   := fnd_global.user_id;
        l_trans_rec.who_info.last_update_date    := SYSDATE;
        l_trans_rec.who_info.last_update_login := fnd_global.login_id;
        l_trans_rec.who_info.creation_date       := l_trans_rec.who_info.last_update_date;
        l_trans_rec.who_info.created_by          := l_trans_rec.who_info.last_updated_by;
   
      fa_retirement_pub.do_retirement(
                                      --   std parameters
                                        p_api_version      => 1.0,
                                        p_init_msg_list    =>   fnd_api.g_true,
                                        p_commit           =>   fnd_api.g_false,
                                        p_validation_level => fnd_api.g_valid_level_full,
                                        p_calling_fn       =>   'fa_transfers.post_forms_commit',
                                        x_return_status    =>   l_return_status,
                                        x_msg_count        =>   l_mesg_count,
                                        x_msg_data         =>   l_mesg,
                                      --   api parameters
                                        px_trans_rec        =>   l_trans_rec,
                                        px_dist_trans_rec   =>   l_dist_trans_rec,
                                        px_asset_hdr_rec    =>   l_asset_hdr_rec,
                                        px_asset_retire_rec => l_asset_retire_rec,
                                        p_asset_dist_tbl    =>   l_asset_dist_tbl,
                                        p_subcomp_tbl       =>   l_subcomp_tbl,
                                        p_inv_tbl           =>   l_inv_tbl);
      --dump messages
      l_mesg_count :=   fnd_msg_pub.count_msg;
      IF l_mesg_count > 0 THEN
        l_mesg := chr(10) ||
                    substr(fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false),
                         1,
                         250);
          dbms_output.put_line(l_mesg);
        FOR i IN 1 .. (l_mesg_count - 1)   LOOP
          l_mesg :=   substr(fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false),
                           1,
                           250);
            dbms_output.put_line(l_mesg);
        END LOOP;
        fnd_msg_pub.delete_msg();
      END IF;
      IF (l_return_status <>   fnd_api.g_ret_sts_success) THEN
          dbms_output.put_line('FAILURE');
        ROLLBACK;
      ELSE
          dbms_output.put_line('SUCCESS');
        dbms_output.put_line('RETIREMENT_ID'   ||
                               to_char(l_asset_retire_rec.retirement_id));
      END IF;
    END;
    /
   
報廢成本等於當前成本便可徹底報廢 陳範冬 2013/9/9 FA/資產報廢
191 12.x.x FA 資產成批新增 接口 fa_mass_additions   DECLARE
      l_iface_rec           fa_mass_additions%ROWTYPE;
      l_source_asset_rec    fa_additions_v%ROWTYPE;
      l_source_book_rec     fa_books%ROWTYPE;
      l_asset_id            NUMBER := 100000020;
      l_book_type_code      VARCHAR2(15) := '1001_FA';
      l_dest_book_type_code VARCHAR2(15)   := '1002_FA';
    BEGIN
      --資產來源信息
      SELECT fa.*
        INTO l_source_asset_rec
        FROM fa_additions_v fa
       WHERE fa.asset_id =   l_asset_id;
   
      SELECT   fa_mass_additions_s.nextval
        INTO l_iface_rec.mass_addition_id
        FROM dual;
   
      l_iface_rec.posting_status     := 'NEW';
      l_iface_rec.queue_name         := 'NEW';
      l_iface_rec.feeder_system_name :=   '04'; --公司間調入
      l_iface_rec.create_batch_date  := SYSDATE;
      l_iface_rec.asset_number       :=   l_source_asset_rec.asset_number;
      l_iface_rec.tag_number         :=   l_source_asset_rec.tag_number;
      l_iface_rec.description        := l_source_asset_rec.description;
      l_iface_rec.asset_category_id  :=   l_source_asset_rec.asset_category_id;
      l_iface_rec.manufacturer_name  := l_source_asset_rec.manufacturer_name;   --供應商
      l_iface_rec.serial_number      := l_source_asset_rec.serial_number;   --資產序列號
      l_iface_rec.model_number       := l_source_asset_rec.model_number;   --資產型號
      l_iface_rec.fixed_assets_units :=   l_source_asset_rec.current_units; --資產數量
      l_iface_rec.asset_type         :=   l_source_asset_rec.asset_type;
      l_iface_rec.in_use_flag        :=   l_source_asset_rec.in_use_flag;
      l_iface_rec.inventorial        :=   l_source_asset_rec.inventorial;
      l_iface_rec.owned_leased       :=   l_source_asset_rec.owned_leased;
      l_iface_rec.new_used           :=   l_source_asset_rec.new_used;
      l_iface_rec.asset_key_ccid     :=   l_source_asset_rec.asset_key_ccid;
      l_iface_rec.location_id        := 6018; --資產地點
      l_iface_rec.assigned_to        := 37550; --資產領用人
      --=================根據org_id獲取
        --l_iface_rec.payables_code_combination_id :=   l_source_asset_rec.payables_code_combination_id;
      l_iface_rec.book_type_code :=   '1002_FA'; --帳簿
      --===================
      SELECT   paaf.default_code_comb_id
        INTO   l_iface_rec.expense_code_combination_id --費用帳戶
        FROM per_all_assignments_f   paaf
       WHERE paaf.primary_flag =   'Y'
         AND trunc(SYSDATE) BETWEEN   paaf.effective_start_date AND
               paaf.effective_end_date
         AND paaf.person_id =   37550;
      --啓用日期,成本,貶值標識
      SELECT fb.*
        INTO l_source_book_rec
        FROM fa_books fb
       WHERE fb.asset_id =   l_source_asset_rec.asset_id
         AND fb.book_type_code =   l_book_type_code --來源帳簿
         AND fb.date_ineffective IS   NULL;
      --YTD折舊,累計折舊
      SELECT nvl(deprn_reserve, 0),   nvl(ytd_deprn, 0)
        INTO l_iface_rec.deprn_reserve,   l_iface_rec.ytd_deprn
        FROM (SELECT b.deprn_reserve,   b.ytd_deprn
                FROM fa_deprn_summary   b
               WHERE b.asset_id =   l_source_asset_rec.asset_id
                 AND b.book_type_code =   l_book_type_code
               ORDER BY deprn_run_date   DESC)
       WHERE rownum = 1;
   
        l_iface_rec.date_placed_in_service       := l_source_book_rec.date_placed_in_service;
      l_iface_rec.fixed_assets_cost          := l_source_book_rec.cost;
      l_iface_rec.depreciate_flag            :=   l_source_book_rec.depreciate_flag;
      l_iface_rec.deprn_method_code          :=   l_source_book_rec.deprn_method_code;
      l_iface_rec.life_in_months             :=   l_source_book_rec.life_in_months;
        l_iface_rec.prorate_convention_code      := l_source_book_rec.prorate_convention_code;
      l_iface_rec.bonus_rule                 :=   l_source_book_rec.bonus_rule;
      l_iface_rec.allowed_deprn_limit        :=   l_source_book_rec.allowed_deprn_limit;
        l_iface_rec.allowed_deprn_limit_amount :=   l_source_book_rec.allowed_deprn_limit_amount;
      l_iface_rec.salvage_type               :=   l_source_book_rec.salvage_type;
      l_iface_rec.salvage_value              :=   l_source_book_rec.salvage_value;
      l_iface_rec.accounting_date            := SYSDATE;
      --who
      l_iface_rec.creation_date     := SYSDATE;
      l_iface_rec.created_by        := fnd_global.user_id;
      l_iface_rec.last_update_date  := SYSDATE;
      l_iface_rec.last_updated_by   := fnd_global.user_id;
      l_iface_rec.last_update_login :=   fnd_global.login_id;
   
      INSERT INTO fa_mass_additions   VALUES l_iface_rec;
   
    END;
   
數據插入到表fa_mass_additions,界面上點擊新增便可新增資產 陳範冬 2013/9/9 FA/資產成批新增
192 12.x.x OM 訂單頭合計信息 API oe_oe_totals_summary.order_totals(p_header_id   => p_order_header_id,
   
                                            p_subtotal  =>   l_subtotal,
   
                                            p_discount  =>   l_discount,
   
                                            p_charges   =>   l_charges,
   
                                            p_tax       => l_tax);
   
    可獲取subtotal,discount,charges,tax 趙楊 2013/12/20 OM/訂單頭/合計
193 12.x.x AP 付款建立會計科目 API AP_DRILLDOWN_PUB_PKG.PAYMENT_ONLINE_ACCOUNTING   PROCEDURE   payment_accounting_p(x_msg_data        OUT NOCOPY VARCHAR2
                                      ,x_return_status OUT NOCOPY VARCHAR2
                                      ,p_check_id      IN NUMBER)   IS
     
        l_accounting_mode VARCHAR2(1) :=   'P'; --D,F,P
        l_org_id          NUMBER;
        l_approval_status   VARCHAR2(30);
     
        l_errbuf           VARCHAR2(1000);
        l_retcode          VARCHAR2(10);
        l_calling_sequence VARCHAR2(100)   := 'CUX_AP_COMMON_PUB.ACCOUNT_FINNAL';
     
        l_msg_count NUMBER;
        l_msg_data  VARCHAR2(2000);
     
        l_return_status VARCHAR2(1);
     
        l_entity_id     NUMBER;
        l_je_batch_name   gl_je_batches.name%TYPE;
        l_je_name       gl_je_headers.name%TYPE;
     
      BEGIN
        x_return_status := '0';
     
        SELECT ac.org_id INTO l_org_id   FROM ap_checks_all ac WHERE ac.check_id = p_check_id;
     
        --set security access
          mo_global.set_policy_context(p_access_mode => 'S', p_org_id =>   l_org_id);
        IF fnd_global.USER_ID = -1   THEN
          --SYSADMIN, System   Administrator
            fnd_global.set_nls_context(p_nls_language => 'SIMPLIFIED   CHINESE');
        END IF;
        --call standard api to accouting   single invoice
        AP_DRILLDOWN_PUB_PKG.PAYMENT_ONLINE_ACCOUNTING(p_check_id         => p_check_id,
                                                         p_accounting_mode  =>   l_accounting_mode,
                                                         p_errbuf           =>   l_errbuf,
                                                         p_retcode          =>   l_retcode,
                                                         p_calling_sequence => l_calling_sequence);
     
        IF l_retcode = 0 THEN
          FND_MESSAGE.SET_NAME('XLA',   'XLA_ONLINE_ACCT_SUCCESS');
          x_msg_data :=   FND_MESSAGE.GET;
        ELSIF l_retcode = 1 THEN
          FND_MESSAGE.SET_NAME('XLA',   'XLA_ONLINE_ACCT_WARNING');
          x_msg_data :=   FND_MESSAGE.GET;
       
        ELSIF l_retcode = 2 THEN
          FND_MESSAGE.SET_NAME('XLA',   'XLA_ONLINE_ACCTG_ERROR');
          x_msg_data :=   FND_MESSAGE.GET;
        ELSE
          FND_MESSAGE.SET_NAME('SQLAP',   'AP_DEBUG');
          FND_MESSAGE.SET_TOKEN('ERROR',   l_errbuf);
            FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', l_calling_sequence);
          x_msg_data :=   FND_MESSAGE.GET;
        END IF;
     
        x_return_status := l_retcode;
          cux_conc_utl.out_msg(x_msg_data);
     
      EXCEPTION
        WHEN OTHERS THEN
            fnd_msg_pub.add_exc_msg(p_pkg_name       => g_pkg_name,
                                    p_procedure_name => 'payment_accounting_p',
                                    p_error_text     =>   substrb(SQLERRM, 1, 240));
          x_return_status := '2';
          x_msg_data      := SQLERRM;
       
      END payment_accounting_p;
會計模式:D,F,P->擬定、最終、最終過帳 李明 2013/12/28 AP、付款、建立會計科目
194 12.x.x XLA 子模塊會計科目傳GL API xla_transfer_pkg.gl_transfer_main   PROCEDURE   transfer_xla_to_gl(x_return_stauts  IN   OUT NOCOPY VARCHAR2
                                    ,x_msg_data       IN OUT NOCOPY   VARCHAR2
                                    ,p_application_id IN NUMBER
                                    ,p_entity_code    IN VARCHAR2
                                    ,p_entity_id      IN   NUMBER
                                    ,x_je_batch_name  IN OUT NOCOPY   VARCHAR2
                                    ,x_je_name        IN OUT NOCOPY   VARCHAR2) IS
        l_ledger_id NUMBER;
        l_entity_id NUMBER;
      BEGIN
        x_return_stauts := fnd_api.G_RET_STS_SUCCESS;
     
        SELECT xte.ledger_id
              ,xte.entity_id
        INTO   l_ledger_id
              ,l_entity_id
        FROM   xla.xla_transaction_entities xte
        WHERE  xte.application_id = p_application_id
               AND xte.entity_code =   p_entity_code
               AND xte.entity_id =   p_entity_id;
     
        IF fnd_global.USER_ID = -1   THEN
          --SYSADMIN, System   Administrator
            fnd_global.set_nls_context(p_nls_language => 'SIMPLIFIED   CHINESE');
            --fnd_global.APPS_INITIALIZE(user_id => 0, resp_id => 20420,   resp_appl_id => 1);
        END IF;
     
          xla_transfer_pkg.gl_transfer_main(p_application_id =>   p_application_id,
                                            p_transfer_mode  =>   'STANDALONE',
                                            p_ledger_id      =>   l_ledger_id,
                                            p_entity_id      =>   l_entity_id,
                                            p_caller         =>   xla_transfer_pkg.C_ACCTPROG_DOCUMENT
                                           
                                            --[hand.liming@20131112 10:59
                                            --,p_submit_gl_post => 'Y'
                                            --]
                                           
                                            );
     
        EXCEPTION
          WHEN OTHERS THEN
            NULL;
        END;
      END transfer_xla_to_gl;
注意參數p_caller         =>   xla_transfer_pkg.C_ACCTPROG_DOCUMENT 李明 2013/12/28 XLA,子模塊,傳送GL
195 12.x.x XLA 子模塊建立會計科目 API XLA_ACCOUNTING_PUB_PKG.accounting_program_document    PROCEDURE   call_standard_accounting(retcode       OUT NOCOPY VARCHAR2
                                          ,errbuf      OUT NOCOPY   VARCHAR2
                                          ,p_entity_id IN NUMBER) IS
        l_accounting_mode  VARCHAR2(1) := 'F'; --D,F,P
        ls_info              xla_events_pub_pkg.t_event_source_info;
        l_errbuf           VARCHAR2(2000);
        l_retcode          VARCHAR2(10);
        l_request_id       NUMBER;
        l_batch_id         NUMBER;
        l_calling_sequence VARCHAR2(100)   := 'CUX_AR_COMMON_PUB.ACCOUNT_FINNAL';
      BEGIN
          XLA_ACCOUNTING_PUB_PKG.accounting_program_document(p_event_source_info   => ls_info,
                                                             p_entity_id           =>   p_entity_id,
                                                             p_accounting_flag     =>   'Y',
                                                             p_accounting_mode     =>   l_accounting_mode,
                                                             p_transfer_flag       =>   'Y',
                                                             p_gl_posting_flag     =>   'Y',
                                                             p_offline_flag        =>   'N',
                                                             p_accounting_batch_id => l_batch_id,
                                                             p_errbuf              =>   errbuf,
                                                             p_retcode             =>   retcode,
                                                             p_request_id          => l_request_id);
     
        IF retcode = 0 THEN
          FND_MESSAGE.SET_NAME('XLA',   'XLA_ONLINE_ACCT_SUCCESS');
          errbuf :=   FND_MESSAGE.GET;
          COMMIT;
        ELSIF l_retcode = 1 THEN
          FND_MESSAGE.SET_NAME('XLA',   'XLA_ONLINE_ACCT_WARNING');
          errbuf :=   FND_MESSAGE.GET;
       
        ELSIF l_retcode = 2 THEN
          FND_MESSAGE.SET_NAME('XLA',   'XLA_ONLINE_ACCTG_ERROR');
          errbuf :=   FND_MESSAGE.GET;
        ELSE
          FND_MESSAGE.SET_NAME('SQLAP',   'AP_DEBUG');
          FND_MESSAGE.SET_TOKEN('ERROR',   errbuf);
          FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',   l_calling_sequence);
          errbuf :=   FND_MESSAGE.GET;
        END IF;
     
      END call_standard_accounting;
  李明 2013/12/28 XLA,會計科目
196 12.x.x FUN 建立公司間往來事務處理 API fun_trx_pub.CREATE_BATCH   fun_trx_pub.CREATE_BATCH(p_api_version      => 1.0,
                                       p_init_msg_list    =>   fnd_api.G_TRUE,
                                       p_commit           =>   fnd_api.G_FALSE,
                                       p_validation_level => fnd_api.G_VALID_LEVEL_FULL,
                                       p_debug            =>   'Y',
                                       x_return_status    =>   l_return_status,
                                       x_msg_count        =>   l_msg_count,
                                       x_msg_data         =>   l_msg_data,
                                       p_sent             =>   'N',
                                       p_calling_sequence =>   'CUX_FUN_TRX_INT_PUB.GENERATE_INTERCOMPANY_TRX_P',
                                       p_insert           =>   fnd_api.G_TRUE,
                                       p_batch_rec        =>   l_full_batch_rec,
                                       p_trx_tbl          =>   l_full_trx_tbl,
                                       p_init_dist_tbl    =>   l_init_dist_tbl,
                                       p_dist_lines_tbl   =>   l_dist_line_tbl);
  李明 2013/12/28 FUN,公司間事務處理
197 12.x.x INV 雜項事務處理API 接口 mtl_transactions_interface、inv_txn_manager_pub.process_transactions   TYPE t_misc_issue_rec IS RECORD(
         organization_id           NUMBER
        ,subinventory_code         VARCHAR2(30)
        ,inventory_item_id         NUMBER
        ,transaction_quantity      NUMBER
        ,distribution_account_ccid   NUMBER
        ,serial_number_from        VARCHAR2(30)
        ,serial_number_to          VARCHAR2(30)
        );
PROCEDURE   do_misc_issue(x_return_status  OUT   NOCOPY VARCHAR2
                               ,x_msg_count      OUT NOCOPY   NUMBER
                               ,x_msg_data       OUT NOCOPY   VARCHAR2
                               ,p_transaction_type_id IN NUMBER ----add  by elaine.mi@hand 2013/10/21
                               ,p_misc_issue_tab IN t_misc_issue_tab) IS
     
        l_api_name              VARCHAR2(30) :=   'do_misc_issue';
        l_transaction_header_id   NUMBER;
     
        l_mtl_trx_iface_rec   mtl_transactions_interface%ROWTYPE;
        l_mtl_sn_iface_rec  mtl_serial_numbers_interface%ROWTYPE;
     
        l_uom_code   mtl_system_items_b.primary_unit_of_measure%TYPE;
     
        l_retval    NUMBER;
        l_msg_count NUMBER;
        l_msg_data  VARCHAR2(2000);
        l_trx_count NUMBER;
      BEGIN
     
        --init out params
        x_return_status :=   fnd_api.g_ret_sts_success;
        x_msg_data      := NULL;
     
        l_transaction_header_id :=   mtl_material_transactions_s.nextval;
     
        FOR i IN 1 ..   p_misc_issue_tab.count LOOP
          l_mtl_trx_iface_rec                          := NULL;
            l_mtl_trx_iface_rec.transaction_interface_id :=   mtl_material_transactions_s.nextval;
            l_mtl_trx_iface_rec.creation_date            := SYSDATE;
            l_mtl_trx_iface_rec.created_by               := g_user_id;
            l_mtl_trx_iface_rec.last_update_date         := SYSDATE;
            l_mtl_trx_iface_rec.last_updated_by          := g_user_id;
            l_mtl_trx_iface_rec.last_update_login        := g_login_id;
       
            l_mtl_trx_iface_rec.transaction_header_id := l_transaction_header_id;
       
            l_mtl_trx_iface_rec.process_flag         := 1; --Yes
            l_mtl_trx_iface_rec.lock_flag            := 1;
            l_mtl_trx_iface_rec.transaction_mode     := 3; --Background
            l_mtl_trx_iface_rec.inventory_item_id    :=   p_misc_issue_tab(i).inventory_item_id;
            l_mtl_trx_iface_rec.transaction_date     := SYSDATE;
          IF p_transaction_type_id = 32   THEN
            l_mtl_trx_iface_rec.transaction_quantity := -abs(p_misc_issue_tab(i)
                                                             .transaction_quantity);
          ELSE
              l_mtl_trx_iface_rec.transaction_quantity   := abs(p_misc_issue_tab(i)
                                                             .transaction_quantity);
            END IF;
          SELECT   msi.primary_uom_code
          INTO   l_mtl_trx_iface_rec.transaction_uom
          FROM   mtl_system_items_b msi
          WHERE  msi.organization_id =   p_misc_issue_tab(i).organization_id
                 AND   msi.inventory_item_id = p_misc_issue_tab(i).inventory_item_id;
         --   l_mtl_trx_iface_rec.transaction_type_id       := 32;
            l_mtl_trx_iface_rec.transaction_type_id     := p_transaction_type_id;
            l_mtl_trx_iface_rec.organization_id         :=   p_misc_issue_tab(i).organization_id;
            l_mtl_trx_iface_rec.subinventory_code       := p_misc_issue_tab(i).subinventory_code;
            l_mtl_trx_iface_rec.source_code             := g_pkg_name;
            l_mtl_trx_iface_rec.source_header_id        := -1;
            l_mtl_trx_iface_rec.source_line_id          := -1;
          l_mtl_trx_iface_rec.distribution_account_id   := p_misc_issue_tab(i)
                                                           .distribution_account_ccid;
       
          INSERT INTO   mtl_transactions_interface VALUES l_mtl_trx_iface_rec;
       
          -- sn rec
          l_mtl_sn_iface_rec :=   NULL;
       
            l_mtl_sn_iface_rec.creation_date       := SYSDATE;
            l_mtl_sn_iface_rec.created_by          := g_user_id;
            l_mtl_sn_iface_rec.last_update_date    := SYSDATE;
            l_mtl_sn_iface_rec.last_updated_by     := g_user_id;
          l_mtl_sn_iface_rec.last_update_login   := g_login_id;
       
            l_mtl_sn_iface_rec.transaction_interface_id :=   l_mtl_trx_iface_rec.transaction_interface_id;
            l_mtl_sn_iface_rec.source_code              := g_pkg_name;
            l_mtl_sn_iface_rec.source_line_id           := -1;
            l_mtl_sn_iface_rec.fm_serial_number         := p_misc_issue_tab(i)
                                                           .serial_number_from;
            l_mtl_sn_iface_rec.to_serial_number         :=   p_misc_issue_tab(i).serial_number_to;
       
          INSERT INTO   mtl_serial_numbers_interface VALUES l_mtl_sn_iface_rec;
        END LOOP;
     
        l_retval :=   inv_txn_manager_pub.process_transactions(p_api_version      => 1.0,
                                                               p_init_msg_list    =>   fnd_api.g_true,
                                                               p_commit           =>   fnd_api.g_false,
                                                               p_validation_level => fnd_api.g_valid_level_full,
                                                               x_return_status    =>   x_return_status,
                                                               x_msg_count        =>   l_msg_count,
                                                               x_msg_data         =>   l_msg_data,
                                                               x_trans_count      =>   l_trx_count,
                                                               p_table            =>   1,
                                                               p_header_id        =>   l_transaction_header_id);
     
        IF l_retval = -1 THEN
          x_return_status :=   fnd_api.g_ret_sts_error;
          BEGIN
            SELECT   error_explanation
            INTO   x_msg_data
            FROM   mtl_transactions_interface
            WHERE  transaction_header_id =   l_transaction_header_id
                   AND rownum = 1;
          EXCEPTION
            WHEN OTHERS THEN
              x_msg_data := NULL;
          END;
          IF x_msg_data IS NULL   THEN
            x_msg_data :=   l_msg_data;
          END IF;
        END IF;
     
      EXCEPTION
        WHEN OTHERS THEN
          x_return_status :=   fnd_api.g_ret_sts_unexp_error;
          x_msg_data      := 'Unexpected exception:' ||   SQLERRM;
       
      END do_misc_issue;
 organization_id           NUMBER --庫存組織
        ,subinventory_code         VARCHAR2(30) --當前子庫存
        ,inventory_item_id         NUMBER --物料ID
        ,transaction_quantity      NUMBER --事務處理數量
        ,distribution_account_ccid NUMBER   --分配成本帳戶
        ,serial_number_from        VARCHAR2(30) --序列號從
        ,serial_number_to          VARCHAR2(30) --序列號至
李明 2013/12/28 inv,雜項事務處理
198 12.x.x PO 接收事務處理接口處理器調用 API por_rcv_ord_sv.call_txn_processor   PROCEDURE   call_txn_processor(p_group_id        NUMBER
                                    ,x_return_status OUT VARCHAR2
                                    ,x_msg_count     OUT   NUMBER
                                    ,x_msg_data      OUT VARCHAR2)   IS
        PRAGMA   AUTONOMOUS_TRANSACTION;
        l_return NUMBER;
        CURSOR c_data IS
          SELECT   ie.interface_transaction_id || '---' || column_name || '---' ||
                 error_message   error_message
          FROM   po_interface_errors ie
                  ,rcv_transactions_interface rti
          WHERE  ie.interface_transaction_id = rti.interface_transaction_id
                 AND rti.group_id =   p_group_id;
      BEGIN
        x_return_status :=   fnd_api.g_ret_sts_success;
        l_return        :=   por_rcv_ord_sv.call_txn_processor(p_group_id, '');
        IF nvl(l_return, 0) <> 0   THEN
          x_return_status :=   fnd_api.g_ret_sts_error;
          FOR c1 IN c_data LOOP
            x_msg_data := x_msg_data || '   ' || c1.error_message;
          END LOOP;
        END IF;
      EXCEPTION
        WHEN OTHERS THEN
          x_return_status :=   fnd_api.g_ret_sts_error;
          x_msg_data      := SQLERRM;
      END call_txn_processor;
  李明 2013/12/28 po,接收事務處理接口
199 12.x.x INV 建立‘檢驗’接收事務處理 API rcv_inspection_grp.Insert_Inspection   PROCEDURE   create_inspection(p_check_header_id      IN NUMBER
                                   ,p_rcv_transaction_id IN NUMBER
                                   ,p_quantity           IN   NUMBER
                                   ,x_group_id           IN OUT   NOCOPY NUMBER) IS
     
        x_return_status   VARCHAR2(1);
        x_msg_count     NUMBER;
        x_msg_data      VARCHAR(1000);
     
        l_group_id NUMBER;
     
        l_rcv_transaction_id    NUMBER;
        l_quality               NUMBER;
        l_uom                   VARCHAR2(30);
        l_inspection_code       VARCHAR2(30) := 'ACCEPT';
        l_quality_code          VARCHAR2(30) := NULL;
        l_transaction_date      DATE := SYSDATE;
        l_transaction_type      VARCHAR2(30) := 'ACCEPT';
        l_vendor_lot            VARCHAR2(30) := NULL;
        l_reason_id             NUMBER := NULL;
        l_comments              VARCHAR2(240) :=   p_check_header_id;
        l_parent_transaction_id   NUMBER;
      BEGIN
     
        IF x_group_id IS NULL THEN
          SELECT   rcv_interface_groups_s.nextval INTO l_group_id FROM dual;
          x_group_id := l_group_id;
        ELSE
          l_group_id := x_group_id;
        END IF;
     
        l_rcv_transaction_id :=   p_rcv_transaction_id;
        l_quality            := p_quantity;
     
        SELECT rt.unit_of_measure
        INTO   l_uom
        FROM   rcv_transactions rt
        WHERE  rt.transaction_id =   p_rcv_transaction_id;
     
          rcv_inspection_grp.Insert_Inspection(p_api_version       => '1.0',
                                               p_init_msg_list     =>   fnd_api.G_TRUE,
                                               p_commit            =>   fnd_api.G_FALSE,
                                               p_validation_level  =>   fnd_api.G_VALID_LEVEL_FULL,
                                               p_created_by        =>   fnd_global.USER_ID,
                                               p_last_updated_by   =>   fnd_global.USER_ID,
                                               p_last_update_login => fnd_global.LOGIN_ID,
                                               p_employee_id       =>   fnd_global.EMPLOYEE_ID,
                                               p_group_id          =>   l_group_id,
                                               p_transaction_id    =>   l_rcv_transaction_id,
                                               p_transaction_type  =>   l_transaction_type,
                                               p_processing_mode   =>   'BATCH', --ONLINE --IMMEDIATE --BATCH
                                               p_quantity          =>   l_quality,
                                               p_uom               =>   l_uom,
                                               p_quality_code      =>   l_quality_code,
                                               p_transaction_date  =>   l_transaction_date,
                                               p_comments          =>   l_comments,
                                               p_reason_id         =>   l_reason_id,
                                               p_qa_collection_id  =>   NULL,
                                               p_return_status     =>   x_return_status,
                                               p_msg_count         =>   x_msg_count,
                                               p_msg_data          =>   x_msg_data);
     
        --20131009 17:24   hand.liming
        UPDATE rcv_transactions_interface   rti
        SET    rti.attribute15 = p_check_header_id
        WHERE  rti.group_id = x_group_id
               AND   rti.parent_transaction_id = p_rcv_transaction_id;
     
      END create_inspection;
  李明 2013/12/28 INV,接收,事務處理,檢驗
200 12.x.x EAM 資產編號關聯儀表信息 API eam_meterassoc_pub.insert_assetmeterassoc   eam_meterassoc_pub.insert_assetmeterassoc(p_api_version             => 1.0,
                                                        p_init_msg_list           =>   fnd_api.G_TRUE,
                                                        p_commit                  =>   fnd_api.G_FALSE,
                                                        p_validation_level        =>   fnd_api.G_VALID_LEVEL_FULL,
                                                        x_return_status           =>   l_return_status0,
                                                        x_msg_count               =>   l_msg_count0,
                                                        x_msg_data                =>   l_msg_data0,
                                                        p_meter_id                =>   rec_meter.meter_id,
                                                        p_organization_id         =>   l_instance_rec.inv_organization_id,
                                                        p_asset_group_id          =>   l_instance_rec.inventory_item_id,
                                                        p_asset_number            =>   l_instance_rec.serial_number,
                                                        p_maintenance_object_type => 3,
                                                        p_maintenance_object_id   =>   p_to_instance_id,
                                                        p_primary_failure_flag    =>   rec_meter.primary_failure_flag,
                                                        p_start_date_active       =>   rec_meter.from_effective_date,
                                                        p_end_date_active         =>   rec_meter.to_effective_date);
  李明 2013/12/28 EAM,資產編號,儀表
201 12.x.x EAM 資產編號生成活動信息 API eam_item_activities_pub.insert_item_activities   eam_item_activities_pub.insert_item_activities(p_api_version               => 1.0,
                                                             p_init_msg_list               => fnd_api.G_TRUE,
                                                             p_commit                      => fnd_api.G_FALSE,
                                                             p_validation_level            => fnd_api.G_VALID_LEVEL_FULL,
                                                             x_return_status               => l_return_status0,
                                                             x_msg_count                   => l_msg_count0,
                                                             x_msg_data                    => l_msg_data0,
                                                             p_asset_activity_id           => rec_activity.asset_activity_id,
                                                             p_inventory_item_id           => l_instance_rec.inventory_item_id,
                                                             p_organization_id             => l_instance_rec.inv_organization_id,
                                                             p_owningdepartment_id         => l_instance_rec.owning_department_id,
                                                             p_maintenance_object_id     =>   p_to_instance_id,
                                                             p_start_date_active           => rec_activity.start_date_active,
                                                             p_end_date_active             => rec_activity.end_date_active,
                                                             p_priority_code               => rec_activity.priority_code,
                                                             p_activity_cause_code         => rec_activity.activity_cause_code,
                                                             p_activity_type_code          => rec_activity.activity_type_code,
                                                             p_shutdown_type_code          => rec_activity.shutdown_type_code,
                                                             p_maintenance_object_type     => 3,
                                                             p_tmpl_flag                   => rec_activity.tmpl_flag,
                                                             p_class_code                  => rec_activity.class_code,
                                                             p_activity_source_code      =>   rec_activity.activity_source_code,
                                                             p_serial_number               => l_instance_rec.serial_number,
                                                             p_tagging_required_flag       => rec_activity.tagging_required_flag,
                                                             p_last_service_start_date     => rec_activity.last_service_start_date,
                                                             p_last_service_end_date       => rec_activity.last_service_end_date,
                                                             p_prev_service_start_date     => rec_activity.prev_service_start_date,
                                                             p_prev_service_end_date     =>   rec_activity.prev_service_end_date,
                                                             p_last_scheduled_start_date =>   rec_activity.last_scheduled_start_date,
                                                             p_last_scheduled_end_date     => rec_activity.last_scheduled_end_date,
                                                             p_prev_scheduled_start_date =>   rec_activity.prev_scheduled_start_date,
                                                             p_prev_scheduled_end_date     => rec_activity.prev_scheduled_end_date,
                                                             p_wip_entity_id               => rec_activity.wip_entity_id,
                                                             p_source_tmpl_id              => rec_activity.source_tmpl_id,
                                                             p_pm_last_service_tbl         => l_pm_last_service_tbl);
  李明 2013/12/28 EAM,資產編號,活動
202 12.x.x EAM 預防性維護計劃建立 API eam_pmdef_pub.create_pm_def   eam_pmdef_pub.create_pm_def(p_api_version               => 1.0,
                                          p_init_msg_list             =>   fnd_api.G_TRUE,
                                          p_commit                      => fnd_api.G_FALSE,
                                          p_validation_level            => fnd_api.G_VALID_LEVEL_FULL,
                                          x_return_status               => l_return_status0,
                                          x_msg_count                   => l_msg_count0,
                                          x_msg_data                    => l_msg_data0,
                                          p_pm_schedule_rec             => l_pm_schedule_rec,
                                          p_pm_activities_tbl           => l_pm_activities_tbl,
                                          p_pm_day_interval_rules_tbl => l_pm_day_interval_rules_tbl,
                                          p_pm_runtime_rules_tbl        => l_pm_runtime_rules_tbl,
                                          p_pm_list_date_rules_tbl      => l_pm_list_date_rules_tbl,
                                          x_new_pm_schedule_id          => l_new_pm_schedule_id);
  李明 2013/12/28 EAM,資產編號,PM計劃
203 12.x.x EAM 更新資產編號 API eam_assetnumber_pub.Update_Asset_Number   eam_assetnumber_pub.Update_Asset_Number(p_api_version               => 1.0,
                                                          p_init_msg_list               => fnd_api.G_TRUE,
                                                          p_commit                      => fnd_api.G_FALSE,
                                                          p_validation_level            => fnd_api.G_VALID_LEVEL_FULL,
                                                          x_return_status               => x_return_status,
                                                          x_msg_count                   => x_msg_count,
                                                          x_msg_data                    => l_msg_data,
                                                          p_inventory_item_id           => rec_check_line.inventory_item_id,
                                                          p_serial_number               => l_serial_number,
                                                          p_instance_number             => l_instance_number,
                                                          P_INSTANCE_ID                 => l_instance_id,
                                                          p_current_status              => 3,
                                                          p_descriptive_text            => l_descriptive_text,
                                                          p_current_organization_id     => rec_check_header.organization_id,
                                                          p_wip_accounting_class_code =>   rec_main_attr_value.wip_accounting_class_code,
                                                          p_owning_department_id        => rec_main_attr_value.owning_department_id,
                                                          p_eam_location_id             => rec_main_attr_value.eam_location_id,
                                                          p_asset_criticality_code      => rec_main_attr_value.asset_criticality_code,
                                                          p_category_id                 => l_category_id, --rec_attr_value.c_attribute1,
                                                          -- p_instantiate_flag            => FALSE,
                                                          --p_active_start_date           => SYSDATE,
                                                          P_LOCATION_TYPE_CODE => 'HZ_LOCATIONS',
                                                          P_LOCATION_ID        =>   rec_main_attr_value.location_id,
                                                          --p_operational_log_flag      =>   'N',
                                                          P_ATTRIBUTE30 => rec_check_header.header_id || '.' ||
                                                                           rec_check_line.eam_check_line_id);
  李明 2013/12/28 EAM,資產編號,更新
204 12.x.x EAM 建立資產編號 API eam_assetnumber_pub.Insert_Asset_Number   eam_assetnumber_pub.Insert_Asset_Number(p_api_version       => 1.0,
                                                          p_init_msg_list     =>   fnd_api.G_TRUE,
                                                          p_commit            =>   fnd_api.G_FALSE,
                                                          p_validation_level  =>   fnd_api.G_VALID_LEVEL_FULL,
                                                          x_return_status     =>   x_return_status,
                                                          x_msg_count         =>   x_msg_count,
                                                          x_msg_data          =>   l_msg_data,
                                                          x_object_id         =>   l_instance_id,
                                                          p_inventory_item_id => rec_check_line.inventory_item_id,
                                                          p_serial_number     =>   l_serial_number,
                                                          p_instance_number   =>   l_instance_number,
                                                          --P_INSTANCE_ID                 => l_instance_id,
                                                          p_current_status              => 3,
                                                          p_descriptive_text            => l_descriptive_text,
                                                          p_current_organization_id     => rec_check_header.organization_id,
                                                          p_wip_accounting_class_code =>   rec_main_attr_value.wip_accounting_class_code,
                                                          p_owning_department_id        => rec_main_attr_value.owning_department_id,
                                                          p_eam_location_id             => rec_main_attr_value.eam_location_id,
                                                          p_asset_criticality_code      => rec_main_attr_value.asset_criticality_code,
                                                          p_category_id                 => l_category_id, --rec_attr_value.c_attribute1,
                                                          -- p_instantiate_flag            => FALSE,
                                                          --p_active_start_date           => SYSDATE,
                                                          --P_LOCATION_TYPE_CODE => 'HZ_LOCATIONS',
                                                          --P_LOCATION_ID        =>   rec_main_attr_value.location_id,
                                                          --p_operational_log_flag      =>   'N',
                                                          P_ATTRIBUTE30 => rec_check_header.header_id || '.' ||
                                                                           rec_check_line.eam_check_line_id);
插入地點信息參數P_LOCATION_TYPE_CODE和P_LOCATION_ID無做用,估計是API的BUG 李明 2013/12/28 EAM,資產編號,新建
205 12.x.x EAM 建立資產屬性 API eam_assetattr_value_pub.insert_assetattr_value   eam_assetattr_value_pub.insert_assetattr_value(p_api_version                => 1.0,
                                                                   p_init_msg_list                => fnd_api.G_TRUE,
                                                                   p_commit                       => fnd_api.G_FALSE,
                                                                   p_validation_level             => fnd_api.G_VALID_LEVEL_FULL,
                                                                   x_return_status                => x_return_status,
                                                                   x_msg_count                    => x_msg_count,
                                                                   x_msg_data                     => x_msg_data,
                                                                   p_association_id               => rec_attr_group.association_id,
                                                                   p_application_id               => rec_attr_group.application_id,
                                                                   p_descriptive_flexfield_name =>   rec_attr_group.descriptive_flexfield_name,
                                                                   p_inventory_item_id            => rec_attr_group.inventory_item_id,
                                                                   p_serial_number                => l_serial_number,
                                                                   p_organization_id            =>   rec_check_header.organization_id,
                                                                   p_attribute_category           => rec_attr_group.descriptive_flex_context_code,
                                                                   p_c_attribute1                 => rec_attr_value.c_attribute1,
                                                                   p_c_attribute2                 => rec_attr_value.c_attribute2,
                                                                   p_c_attribute3                 => rec_attr_value.c_attribute3,
                                                                   p_c_attribute4                 => rec_attr_value.c_attribute4,
                                                                   p_c_attribute5                 => rec_attr_value.c_attribute5,
                                                                   p_c_attribute6                 => rec_attr_value.c_attribute6,
                                                                   p_c_attribute7                 => rec_attr_value.c_attribute7,
                                                                   p_c_attribute8                 => rec_attr_value.c_attribute8,
                                                                   p_c_attribute9                 => rec_attr_value.c_attribute9,
                                                                   p_c_attribute10                => rec_attr_value.c_attribute10,
                                                                   p_c_attribute11                => rec_attr_value.c_attribute11,
                                                                   p_c_attribute12                => rec_attr_value.c_attribute12,
                                                                   p_c_attribute13                => rec_attr_value.c_attribute13,
                                                                   p_c_attribute14                => rec_attr_value.c_attribute14,
                                                                   p_c_attribute15                => rec_attr_value.c_attribute15,
                                                                   p_c_attribute16                => rec_attr_value.c_attribute16,
                                                                   p_c_attribute17                => rec_attr_value.c_attribute17,
                                                                   p_c_attribute18                => rec_attr_value.c_attribute18,
                                                                   p_c_attribute19                => rec_attr_value.c_attribute19,
                                                                   p_c_attribute20                => rec_attr_value.c_attribute20,
                                                                   p_d_attribute1                 => rec_attr_value.d_attribute1,
                                                                   p_d_attribute2                 => rec_attr_value.d_attribute2,
                                                                   p_d_attribute3                 => rec_attr_value.d_attribute3,
                                                                   p_d_attribute4                 => rec_attr_value.d_attribute4,
                                                                   p_d_attribute5                 => rec_attr_value.d_attribute5,
                                                                   p_d_attribute6                 => rec_attr_value.d_attribute6,
                                                                   p_d_attribute7                 => rec_attr_value.d_attribute7,
                                                                   p_d_attribute8                 => rec_attr_value.d_attribute8,
                                                                   p_d_attribute9                 => rec_attr_value.d_attribute9,
                                                                   p_d_attribute10                => rec_attr_value.d_attribute10,
                                                                   p_n_attribute1                 => rec_attr_value.n_attribute1,
                                                                   p_n_attribute2                 => rec_attr_value.n_attribute2,
                                                                   p_n_attribute3                 => rec_attr_value.n_attribute3,
                                                                   p_n_attribute4                 => rec_attr_value.n_attribute4,
                                                                   p_n_attribute5                 => rec_attr_value.n_attribute5,
                                                                   p_n_attribute6                 => rec_attr_value.n_attribute6,
                                                                   p_n_attribute7                 => rec_attr_value.n_attribute7,
                                                                   p_n_attribute8                 => rec_attr_value.n_attribute8,
                                                                   p_n_attribute9                 => rec_attr_value.n_attribute9,
                                                                   p_n_attribute10                => rec_attr_value.n_attribute10,
                                                                   p_maintenance_object_type      => '3',
                                                                   p_maintenance_object_id        => l_instance_id,
                                                                   p_creation_organization_id     => rec_check_header.organization_id);
  李明 2013/12/28 EAM,屬性組
206 12.x.x PO API方式建立一攬子採購協議 API po_pdoi_grp.start_process   DECLARE
      g_line_end VARCHAR2(2) := chr(13)   || chr(10); --換行符
   
      p_process_pending VARCHAR2(1) :=   'N'; --是否處理暫掛記錄
      p_process_error   VARCHAR2(1) := 'N'; --是否處理錯誤記錄
      p_source          VARCHAR2(100); --限制來源
      p_source_id_from  VARCHAR2(240); --限制來源標識從
      p_source_id_to    VARCHAR2(240); --限制來源標識至
   
      l_po_header_id    NUMBER;
      l_return_status   VARCHAR2(1);
      l_return_msg      VARCHAR2(30000);
      l_item_id         NUMBER;
      l_organization_id NUMBER;
      l_org_id          NUMBER;
      l_agent_id        NUMBER;
      l_location_id     NUMBER;
      l_vendor_id       NUMBER;
      l_vendor_site_id  NUMBER;
      l_iface_rec       po.po_headers_interface%ROWTYPE;
      l_iface_lines_rec   po.po_lines_interface%ROWTYPE;
      l_msg_count       NUMBER;
      l_msg_data        VARCHAR2(2000);
      l_currency_code   VARCHAR2(15);
      l_error_flag      BOOLEAN := FALSE;
    BEGIN
   
        fnd_global.apps_initialize(user_id        => 23206,
                                   resp_id      => 53834,
                                   resp_appl_id => 201);
      mo_global.init('M');
   
      FOR rec IN (SELECT *
                    FROM   cux_2_po_blanket_headers t
                   WHERE   (t.process_status IS NULL OR
                           (p_process_pending = 'Y' AND t.process_status = 'P') OR
                         (p_process_error   = 'Y' AND
                         t.process_status   IN ('E', 'U')))
                     AND (p_source IS   NULL OR t.source = p_source)
                     AND   (p_source_id_from IS NULL OR
                         t.source_id   >= p_source_id_from)
                     AND (p_source_id_to   IS NULL OR
                         t.source_id   <= p_source_id_to)
                     FOR UPDATE NOWAIT)   LOOP
     
        l_return_status   := NULL;
        l_return_msg      := NULL;
        l_po_header_id    := NULL;
        l_org_id          := NULL;
        l_organization_id := NULL;
        l_vendor_id       := NULL;
        l_vendor_site_id  := NULL;
        l_iface_rec       := NULL;
        l_currency_code   := NULL;
        l_agent_id        := NULL;
     
        BEGIN
          SELECT hou.organization_id,   sob.currency_code
            INTO l_org_id,   l_currency_code
            FROM hr_operating_units hou,   gl_sets_of_books sob
           WHERE hou.name =   rec.org_name
             AND hou.set_of_books_id =   sob.set_of_books_id;
        EXCEPTION
          WHEN OTHERS THEN
            l_return_status := 'E';
            l_return_msg    := l_return_msg || 'Error when getting OU   id: ' ||
                               SQLERRM ||   g_line_end;
        END;
     
        IF l_org_id IS NOT NULL   THEN
          BEGIN
            SELECT fsp.inventory_organization_id
              INTO   l_organization_id
              FROM   financials_system_parameters fsp, hr_operating_units hou
             WHERE fsp.org_id =   hou.organization_id
               AND fsp.set_of_books_id =   hou.set_of_books_id
               AND hou.organization_id =   l_org_id;
          EXCEPTION
            WHEN OTHERS THEN
              l_return_status :=   'E';
              l_return_msg    := l_return_msg ||
                                 'Error   when getting organization id: ' ||
                                 SQLERRM   || g_line_end;
          END;
        END IF;
     
        BEGIN
          SELECT pv.vendor_id
            INTO l_vendor_id
            FROM po_vendors pv
           WHERE pv.vendor_name =   rec.vendor_name;
        EXCEPTION
          WHEN OTHERS THEN
            l_return_status := 'E';
            l_return_msg    := l_return_msg || 'Error when getting   vendor id: ' ||
                               SQLERRM ||   g_line_end;
        END;
     
        IF l_vendor_id IS NOT NULL AND   l_org_id IS NOT NULL THEN
          BEGIN
            SELECT   pvs.vendor_site_id
              INTO l_vendor_site_id
              FROM po_vendor_sites_all   pvs
             WHERE pvs.vendor_id =   l_vendor_id
               AND pvs.org_id =   l_org_id
               AND pvs.vendor_site_code =   rec.vendor_site_code;
          EXCEPTION
            WHEN OTHERS THEN
              l_return_status :=   'E';
              l_return_msg    := l_return_msg ||
                                 'Error   when getting vendor site: ' || SQLERRM ||
                                   g_line_end;
          END;
        END IF;
     
        BEGIN
          SELECT atv.term_id
            INTO   l_iface_rec.terms_id
            FROM ap_terms_vl atv
           WHERE atv.name =   nvl(rec.payment_term, 'B00_當即付款')
             AND atv.enabled_flag =   'Y'
             AND SYSDATE BETWEEN   nvl(atv.start_date_active, SYSDATE) AND
                 nvl(atv.end_date_active,   SYSDATE);
        EXCEPTION
          WHEN OTHERS THEN
            l_return_status := 'E';
            l_return_msg    := l_return_msg ||
                               'Error   when getting payment term: ' || SQLERRM ||
                                 g_line_end;
        END;
     
        BEGIN
          SELECT pap.person_id
            INTO l_agent_id
            FROM per_all_people_f   pap
           WHERE pap.full_name =   rec.agent_name
             AND SYSDATE BETWEEN   nvl(pap.effective_start_date, SYSDATE) AND
                   nvl(pap.effective_end_date, SYSDATE);
        EXCEPTION
          WHEN OTHERS THEN
            l_return_status := 'E';
            l_return_msg    := l_return_msg || 'Error when getting   agent: ' ||
                               SQLERRM ||   g_line_end;
        END;
     
        l_iface_rec.interface_header_id   := po_headers_interface_s.nextval;
        l_iface_rec.org_id              := l_org_id;
        l_iface_rec.document_num        := rec.po_number;
        l_iface_rec.process_code        := 'PENDING';
        l_iface_rec.action              := 'ORIGINAL';
          l_iface_rec.document_type_code    := 'BLANKET';
        l_iface_rec.currency_code       := l_currency_code;
        l_iface_rec.approval_status     := 'APPROVED';
        l_iface_rec.agent_id            := l_agent_id;
        l_iface_rec.vendor_id           := l_vendor_id;
        l_iface_rec.vendor_site_id      := l_vendor_site_id;
          --l_iface_rec.ship_to_location_id     := l_location_id;
        --l_iface_rec.bill_to_location_id   := l_location_id;
        l_iface_rec.interface_source_code   := '期初導入';
        l_iface_rec.batch_id              :=   l_iface_rec.interface_header_id;
          l_iface_rec.attribute_category      := 'BLANKET';
     
        IF   upper(rec.global_agreement_flag) IN ('是', 'YES', 'Y') THEN
            l_iface_rec.global_agreement_flag := 'Y';
        ELSIF upper(rec.global_agreement_flag)   IN ('否', 'NO', 'N') THEN
            l_iface_rec.global_agreement_flag := 'N';
        ELSE
          l_return_status := 'E';
          l_return_msg    := l_return_msg ||
                             'Global   agreement flag must be entered and must be valid.' ||
                               g_line_end;
        END IF;
     
        l_iface_rec.attribute2 :=   rec.attribute2;
        l_iface_rec.attribute5 :=   rec.attribute5;
        l_iface_rec.attribute6 :=   rec.attribute6;
     
        IF rec.attribute6 IS NULL AND   rec.attribute5 IS NULL THEN
          l_return_status := 'E';
          l_return_msg    := l_return_msg ||
                             'Contract   number and inquiry report number can not all be null.' ||
                               g_line_end;
        END IF;
     
        IF l_return_status IS NULL   THEN
          INSERT INTO   po.po_headers_interface VALUES l_iface_rec;
        END IF;
     
        FOR rec_line IN (SELECT rownum,   l.*
                           FROM   cux_2_po_blanket_lines l
                          WHERE l.org_name   = rec.org_name
                            AND   l.po_number = rec.po_number) LOOP
          l_iface_lines_rec :=   NULL;
          l_item_id         := NULL;
       
          IF l_organization_id IS NOT   NULL THEN
            BEGIN
              SELECT   msi.inventory_item_id
                INTO l_item_id
                FROM mtl_system_items_b msi
               WHERE msi.organization_id   = l_organization_id
                 AND msi.segment1 =   rec_line.item_number;
            EXCEPTION
              WHEN OTHERS THEN
                l_return_status :=   'E';
                l_return_msg    := l_return_msg || 'Error when getting   item(' ||
                                     rec_line.item_number || ') id: ' || SQLERRM ||
                                     g_line_end;
            END;
          END IF;
       
            l_iface_lines_rec.interface_line_id     := po_lines_interface_s.nextval;
            l_iface_lines_rec.interface_header_id :=   l_iface_rec.interface_header_id;
            --l_iface_lines_rec.process_code         := 'PENDING';
          l_iface_lines_rec.action                  := 'ADD';
          l_iface_lines_rec.line_num                := rec_line.rownum;
          l_iface_lines_rec.item_id                 := l_item_id;
            l_iface_lines_rec.line_type_id            := 1;
            l_iface_lines_rec.unit_of_measure         :=   rec_line.unit_meas_lookup_code;
            l_iface_lines_rec.unit_price              := rec_line.unit_price;
            l_iface_lines_rec.line_loc_populated_flag := 'Y';
            l_iface_lines_rec.ship_to_organization_id := l_organization_id;
            --l_iface_rec.ship_to_location_id           := l_location_id;
            --l_iface_lines_rec.need_by_date            := SYSDATE;
            --l_iface_lines_rec.promised_date           := SYSDATE;
            --l_iface_lines_rec.creation_date           := SYSDATE;
            l_iface_lines_rec.line_attribute_category_lines := 'BLANKET';
       
          IF rec_line.vendor_product_num   IS NOT NULL THEN
              l_iface_lines_rec.vendor_product_num :=   rec_line.vendor_product_num;
          ELSE
            l_return_status := 'E';
            l_return_msg    := l_return_msg ||
                               'Vendor   product number must be entered(Item: ' ||
                                 rec_line.item_number || ').' || g_line_end;
          END IF;
       
          IF rec_line.attribute1 IS NOT   NULL THEN
            l_iface_lines_rec.line_attribute1   := rec_line.attribute1;
          ELSE
            l_return_status := 'E';
            l_return_msg    := l_return_msg ||
                               'Order tax   price must be entered(Item: ' ||
                               rec_line.item_number   || ').' || g_line_end;
          END IF;
       
          IF rec_line.attribute6 IS NOT   NULL THEN
            BEGIN
              SELECT v.flex_value
                INTO   l_iface_lines_rec.line_attribute6
                FROM fnd_flex_values_vl   v, fnd_flex_value_sets s
               WHERE v.flex_value_set_id   = s.flex_value_set_id
                 AND   s.flex_value_set_name =
                       'CRC_B02_PO_LINES_MODES_OF_PACKING'
                 AND v.description =   rec_line.attribute6
                 AND v.enabled_flag =   'Y'
                 AND SYSDATE BETWEEN   nvl(v.start_date_active, SYSDATE) AND
                     nvl(v.end_date_active,   SYSDATE);
            EXCEPTION
              WHEN OTHERS THEN
                l_return_status := 'E';
                l_return_msg    := l_return_msg ||
                                   'Error   when getting mode of packing(' ||
                                     rec_line.attribute6 || '): ' || SQLERRM ||
                                     g_line_end;
            END;
          END IF;
       
          IF rec_line.attribute7 IS NOT   NULL THEN
            BEGIN
              SELECT v.flex_value
                INTO   l_iface_lines_rec.line_attribute7
                FROM fnd_flex_values_vl   v, fnd_flex_value_sets s
               WHERE v.flex_value_set_id   = s.flex_value_set_id
                 AND   s.flex_value_set_name =
                       'CRC_B02_PO_LINES_MODES_OF_SHIPPING'
                 AND v.description =   rec_line.attribute7
                 AND v.enabled_flag =   'Y'
                 AND SYSDATE BETWEEN   nvl(v.start_date_active, SYSDATE) AND
                       nvl(v.end_date_active, SYSDATE);
            EXCEPTION
              WHEN OTHERS THEN
                l_return_status :=   'E';
                l_return_msg    := l_return_msg ||
                                   'Error   when getting mode of shipping(' ||
                                     rec_line.attribute7 || '): ' || SQLERRM ||
                                     g_line_end;
            END;
          END IF;
       
          IF rec_line.attribute9 IS NOT   NULL THEN
            BEGIN
              SELECT   to_char(hl.location_id)
                INTO   l_iface_lines_rec.line_attribute9
                FROM hr_locations_all hl
               WHERE hl.location_code =   rec_line.attribute9
                 AND SYSDATE <=   nvl(hl.inactive_date, SYSDATE);
            EXCEPTION
              WHEN OTHERS THEN
                l_return_status :=   'E';
                l_return_msg    := l_return_msg ||
                                   'Error   when getting location(' ||
                                     rec_line.attribute9 || '): ' || SQLERRM ||
                                     g_line_end;
            END;
          ELSE
            BEGIN
              SELECT   to_char(pvs.ship_to_location_id)
                INTO   l_iface_lines_rec.line_attribute9
                FROM po_vendor_sites_all   pvs
               WHERE pvs.vendor_site_id =   l_vendor_site_id;
            EXCEPTION
              WHEN OTHERS THEN
                l_return_status :=   'E';
                l_return_msg    := l_return_msg ||
                                   'Error   when getting default location: ' ||
                                     SQLERRM || g_line_end;
            END;
          END IF;
       
          IF l_return_status IS NULL   THEN
            INSERT INTO   po_lines_interface VALUES l_iface_lines_rec;
          END IF;
       
        END LOOP;
     
        IF l_return_status IS NULL   THEN
       
          po_pdoi_grp.start_process(p_api_version                => 1.0,
                                      p_init_msg_list                => fnd_api.g_true,
                                      p_validation_level             => fnd_api.g_valid_level_full,
                                      p_commit                       => fnd_api.g_false,
                                      x_return_status                => l_return_status,
                                      p_gather_intf_tbl_stat         => fnd_api.g_false,
                                      p_calling_module               => po_pdoi_constants.g_call_mod_unknown,
                                      p_selected_batch_id            => l_iface_rec.batch_id,
                                      p_batch_size                   => po_pdoi_constants.g_def_batch_size,
                                      p_buyer_id                     => NULL,
                                      p_document_type                => 'BLANKET',
                                      p_document_subtype             => NULL,
                                      p_create_items                 => 'N',
                                      p_create_sourcing_rules_flag => NULL,
                                      p_rel_gen_method               => NULL,
                                      p_sourcing_level               => NULL,
                                      p_sourcing_inv_org_id          => NULL,
                                      p_approved_status              => 'APPROVED',
                                      p_process_code                 => 'PENDING',
                                      p_interface_header_id          => NULL,
                                      p_org_id                       => l_org_id,
                                      p_ga_flag                      => NULL);
       
          IF l_return_status = 'S'   THEN
            SELECT   MAX(poh.po_header_id)
              INTO l_po_header_id
              FROM po_headers_all poh,   po_headers_interface phi
             WHERE poh.po_header_id =   phi.po_header_id
               AND   phi.interface_header_id = l_iface_rec.interface_header_id;
         
            IF l_po_header_id IS NULL   THEN
              l_return_status :=   'E';
              FOR rec_msg IN (SELECT pie.error_message,   pie.interface_line_id
                                FROM   po_interface_errors pie
                               WHERE   pie.interface_header_id =
                                       l_iface_rec.interface_header_id) LOOP
                l_return_msg :=   l_return_msg || rec_msg.error_message ||
                                  g_line_end;
              END LOOP;
           
            END IF;
          ELSE
            FOR rec_msg IN (SELECT   pie.error_message, pie.interface_line_id
                              FROM po_interface_errors   pie
                             WHERE   pie.interface_header_id =
                                     l_iface_rec.interface_header_id) LOOP
           
              l_return_msg :=   l_return_msg || rec_msg.error_message ||
                                g_line_end;
           
            END LOOP;
          END IF;
       
        END IF;
     
        IF l_return_status != 'S'   THEN
          l_error_flag := TRUE;
        ELSE
          IF l_error_flag THEN
            l_return_status := 'P';
          END IF;
        END IF;
     
        UPDATE cux_2_po_blanket_headers   h
           SET h.process_status    = l_return_status,
               h.process_message   = substrb(l_return_msg, 1, 4000),
               h.last_updated_by   = fnd_global.user_id,
               h.last_update_date  = SYSDATE,
               h.last_update_login =   fnd_global.login_id
         WHERE h.org_name =   rec.org_name
           AND h.po_number = rec.po_number;
     
      END LOOP;
    END;
建議開發中使用API替代PO接口,能有效控制事務一致性 何雲 2013/12/31 PO/一攬子/建立
207 12.x.x PO API方式建立標準採購訂單 API po_docs_interface_sv5.process_po_headers_interface   DECLARE
      l_iface_rec       po_headers_interface%ROWTYPE;
      l_iface_lines_rec   po_lines_interface%ROWTYPE;
      l_iface_dis_rec   po_distributions_interface%ROWTYPE;
    BEGIN
   
      fnd_global.apps_initialize(user_id      => 1151,
                                   resp_id      => 50717,
                                   resp_appl_id => 201);
      mo_global.init('M');
   
      SELECT   po_headers_interface_s.nextval
        INTO l_iface_rec.interface_header_id
        FROM dual;
   
      l_iface_rec.org_id                := 81; --PO所屬OU
      l_iface_rec.process_code          := 'PENDING';
      l_iface_rec.action                := 'ORIGINAL';
      l_iface_rec.document_type_code    := 'STANDARD'; --PO類型
      l_iface_rec.approval_status       := 'APPROVED'; --審批狀態
      l_iface_rec.agent_id              := 61; --採購員
      l_iface_rec.vendor_id             := 2003; --供應商
      l_iface_rec.interface_source_code   := 'CUX:End Product Moving'; --接口來源標識
      l_iface_rec.created_by            := 1151; --Who字段
      l_iface_rec.creation_date         := SYSDATE; --Who字段
      l_iface_rec.last_update_date      := SYSDATE; --Who字段
      l_iface_rec.last_updated_by       := 1151; --Who字段
      l_iface_rec.last_update_login     := -1; --Who字段
   
      INSERT INTO po_headers_interface   VALUES l_iface_rec;
   
      SELECT   po_lines_interface_s.nextval
        INTO   l_iface_lines_rec.interface_line_id
        FROM dual;
   
        l_iface_lines_rec.interface_header_id    := l_iface_rec.interface_header_id;
      l_iface_lines_rec.process_code         := 'PENDING';
      l_iface_lines_rec.action               := 'ORIGINAL';
      l_iface_lines_rec.line_num             := '1'; --行號
      l_iface_lines_rec.shipment_num         := '1'; --發運號
      l_iface_lines_rec.item_id              := 1003; --物料
      l_iface_lines_rec.quantity             := 10; --數量
      l_iface_lines_rec.unit_price           := 100; --單價
      l_iface_lines_rec.promised_date        := SYSDATE + 1; --承諾日期
      l_iface_lines_rec.created_by           := 1151; --WHO字段
        l_iface_lines_rec.creation_date          := SYSDATE; --WHO字段
        l_iface_lines_rec.last_update_date       := SYSDATE; --WHO字段
        l_iface_lines_rec.last_updated_by        := 1151; --WHO字段
      l_iface_lines_rec.last_update_login    := -1; --WHO字段
        l_iface_lines_rec.receiving_routing_id := 3; --接收方式,3爲直接入庫
   
      INSERT INTO po_lines_interface   VALUES l_iface_lines_rec;
   
      SELECT   po_distributions_interface_s.nextval
        INTO   l_iface_dis_rec.interface_distribution_id
        FROM dual;
   
      l_iface_dis_rec.interface_header_id   := l_iface_rec.interface_header_id;
      l_iface_dis_rec.interface_line_id   :=   l_iface_lines_rec.interface_line_id;
        l_iface_dis_rec.distribution_num      := 1;
        l_iface_dis_rec.quantity_ordered      := 10;
      l_iface_dis_rec.created_by          := 1151;
      l_iface_dis_rec.creation_date       := SYSDATE;
        l_iface_dis_rec.last_update_date      := SYSDATE;
        l_iface_dis_rec.last_updated_by       := 1151;
        l_iface_dis_rec.last_update_login     := -1;
   
      INSERT INTO   po_distributions_interface VALUES l_iface_dis_rec;
   
        po_docs_interface_sv5.process_po_headers_interface(x_selected_batch_id          => NULL,
                                                           x_buyer_id                     => NULL,
                                                           x_document_type                => l_iface_rec.document_type_code,
                                                           x_document_subtype             => l_iface_rec.document_subtype,
                                                           x_create_items                 => 'N',
                                                           x_create_sourcing_rules_flag => NULL,
                                                           x_rel_gen_method               => NULL,
                                                           x_approved_status              => l_iface_rec.approval_status,
                                                           x_commit_interval            =>   1,
                                                           x_process_code                 => 'PENDING',
                                                           x_interface_header_id          => l_iface_rec.interface_header_id,
                                                           x_org_id_param                 => l_iface_rec.org_id,
                                                           x_ga_flag                      => NULL);
   
        dbms_output.put_line(l_iface_rec.interface_header_id);
   
      COMMIT;
    END;
建議開發中使用API替代PO接口,能有效控制事務一致性 何雲 2013/12/31 PO/標準採購訂單/建立
208 12.x.x INV 任務發退料 接口 INV.INCTCM   INSERT   INTO mtl_transactions_interface
      (source_code, --來源標識
       process_flag, -- 固定爲1
       last_updated_by, -- g_user_id
       last_update_login, --   g_login_id
       transaction_quantity, --數量
       subinventory_code, -- 子庫存
       transaction_type_id,   --發料固定爲35,退料固定爲43
       source_line_id, --來源行ID
       transaction_mode, -- 固定爲3 ,
       creation_date, -- SYSDATE ,
       inventory_item_id, -- 物料
       revision, -- 物料版本
       transaction_uom, --單位
       locator_id, -- 貨位
       transaction_source_type_id, --   固定爲5   /* 任務或計劃 */ ,
       wip_entity_type, -- 任務類型 ,
       source_header_id, --來源頭ID ,
       last_update_date, -- SYSDATE   ,
       created_by, -- g_user_id ,
       organization_id, -- 庫存組織
       transaction_date, -- 處理日期
       transaction_source_id, --   任務ID
       operation_seq_num, -- 工序序號
       transaction_interface_id, --   使用mtl_material_transactions_s.nextval
       transaction_reference, --參考
       attribute6, --彈性域字段
       attribute7,
       attribute8,
       attribute9,
       attribute_category)
    VALUES
      (v_source_code,
       1,
       g_user_id,
       g_login_id,
       -1 *   abs(wip_item_c.transaction_qty),
         wip_item_c.subinventory_code,
       35,
       wip_item_c.transaction_id,
       3,
       SYSDATE,
       wip_item_c.item_id,
       decode(v_revison_control, 2,   wip_item_c.item_revision, NULL),
       v_item_uom,
       wip_item_c.location_id,
       5 /* 任務或計劃 */,
       1,
       wip_item_c.transaction_id,
       SYSDATE,
       g_user_id,
       wip_item_c.organization_id,
       wip_item_c.transaction_date,
       wip_item_c.wip_entity_id,
         wip_item_c.operation_seq_num,
       v_transaction_ifa_id,
         wip_item_c.transaction_reference,
       wip_item_c.source_reference,
       wip_item_c.attribute7,
       wip_item_c.attribute8,
       wip_item_c.attribute9,
       'LMS信息');
插入標準物料事務接口表後提交接口請求 何雲 2013/12/31 任務/發料/退料
209 12.x.x WIP 任務工序移動 接口 WIP.WICTMS   DECLARE
      l_wip   wip_move_txn_interface%rowtype;
    BEGIN
      l_wip.creation_date :=   SYSDATE;
      l_wip.created_by := g_user_id;
      l_wip.last_update_date :=   SYSDATE;
      l_wip.last_update_login :=   g_login_id;
      l_wip.last_updated_by := g_user_id;
      l_wip.organization_id :=   rec_move.organization_id;--庫存組織ID
      l_wip.organization_code :=   g_organization_code;--庫存組織代碼
      l_wip.fm_intraoperation_step_type   := rec_move.fm_intraoperation_step_type;--步驟狀態從
      l_wip.fm_operation_seq_num :=   rec_move.fm_operation_seq_num;--工序序號從
      l_wip.to_intraoperation_step_type   := rec_move.to_intraoperation_step_type;--步驟狀態至
      l_wip.to_operation_seq_num :=   rec_move.to_operation_seq_num;--工序序號至
      l_wip.transaction_quantity :=   rec_move.transaction_quantity;--移動數量
      l_wip.process_phase := 1;--固定
      l_wip.process_status :=   1;--固定
      l_wip.transaction_type :=   1;--固定
      l_wip.transaction_date :=   rec_move.transaction_date;--處理日期
      l_wip.transaction_uom :=   rec_move.transaction_uom;--單位
      l_wip.wip_entity_id :=   rec_move.wip_entity_id;--WIP任務ID
      l_wip.reference :=   NULL;--參考,可選
      l_wip.source_code := rec_move.source_code;--來源標識
      l_wip.source_line_id :=   rec_move.transaction_id;--來源行ID
      INSERT INTO   wip.wip_move_txn_interface VALUES l_wip;
    END;
插入標準工序移動接口表後提交接口請求 何雲 2013/12/31 任務/工序/移動
210 12.x.x WSH 撤銷交貨號 API wsh_delivery_details_actions.unassign_detail_from_delivery p_detail_id--發運明細ID
    x_return_status--返回處理結果
    p_action_prms--wsh_delivery_details_grp.action_parameters_rec_type,此場景用不到
          wsh_delivery_details_actions.unassign_detail_from_delivery(p_detail_id     => l_delivery_detail_id,
                                                                         x_return_status => l_return_status,
                                                                         p_action_prms   =>   l_action_prms);
用於回收已分配交貨號但還沒有發運的發運明細,對應標準FORM的「撤銷交貨號」功能 何雲 2013/12/31 發運/交貨號/撤銷
211 12.x.x WSH 更新發運明細 API wsh_delivery_details_pub.update_shipping_attributes p_changed_attributes--wsh_delivery_details_pub.changedattributetabtype,存放要更新的發運明細信息
    p_source_code--固定爲OE
      /*此例爲更新發運明細的發運數量*/
          l_rec_tbl(1).delivery_detail_id   := l_delivery_detail_id;
          l_rec_tbl(1).shipped_quantity   := rec.quantity;
       
            wsh_delivery_details_pub.update_shipping_attributes(p_api_version_number   => '1.0',
                                                                p_init_msg_list      =>   fnd_api.g_false,
                                                                p_commit             =>   fnd_api.g_false,
                                                                x_return_status      =>   l_return_status,
                                                                x_msg_count          =>   l_msg_count,
                                                                x_msg_data           =>   l_msg_data,
                                                                p_changed_attributes => l_rec_tbl,
                                                                p_source_code        =>   'OE');
用於更新發運明細信息 何雲 2013/12/31 發運/更新明細
212 12.x.x FND 獲取併發並請求模板 API fnd_conc_templates.get_template_information fnd_conc_templates.get_template_information(:work_order.program_application_id,
                                                                  :work_order.application_short_name,
                                                                  :work_order.concurrent_program_name,
                                                                  :work_order.nls_language,
                                                                  :work_order.nls_territory,
                                                                  :world.current_nls_language,
                                                                  :world.current_nls_territory,
                                                                  l_template_obtained,
                                                                  l_template_name,
                                                                  l_template_language,
                                                                  l_format,
                                                                  l_request_language,
                                                                  l_iso_language,
                                                                  l_iso_territory,
                                                                  l_template_app_name,
                                                                  l_template_code,
                                                                  l_format_type);
   
    蘇聯章 2013/12/31 併發/模板
213 11.0.0 WIP 工序移動 接口 WIP.WICTMS 接口表:wip_move_txn_interface  v_request_id :=   fnd_request.submit_request('WIP',
                                                     'WICTMS',
                                                     NULL,
                                                     NULL,
                                                     FALSE,
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '',
                                                     '');
  徐衝 2013/12/31 工序移動
214 11.0.0 INV 導入物料 API ego_item_pub.process_items          ego_item_pub.process_items(p_api_version   => 1.0,
                                       p_init_msg_list => fnd_api.g_true,
                                       p_commit        =>   fnd_api.g_true,
                                       p_item_tbl      =>   l_item_tab,
                                       x_item_tbl      =>   l_out_item_tab,
                                       x_return_status => l_return_status,
                                       x_msg_count     => l_msg_count);
  徐衝 2013/12/31 物料導入/子組織
215 11.0.0 INV 建立保留 API inv_reservation_pub.create_reservation           inv_reservation_pub.create_reservation(p_api_version_number       => 1,
                                                   p_init_msg_lst             =>   'T',
                                                   p_rsv_rec                  =>   l_rsv_rec,
                                                   p_serial_number            =>   l_serial_number,
                                                   p_partial_reservation_flag => l_partial_reservation_flag,
                                                   p_force_reservation_flag   =>   l_force_reservation_flag,
                                                   p_partial_rsv_exists       =>   l_partial_reservation_exists,
                                                   p_validation_flag          =>   l_validation_flag,
                                                   x_serial_number            =>   x_serial_number,
                                                   x_return_status            =>   x_return_status,
                                                   x_msg_count                =>   x_msg_count,
                                                   x_msg_data                 =>   x_msg_data,
                                                   x_quantity_reserved        =>   x_quantity_reserved,
                                                   x_reservation_id           =>   x_reservation_id);
        
  徐衝 2013/12/31 建立保留
216 11.0.0 INV 查找保留 API inv_reservation_pub.query_reservation           inv_reservation_pub.query_reservation(p_api_version_number        => 1.0,
                                                  x_return_status               => l_return_status,
                                                  x_msg_count                   => x_msg_count,
                                                  x_msg_data                    => x_msg_data,
                                                  p_query_input                 => l_mtl_reservation_rec,
                                                  x_mtl_reservation_tbl         => l_mtl_reservation_tbl,
                                                  x_mtl_reservation_tbl_count => l_mtl_reservation_tbl_count,
                                                  x_error_code                  => l_error_code);
  徐衝 2013/12/31 查詢保留
217 11.0.0 INV 單位轉換 API inv_convert.inv_um_convert        l_umconvert_trans_quantity :=   inv_convert.inv_um_convert(item_id         => l_mmtt_rec.inventory_item_id,
                                                                         PRECISION     => NULL,
                                                                         from_quantity => p_transaction_quantity,
                                                                         from_unit     =>   l_mmtt_rec.transaction_uom,
                                                                         to_unit       =>   l_primary_uom,
                                                                         from_name     => NULL,
                                                                         to_name       => NULL);
  徐衝 2013/12/31 單位轉換
218 11.0.0 INV 更新保留 API inv_reservation_pub.update_reservation             inv_reservation_pub.update_reservation(p_api_version_number     => 1.0,
                                                     x_return_status          =>   l_return_status,
                                                     x_msg_count              =>   x_msg_count,
                                                     x_msg_data               =>   x_msg_data,
                                                     p_original_rsv_rec       =>   l_mtl_reservation_rec,
                                                     p_to_rsv_rec             =>   l_mtl_reservation_tbl(1),
                                                     p_original_serial_number => l_original_serial_number,
                                                     p_to_serial_number       =>   l_to_serial_number);
  徐衝 2013/12/31 更新保留
219 11.0.0 INV 刪除物料搬運單分配 API inv_mo_line_detail_util.delete_row        inv_mo_line_detail_util.delete_row(x_return_status  => l_return_status,
                                             p_line_id        =>   p_move_order_line_id,
                                             p_line_detail_id => p_transaction_temp_id);
  徐衝 2013/12/31 刪除MO行
220 12.1.3 XLA 建立事件 API xla_events_pub_pkg.create_event       羅建波 2014/1/2 XLA/事件/建立事件
221 12.1.3 XLA 生成分錄 API xla_accounting_pub_pkg.accounting_program_document       羅建波 2014/1/2 XLA/事件/生成分錄
222 12.1.3 XLA 刪除分錄 API xla_journal_entries_pkg.delete_journal_entries       羅建波 2014/1/2 XLA/事件/刪除分錄
223 12.1.3 GL 預算檢查 API xla_je_funds_checker_pkg.check_funds       羅建波 2014/1/2 GL/預算/預算檢查
224 12.1.3 GL 預算保留 API xla_je_funds_checker_pkg.reserve_funds       羅建波 2014/1/2 GL/預算/預算保留
225 12.1.3 FA 獲取資產折舊信息 API fa_query_balances_pkg.query_balances       羅建波 2014/1/2 FA
226 12.1.3 FA 資產報廢 API fa_retirement_pub.do_retirement       羅建波 2014/1/2 FA
227 12.1.3 FA 資產轉移 API fa_transfer_pub.do_transfer       羅建波 2014/1/2 FA
228 12.x.x PO 接受數量 API rcv_invoice_matching_sv.get_quantities       趙楊 2014/1/7 PO/接收/數量
229 12.1.3 AR 收款沖銷 API ar_receipt_api_pub.reverse    --初始化
        fnd_global.apps_initialize(user_id        => 1134,
                                   resp_id      => 50706,
                                   resp_appl_id => 222);
      mo_global.set_policy_context('S',   85);
     
     
      --p_reversal_category_code
      --select * from fnd_lookup_values where   lookup_type = 'REVERSAL_CATEGORY_TYPE'
     
      --p_reversal_reason_code
      --select * from fnd_lookup_values   where lookup_type = 'CKAJST_REASON'
   
      --沖銷
      ar_receipt_api_pub.reverse( --   Standard API parameters.
                                   p_api_version      =>   1.0,
                                   p_init_msg_list    =>   fnd_api.g_true,
                                   p_commit           =>   fnd_api.g_false,
                                   p_validation_level => fnd_api.g_valid_level_full,
                                   x_return_status    =>   l_return_status,
                                 x_msg_count        => l_msg_count,
                                   x_msg_data         =>   l_msg_data,
                                 --   Receipt reversal related parameters
                                   p_cash_receipt_id        =>   1000,
                                   p_receipt_number         =>   'TEST_20131231_01',
                                   p_reversal_category_code => 'REV',
                                   p_reversal_category_name => 'Reverse Payment',
                                   p_reversal_gl_date       =>   to_date('20131231',
                                                                       'YYYYMMDD'),
                                   p_reversal_date          =>   to_date('20131231',
                                                                       'YYYYMMDD'),
                                   p_reversal_reason_code   =>   'PAYMENT REVERSAL',
                                   p_reversal_reason_name   =>   'Payment Reversal',
                                   p_reversal_comments      =>   'API TEST api test',
                                   p_called_from            =>   NULL,
                                   --p_attribute_rec           IN   attribute_rec_type DEFAULT attribute_rec_const,
                                   --p_global_attribute_rec    IN   global_attribute_rec_type_upd DEFAULT global_attribute_rec_upd_cons
                                   --p_global_attribute_rec    IN   global_attribute_rec_type DEFAULT global_attribute_rec_const  ,
                                   p_cancel_claims_flag => 'Y',
                                 p_org_id             => 85);
   
      IF l_return_status <>   fnd_api.g_ret_sts_success THEN
        dbms_output.put_line('Error');
          dbms_output.put_line(fnd_msg_pub.count_msg);
        FOR i IN 1 ..   fnd_msg_pub.count_msg LOOP
          fnd_msg_pub.get(p_msg_index     => i,
                          p_encoded       => fnd_api.g_false,
                          p_data          => l_msg_data,
                          p_msg_index_out   => l_msg_index);
          lv_message := lv_message ||   l_msg_data;
        END LOOP;
          dbms_output.put_line(lv_message);
      ELSE
        dbms_output.put_line('Ok');
      END IF;
  蘇聯章 2014/1/16 AR/收款/沖銷
230 12.x.x BOM 判斷工做日 API bom_calendar_api_bk       趙楊 2014/1/16 工做日
231 12.x.x PJM 建立seiban API pjm_seiban_pub.create_seiban   pjm_seiban_pub.create_seiban(p_api_version    => 1.0,
   
                                               p_commit         => fnd_api.g_false,
   
                                               x_return_status  =>   return_status,
   
                                               x_msg_count      =>   msg_count,
   
                                               x_msg_data       => msg_data,
   
                                               p_seiban_number  =>   l_project_number,
   
                                               p_seiban_name    =>   l_project_name,
   
                                               p_operating_unit => fnd_profile.value('ORG_ID'),
   
                                               p_planning_group => '',
   
                                               p_dff            =>   dff,
   
                                               p_org_list       =>   orglisttbl,
   
                                               x_project_id     =>   p_project_id);
   
  趙楊 2014/2/24 PJM/SEIBAN
232 12.x.x PJM 更新計劃組 API pjm_project_param_pub.update_planning_group   pjm_project_param_pub.update_planning_group(p_api_version    => 1.0,
   
                                                              p_init_msg_list  =>   fnd_api.g_false,
   
                                                              p_commit         =>   fnd_api.g_false,
   
                                                              x_return_status  =>   return_status,
   
                                                              x_msg_count      =>   msg_count,
   
                                                              x_msg_data       =>   msg_data,
   
                                                              p_project_id     =>   p_project_id,
   
                                                              p_planning_group => l_planning_group);
   
  趙楊 2014/2/24 PJM/計劃組/更新
233 12.x.x FND 設置併發請求對用戶隱藏 API fnd_request.set_options   l_req_opts   := fnd_request.set_options(implicit => 'YES');   趙楊 2014/3/11 FND/併發/隱藏
234 12.x.x FND 建立用戶 API fnd_user_pkg.createuser   fnd_user_pkg.createuser   (
      x_user_name                 =>'test_user',
      x_owner                      =>'seed',
      x_unencrypted_password       =>'12345');
  蘇聯章 2014/8/8 FND/用戶/建立
235 12.x.x FND 更新用戶 API fnd_user_pkg.updateuser   fnd_user_pkg.UpdateUser   (   蘇聯章 2014/8/8 FND/用戶/更新
236 12.x.x FND 建立用戶party API fnd_user_pkg.createuserparty     x_user_name                 =>'test_user',   蘇聯章 2014/8/8 FND/用戶/建立PARTY
237 12.x.x FND 失效用戶 API fnd_user_pkg.disableuser     x_owner                      =>'seed', 失效時間爲sysdate 蘇聯章 2014/8/8 FND/用戶/失效用戶
238 12.x.x FND 失效/啓用用戶 API fnd_user_pkg.EnableUser     x_unencrypted_password       =>'12345'); start_date默認sysdate,end_date默認空 蘇聯章 2014/8/8 FND/用戶/失效用戶/啓用用戶
239 12.x.x FND 驗證用戶是否登陸 API fnd_user_pkg.validatelogin   fnd_user_pkg.validatelogin(username   =>'test_user',
                                 password   =>'12345');
返回boolean 蘇聯章 2014/8/8 FND/用戶/驗證用戶登陸
240 12.x.x FND 更改密碼 API fnd_user_pkg.changepassword   fnd_user_pkg.changepassword(username      =>'test_user',
                                  newpassword     =>'12345');
                                               
    fnd_user_pkg.changepassword(username        =>'test_user',
                                  oldpassword   =>'abcd'
                                  newpassword   =>'12345');
返回boolean 蘇聯章 2014/8/8 FND/用戶/更改密碼
241 12.x.x FND 驗證用戶是否存在 API fnd_user_pkg.userexists   fnd_user_pkg.userexists   (x_user_name =>'test_user') 返回boolean 蘇聯章 2014/8/8 FND/用戶/驗證存在
242 12.x.x HR 建立員工特殊信息 API hr_sit_api.create_sit   BEGIN              hr_sit_api.create_sit(p_validate                  => FALSE,               &
相關文章
相關標籤/搜索