------------------------------------
1. Set Environment ------------------------------------ -- 1a. Setup the Org_id
------------------------------------ exec dbms_application_info.set_client_info('204'); ------------------------------------
-- 1b. Show the output variables
------------------------------------
set serveroutput on ------------------------------------
2. Create a party and an account ------------------------------------ DECLARE
p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE;
p_customer_profile_rec
HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
x_cust_account_id NUMBER;
x_account_number VARCHAR2(2000);
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_profile_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000); BEGIN
p_cust_account_rec.account_name := 'CUSEXAPIFIG02';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; p_organization_rec.organization_name := 'CUSEXAPIFIG02';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_rec,
p_customer_profile_rec,
'F',
x_cust_account_id,
x_account_number,
x_party_id,
x_party_number,
x_profile_id,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_cust_account_id: '||x_cust_account_id);
dbms_output.put_line('x_account_number: '||x_account_number);
dbms_output.put_line('x_party_id: '||x_party_id);
dbms_output.put_line('x_party_number: '||x_party_number);
dbms_output.put_line('x_profile_id: '||x_profile_id);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_cust_account_id: 6075
x_account_number: 3040
x_party_id: 17092
x_party_number: 14444
x_profile_id: 5290
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** /* BEGIN address */ ------------------------------------
3. Create a physical location ------------------------------------ DECLARE
p_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
x_location_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_location_rec.country := 'US';
p_location_rec.address1 := 'Address4';
p_location_rec.city := 'San Mateo';
p_location_rec.postal_code := '94401';
p_location_rec.state := 'CA';
p_location_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_location_v2pub.create_location(
'T',
p_location_rec,
x_location_id,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_location_id: '||x_location_id);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_location_id: 13326
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** ------------------------------------
4. Create a party site using party_id from step 2 and location_id from step 3 ------------------------------------ DECLARE
p_party_site_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE;
x_party_site_id NUMBER;
x_party_site_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_party_site_rec.party_id := 17092; --value for party_id from step 2>
p_party_site_rec.location_id := 13326; --value for location_id from step 3>
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_party_site_v2pub.create_party_site(
'T',
p_party_site_rec,
x_party_site_id,
x_party_site_number,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_party_site_id: '||x_party_site_id);
dbms_output.put_line('x_party_site_number: '||x_party_site_number);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_party_site_id: 8885
x_party_site_number: 6893
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** ------------------------------------
5. Create an account site using cust_account_id from step 2 and party_site_id from step 4. ------------------------------------ DECLARE
p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
x_cust_acct_site_id NUMBER;
BEGIN
p_cust_acct_site_rec.cust_account_id := 6075; --value for cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := 8885; --value for party_site_id from step 4>
p_cust_acct_site_rec.language := 'US';
p_cust_acct_site_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_site_v2pub.create_cust_acct_site(
'T',
p_cust_acct_site_rec,
x_cust_acct_site_id,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_cust_acct_site_id: '||x_cust_acct_site_id);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_cust_acct_site_id: 6155
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** ------------------------------------
6. Create an account site use using cust_acct_site_id from step 5 and site_use_code='BILL_TO' ------------------------------------ DECLARE
p_cust_site_use_rec HZ_CUST_ACCOUNT_SITE_V2PUB.CUST_SITE_USE_REC_TYPE;
p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
x_site_use_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_cust_site_use_rec.cust_acct_site_id := 6155; --value for cust_acct_site_id from step 5>
p_cust_site_use_rec.site_use_code := 'BILL_TO';
p_cust_site_use_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_site_v2pub.create_cust_site_use(
'T',
p_cust_site_use_rec,
p_customer_profile_rec,
'',
'',
x_site_use_id,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_site_use_id: '||x_site_use_id);
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_count);
dbms_output.put_line('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_site_use_id: 7149
x_return_status: S
x_msg_count: 0
x_msg_data: 0
*************************** /* END address */ commit; /* BEGIN contact to an organization */ ------------------------------------
7. Create a definition contact ------------------------------------ DECLARE
p_create_person_rec HZ_PARTY_V2PUB.person_rec_type;
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_profile_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000); BEGIN
p_create_person_rec.person_pre_name_adjunct := 'MR.';
p_create_person_rec.person_first_name := 'ExFennerct4';
p_create_person_rec.person_last_name := 'ExGiraldoct4';
p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_PARTY_V2PUB.create_person(
'T',
p_create_person_rec,
x_party_id,
x_party_number,
x_profile_id,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_party_id: '||x_party_id);
dbms_output.put_line('x_party_number: '||x_party_number);
dbms_output.put_line('x_profile_id: '||x_profile_id);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_party_id: 17093
x_party_number: 14445
x_profile_id: 17187
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** ------------------------------------
8. Create a relation cont-org using party_id from step 7 and party_id from step 2 ------------------------------------ DECLARE
p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE;
x_org_contact_id NUMBER;
x_party_rel_id NUMBER;
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_org_contact_rec.department_code := 'ACCOUNTING';
-- p_org_contact_rec.job_title := 'ACCOUNTS OFFICER';
-- p_org_contact_rec.decision_maker_flag := 'Y';
-- p_org_contact_rec.job_title_code := 'APC';
p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE';
p_org_contact_rec.party_rel_rec.subject_id := 17093; --value for party_id from step 7>
p_org_contact_rec.party_rel_rec.subject_type := 'PERSON';
p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.object_id := 17092; --Value for party_id from step 2>
p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION';
p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF';
p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT';
p_org_contact_rec.party_rel_rec.start_date := SYSDATE;
hz_party_contact_v2pub.create_org_contact(
'T',
p_org_contact_rec,
x_org_contact_id,
x_party_rel_id,
x_party_id,
x_party_number,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_org_contact_id: '||x_org_contact_id);
dbms_output.put_line('x_party_rel_id: '||x_party_rel_id);
dbms_output.put_line('x_party_id: '||x_party_id);
dbms_output.put_line('x_party_number: '||x_party_number);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_org_contact_id: 7110
x_party_rel_id: 7788
x_party_id: 17094
x_party_number: 14446
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** ------------------------------------
9. Create a contact using party_id you get 8 and cust_account_id from step 2 ------------------------------------ DECLARE
p_cr_cust_acc_role_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type;
x_cust_account_role_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000); BEGIN -- NOTE:
-- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE
-- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE p_cr_cust_acc_role_rec.party_id := 17094; --value for party_id from step 8>
p_cr_cust_acc_role_rec.cust_account_id := 6075; --value for cust_account_id from step 2>
p_cr_cust_acc_role_rec.primary_flag := 'Y';
p_cr_cust_acc_role_rec.role_type := 'CONTACT';
p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role(
'T',
p_cr_cust_acc_role_rec,
x_cust_account_role_id,
x_return_status,
x_msg_count,
x_msg_data); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_cust_account_role_id: '||x_cust_account_role_id);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_cust_account_role_id: 5857
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** /* END contact */ /* Create the contact ROLE for the Org Contact - (Contact Roles zone on Customers Form)*/ ------------------------------------
10. Create the org contact role using x_cust_account_role_id from step 9 ------------------------------------ DECLARE
p_role_responsibility_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.ROLE_RESPONSIBILITY_REC_TYPE;
x_responsibility_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000); BEGIN p_role_responsibility_rec.cust_account_role_id := 5857; --value for x_cust_account_role_id from step 9>
p_role_responsibility_rec.responsibility_type := 'SOLD_TO';
p_role_responsibility_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_CUST_ACCOUNT_ROLE_V2PUB.create_role_responsibility (
'T',
p_role_responsibility_rec,
x_responsibility_id,
x_return_status,
x_msg_count,
x_msg_data
); dbms_output.put_line('***************************');
dbms_output.put_line('Output information ....');
dbms_output.put_line('***************************');
dbms_output.put_line('x_responsibility_id: '||x_responsibility_id);
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('***************************'); IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF; END;
/ ***************************
Output information ....
***************************
x_responsibility_id: 3162
x_return_status: S
x_msg_count: 0
x_msg_data:
*************************** /* End contact ROLE */ commit;

  

Oracle EBS AR 客户API的更多相关文章

  1. Oracle EBS AR 其他API

    DECLARE L_CR_ID NUMBER; L_ATTRIBUTE_REC AR_RECEIPT_API_PUB.ATTRIBUTE_REC_TYPE; L_GLOBAL_ATT_REC AR_R ...

  2. Oracle EBS AR 收款API收款方法标识无效

    1.确认是不是没有收款方法 methods那个表的问题2.查看收款方法那个LOV的问题3.界面录入 是否会有问题  碰到的问题是 收款日期比较早时 找不到对应的收款方法 银行账户需要重新设置

  3. Oracle EBS AR 客户取数SQL

    SELECT acct.cust_account_id, acct.party_id, acct.account_number, party.party_name, lkp1.meaning part ...

  4. Oracle EBS R12 客户表结构

    参考链接: Oracle EBS R12 客户表结构 Oracle EBS中的“客户”."客户地点".‘订单’之间的关系 Oracle EBS中的“客户”."客户地点&q ...

  5. Oracle EBS AR 更新客户配置文件

    DECLARE l_rec_profile_t hz_customer_profile_v2pub.customer_profile_rec_type; l_rec_profile hz_custom ...

  6. Oracle EBS AR 事务处理到期余额总计API

    declare    -- Local variables here   i integer;   x_line_original NUMBER;   x_line_remaining NUMBER; ...

  7. Oracle EBS AR 更新客户组织层

    declare -- Local variables here i integer; g_module ) := 'TCA_V2_API'; lrec_org hz_party_v2pub.organ ...

  8. Oracle EBS AR 更新客户账户层

    declare x_return_status ); x_msg_count NUMBER; x_msg_data ); x_profile_id NUMBER; l_location_id NUMB ...

  9. Oracle EBS AR 更新客户

    DECLARE    l_return_status );    l_msg_count     NUMBER;    l_msg_data      );    l_rec_type      hz ...

