码迷,mamicode.com
首页 > 数据库 > 详细

Oracle EBS AR 更新客户组织层

时间:2018-11-23 14:17:44      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:str   file   for   org   exp   put   output   hold   local   

declare 
  -- Local variables here
  i integer;
  g_module varchar2(30) := TCA_V2_API;
  lrec_org   hz_party_v2pub.organization_rec_type;
  lrec_party hz_party_v2pub.party_rec_type;
  l_return_status varchar2(1);
  l_msg_count number;
  l_msg_data varchar2(2000);
  l_party_id number;
  l_party_number hz_parties.party_number%type;
  l_profile_id number;
  v_error_msg varchar2(2000);
  v_version_number number; 
  cursor cur_DT is
    SELECT loc.location_id,
           loc.object_version_number,
           addr.PARTY_SITE_ID,
           hc.ACCOUNT_NUMBER,
           hc.CUST_ACCOUNT_ID,
           party_site.PARTY_SITE_NAME,
           hcp.CUST_ACCOUNT_PROFILE_ID,
           hcp.CREDIT_HOLD,
           hc.CREATION_DATE,
           hc.CREATED_BY,
           hc.ORIG_SYSTEM_REFERENCE,
           hc.PARTY_ID,
           hc.STATUS STATUS1,
           hz.STATUS STATUS2
      FROM hz_cust_acct_sites_all addr,
           hz_party_sites         party_site,
           hz_locations           loc,
           HZ_CUSTOMER_PROFILES   hcp,
           HZ_CUST_ACCOUNTS       hc,
           hz_parties hz
     WHERE 1 = 1
       AND addr.party_site_id = party_site.party_site_id
       AND loc.location_id = party_site.location_id
       and hc.PARTY_ID = party_site.PARTY_ID
       and hc.CUST_ACCOUNT_ID = hcp.CUST_ACCOUNT_ID
       and hz.PARTY_ID = party_site.PARTY_ID
               and hz.PARTY_NUMBER = 10984;
begin
  -- Test statements here
    fnd_global.apps_initialize(0, 50738, 20003);
  mo_global.init(AR);
  FOR rec IN CUR_DT LOOP
   begin
     select h.OBJECT_VERSION_NUMBER
     into v_version_number
     from hz_parties h
     where h.PARTY_ID = rec.PARTY_ID;
   end;
    lrec_party.party_id := rec.party_id;
    lrec_party.status := I;
    lrec_org.party_rec := lrec_party;
    hz_party_v2pub.update_organization(p_init_msg_list => fnd_api.G_TRUE
                                      ,p_organization_rec => lrec_org
                                      ,p_party_object_version_number => v_version_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);
   IF l_return_status = fnd_api.g_ret_sts_error THEN
      l_msg_count := fnd_msg_pub.count_msg;
      l_msg_data  := substr(fnd_msg_pub.get(fnd_msg_pub.g_first,
                                            fnd_api.g_false),
                            1,
                            512);
      dbms_output.put_line(l_msg_data);
      fnd_msg_pub.delete_msg();
      RAISE fnd_api.g_exc_error;
    ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
      l_msg_count := fnd_msg_pub.count_msg;
      l_msg_data  := substr(fnd_msg_pub.get(fnd_msg_pub.g_first,
                                            fnd_api.g_false),
                            1,
                            512);
      dbms_output.put_line(l_msg_data);
    
      fnd_msg_pub.delete_msg();
      RAISE fnd_api.g_exc_unexpected_error;
    END IF;
    IF l_return_status = fnd_api.g_ret_sts_success THEN
      dbms_output.put_line(------------------Update Success-------------------);
    
    END IF;
    end loop;                            
end;

 

Oracle EBS AR 更新客户组织层

标签:str   file   for   org   exp   put   output   hold   local   

原文地址:https://www.cnblogs.com/jenrry/p/10006831.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!