博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle EBS AP更新供应商地址
阅读量:5290 次
发布时间:2019-06-14

本文共 6085 字,大约阅读时间需要 20 分钟。

SELECT pvs.vendor_site_id,           pvs.party_site_id,           hps.party_site_name,           hps.object_version_number,           hps.party_site_number,           pvs.location_id,           hl.object_version_number,           hps.STATUS            FROM ap_supplier_sites_all pvs,           hz_party_sites        hps,           hz_locations          hl     WHERE pvs.vendor_site_code = '采购'--       AND pvs.org_id = 82 --       AND pvs.party_site_id = hps.party_site_id       AND pvs.location_id = hl.location_id       and rownum =1;--供应商地址失效DECLARE  l_return_status         VARCHAR2(1) := NULL;  l_msg_count             NUMBER;  l_errmsg                VARCHAR2(5000);  l_vendor_site_rec       ap_vendor_pub_pkg.r_vendor_site_rec_type;  l_party_site_rec         hz_party_site_v2pub.party_site_rec_type;  l_location_rec          hz_location_v2pub.location_rec_type;  l_object_version_number NUMBER;  l_object_version_number2 NUMBER;  l_vendor_site_id        NUMBER := NULL;  l_party_site_id         NUMBER := NULL;  l_party_site_name       VARCHAR2(240);  l_party_site_number     VARCHAR2(30);  l_location_id           NUMBER;BEGIN  fnd_global.apps_initialize(0, 50738, 20003);  BEGIN    SELECT pvs.vendor_site_id,           pvs.party_site_id,           hps.party_site_name,           hps.object_version_number,           hps.party_site_number,           pvs.location_id,           hl.object_version_number      INTO l_vendor_site_id,           l_party_site_id,           l_party_site_name,           l_object_version_number,           l_party_site_number,           l_location_id,           l_object_version_number2      FROM ap_supplier_sites_all pvs,           hz_party_sites        hps,           hz_locations          hl     WHERE pvs.vendor_site_code = '采购'--       AND pvs.org_id = 82 --       AND pvs.party_site_id = hps.party_site_id       AND pvs.location_id = hl.location_id       and rownum =1;  EXCEPTION    WHEN no_data_found THEN      l_errmsg := 'Can not find the vendor site need to update!The site code is:' || '采购';      dbms_output.put_line(l_errmsg);  END;  --  l_vendor_site_rec.vendor_site_id   := l_vendor_site_id;  l_vendor_site_rec.vendor_site_code := '采购';  l_vendor_site_rec.inactive_date    := SYSDATE;  --UPDATE vendor_site_code  ap_vendor_pub_pkg.update_vendor_site(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_errmsg,                                       p_vendor_site_rec  => l_vendor_site_rec,                                       p_vendor_site_id   => l_vendor_site_id);  IF (nvl(l_return_status, fnd_api.g_ret_sts_error) <> fnd_api.g_ret_sts_success) THEN    l_msg_count := fnd_msg_pub.count_msg;    IF l_msg_count > 0 THEN      l_errmsg := substr(fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false), 1, 512);          FOR i IN 1 .. (l_msg_count - 1) LOOP              l_errmsg := l_errmsg || chr(10) || substr(fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false), 1, 512);      END LOOP;      fnd_msg_pub.delete_msg();    END IF;    dbms_output.put_line('------------------Update Error-------------------');    dbms_output.put_line('Error1 :' || l_errmsg);  END IF;  --UPDATE party_site_name  l_party_site_rec.party_site_id   := l_party_site_id;  l_party_site_rec.party_site_name := l_party_site_name || 'disable';  l_party_site_rec.status          := 'I';  --  hz_party_site_v2pub.update_party_site(p_init_msg_list         => fnd_api.g_false,                                        p_party_site_rec        => l_party_site_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_errmsg);  IF (nvl(l_return_status, fnd_api.g_ret_sts_error) <> fnd_api.g_ret_sts_success) THEN    l_msg_count := fnd_msg_pub.count_msg;    IF l_msg_count > 0 THEN      l_errmsg := substr(fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false), 1, 512);          FOR i IN 1 .. (l_msg_count - 1) LOOP              l_errmsg := l_errmsg || chr(10) || substr(fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false), 1, 512);      END LOOP;      fnd_msg_pub.delete_msg();    END IF;    dbms_output.put_line('------------------Update Error-------------------');    dbms_output.put_line('Error2 :' || l_errmsg);  END IF;  --update location  l_location_rec.address_style := 'POSTAL_ADDR_DEF';  l_location_rec.location_id   := l_location_id;  hz_location_v2pub.update_location(p_init_msg_list         => fnd_api.g_true,                                    p_location_rec          => l_location_rec,                                    p_object_version_number => l_object_version_number2,                                    x_return_status         => l_return_status,                                    x_msg_count             => l_msg_count,                                    x_msg_data              => l_errmsg);  IF (nvl(l_return_status, fnd_api.g_ret_sts_error) <> fnd_api.g_ret_sts_success) THEN    l_msg_count := fnd_msg_pub.count_msg;    IF l_msg_count > 0 THEN      l_errmsg := substr(fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false), 1, 512);          FOR i IN 1 .. (l_msg_count - 1) LOOP              l_errmsg := l_errmsg || chr(10) || substr(fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false), 1, 512);      END LOOP;      fnd_msg_pub.delete_msg();    END IF;    dbms_output.put_line('------------------Update Error-------------------');    dbms_output.put_line('Error3 :' || l_errmsg);  END IF;  --  END;

 

转载于:https://www.cnblogs.com/jenrry/p/10006811.html

你可能感兴趣的文章
第三章上机实践报告
查看>>
INTERVAL YEAR TO MONTH数据类型
查看>>
Sprint总结
查看>>
LeetCode : Repeated Substring Pattern
查看>>
LeetCode : Ugly Number
查看>>
android学习笔记三
查看>>
常见算法之‘选择排序’
查看>>
Java学习笔记39(转换流)
查看>>
计算一个圆的直径面积周长
查看>>
XSS攻击及防御
查看>>
7.29 DFS总结
查看>>
c++操作io常见命令
查看>>
页面JS引用添加随机参数避免页面缓存
查看>>
java的基础知识文件操作和标识符
查看>>
Tika解析word文件
查看>>
变量作用域
查看>>
.NET程序集签名
查看>>
Python操作列表
查看>>
java reflect反射---Java高级开发必须懂的
查看>>
18.5 线程的优先级
查看>>