随机推荐

  1. Python基础之好玩的字符串格式化之类C风格

    今天白月黑羽和大家说说字符串格式化,在python3中,字符串格式化主要有2种方法,今天先和大家介绍类C风格的printf. printf 风格 这种方式 和 传统的C语言printf函数使用一样的格 ...

  2. 31-hadoop-hbase-mapreduce操作hbase

    有一些大的文件,需要存入HBase中,其思想是先把文件传到HDFS上,利用map阶段读取<key,value>对,可在reduce把这些键值对上传到HBase中. HbaseMapper: ...

  3. Spring总结 2.装配bean

    本随笔内容要点如下: bean的作用域 占位符 一.bean的作用域 在默认情况下,Spring管理的bean的单例的.也就是说,无论注入多少次,都是同一个bean对象.一般情况下,单例模式是足以应付 ...

  4. JavaScript事件-this传递

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  5. Java 容器源码分析之Queue

    简介 Queue是一种很常见的数据结构类型,在java里面Queue是一个接口,它只是定义了一个基本的Queue应该有哪些功能规约.实际上有多个Queue的实现,有的是采用线性表实现,有的基于链表实现 ...

  6. 第一次项目上Linux服务器(七:——Tomcat+ngnix+域名的简单配置)

    1.准备工作 安装好jdk+tomcat+nginx相关配置,请参考历史博客 2.修改Nginx配置文件 修改配置文件如下: 3.修改Tomcat配置文件 修改配置文件如下: 配置文件连接: ngni ...

  7. 在Bootstrap框架中,form-control的效果

    在Bootstrap框架中,通过定制了一个类名`form-control`,也就是说,如果这几个元素使用了类名“form-control”,将会实现一些设计上的定制效果. 1.宽度变成了100% 2. ...

  8. ASP.NET MVC5+EF6+LayUI实战教程,通用后台管理系统框架(2)

    前言 本节先给大家搭建UI部分,让大家能看到点东西,就好像所有编程书里,开始都是一个Hello World一样 开始搭建 首先建立空白解决方案,我们命名为BYCMS 然后添加新项目BYCMS 我习惯用 ...

  9. 百度前端学院task33源码及总结——听指令的小方块

    任务描述 如图,实现一个类似棋盘的格子空间,每个格子用两个数字可以定位,一个红正方形的DOM在这个空间内,正方形中的蓝色边表示这是他的正面,有一个input输入框 在输入框中允许输入如下指令,按下按钮 ...

  10. HDU 3371 Connect the Cities(prim算法)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3371 Problem Description In 2100, since the sea leve ...