ORACLE EBS里怎么通过api创建ar事务处理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORACLE EBS里怎么通过api创建ar事务处理相关的知识,希望对你有一定的参考价值。

参考技术A 在R12中做过事务处理导入,是利用接口表Ra_Interface_Lines_All然后提交标准请求Autoinvoice Master Program
r11里导入贷项通知单真的很恶心啊 我用APIR12导入的好好的 到了11就不让搞了 一看api他自己限制了发票类型 不让导入dm的
参考技术B 在R12中做过事务处理导入,是利用接口表Ra_Interface_Lines_All然后提交标准请求Autoinvoice Master Program
r11里导入贷项通知单真的很恶心啊 我用APIR12导入的好好的 到了11就不让搞了 一看api他自己限制了发票类型 不让导入dm的
参考技术C 参考
Declare
l_batch_rec ra_batches%rowtype;
l_header_rec ra_customer_trx%rowtype;
l_customer_trx_id Number;
l_commitment_rec arp_process_commitment.commitment_rec_type;
l_lines_tbl ar_transaction_pub.Line_Tbl_Type;
l_tax_lines_tbl ar_transaction_pub.Line_Tbl_Type;
l_freight_lines_tbl ar_transaction_pub.Line_Tbl_Type;
l_salescredit_lines_tbl ar_transaction_pub.Salescredit_Tbl_Type;
l_dist_tbl ar_transaction_pub.Dist_Tbl_Type;
l_return_status varchar2(2000);
l_msg_count NUMBER;
l_msg_data varchar2(4000);
l_errors arp_trx_validate.Message_Tbl_Type;
i Number;
Begin

l_errors.delete;
fnd_global.apps_initialize(user_id => 1110,
resp_id => 50268,
resp_appl_id => 222); --1318, 50559, 222);
fnd_client_info.set_org_context(114);
--事务处理来源
l_batch_rec.BATCH_SOURCE_ID := 1002;
--AR事务处理题头
--事务处理编号
l_header_rec.TRX_NUMBER := 'CXP151026_001';
--来源ID
l_header_rec.BATCH_SOURCE_ID := l_batch_rec.batch_source_id;
--事务处理类型
l_header_rec.CUST_TRX_TYPE_ID := 1080;
--OU 标识
l_header_rec.ORG_ID := 114;
--事务处理日期
l_header_rec.TRX_DATE := sysdate;
/****收单方***/
--客户ID
l_header_rec.BILL_TO_CUSTOMER_ID := 1253;
--客户地点ID
l_header_rec.BILL_TO_SITE_USE_ID := 1210;
--联系人ID
l_header_rec.BILL_TO_CONTACT_ID := 6058;
/****付款客户***/
--客户ID
l_header_rec.PAYING_CUSTOMER_ID := l_header_rec.BILL_TO_CUSTOMER_ID;
--客户地点ID
l_header_rec.PAYING_SITE_USE_ID := l_header_rec.BILL_TO_SITE_USE_ID;
--采购方
l_header_rec.SOLD_TO_CUSTOMER_ID := l_header_rec.BILL_TO_CUSTOMER_ID;
--业务员或销售员ID
l_header_rec.PRIMARY_SALESREP_ID := 100000049;
---币种
l_header_rec.INVOICE_CURRENCY_CODE := 'CNY';
l_header_rec.SET_OF_BOOKS_ID := 1001;
--其它-状态
l_header_rec.STATUS_TRX := 'OP';
--其它-打印选项
l_header_rec.PRINTING_PENDING := 'Y';
--完成标志
l_header_rec.COMPLETE_FLAG := 'N';
--AR事务处理行项目
l_lines_tbl(1).ORG_ID := l_header_rec.ORG_ID;
l_lines_tbl(1).EXTENDED_AMOUNT := -300;
l_lines_tbl(1).REVENUE_AMOUNT := -300;
--行号
l_lines_tbl(1).LINE_NUMBER := 1;
l_lines_tbl(1).SET_OF_BOOKS_ID := l_header_rec.SET_OF_BOOKS_ID;
--行摘要
l_lines_tbl(1).DESCRIPTION := '测试行1';
l_lines_tbl(1).LINE_TYPE := 'LINE';
--自动税标识
l_lines_tbl(1).AUTOTAX := 'N';
--AR事务处理--分配行--应收帐款
--分类
l_dist_tbl(1).ACCOUNT_CLASS := 'REC';
l_dist_tbl(1).ACCOUNT_SET_FLAG := 'N';
--收入帐户标识ID
l_dist_tbl(1).ACCTD_AMOUNT := l_lines_tbl(1).EXTENDED_AMOUNT;
l_dist_tbl(1).AMOUNT := l_lines_tbl(1).EXTENDED_AMOUNT;
--应收帐款帐户标识ID
l_dist_tbl(1).CODE_COMBINATION_ID := 1494;
--GL日期
l_dist_tbl(1).GL_DATE := l_header_rec.TRX_DATE;
--OU标识ID
l_dist_tbl(1).ORG_ID := l_header_rec.ORG_ID;
--百分比
l_dist_tbl(1).PERCENT := 100;
--帐薄标识ID
l_dist_tbl(1).SET_OF_BOOKS_ID := l_header_rec.SET_OF_BOOKS_ID;
--AR事务处理--分配行--收入
--事务处理行
l_dist_tbl(2).line_index := 1;
--分类
l_dist_tbl(2).ACCOUNT_CLASS := 'REV';
l_dist_tbl(2).ACCOUNT_SET_FLAG := 'N';
--金额
l_dist_tbl(2).ACCTD_AMOUNT := l_lines_tbl(1).EXTENDED_AMOUNT;
l_dist_tbl(2).AMOUNT := l_lines_tbl(1).EXTENDED_AMOUNT;
--收入帐户标识ID
l_dist_tbl(2).CODE_COMBINATION_ID := 12814;
--GL日期
l_dist_tbl(2).GL_DATE := l_header_rec.TRX_DATE;
--OU标识ID
l_dist_tbl(2).ORG_ID := l_header_rec.ORG_ID;
--百分比
l_dist_tbl(2).PERCENT := 100;
--帐薄标识ID
l_dist_tbl(2).SET_OF_BOOKS_ID := l_header_rec.SET_OF_BOOKS_ID;

ar_transaction_pub.Create_Transaction(p_api_name => 'ARXTWMAI',
p_api_version => 1,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
p_validation_level => FND_API.G_VALID_LEVEL_FULL,
p_batch_rec => l_batch_rec,
p_header_rec => l_header_rec,
p_receivable_gl_date => l_header_rec.TRX_DATE,--必须要与TRX_DATE一致
p_commitment_rec => l_commitment_rec,
p_lines_tbl => l_lines_tbl,
p_tax_lines_tbl => l_tax_lines_tbl,
p_freight_lines_tbl => l_freight_lines_tbl,
p_salescredit_lines_tbl => l_salescredit_lines_tbl,
p_dist_tbl => l_dist_tbl,
p_return_status => l_return_status,
p_msg_count => l_msg_count,
p_msg_data => l_msg_data,
p_errors => l_errors,
p_customer_trx_id => l_customer_trx_id);

dbms_output.put_line('p_return_status=' || l_return_status);
dbms_output.put_line('l_msg_data=' || l_msg_data);
dbms_output.put_line('l_errors=' || l_errors.count);
For i In 1 .. l_errors.count Loop
dbms_output.put_line('customer_trx_id:' || l_errors(i)
.customer_trx_id);
dbms_output.put_line('message_name:' || l_errors(i).message_name);
dbms_output.put_line('token_name_1:' || l_errors(i).token_name_1);
dbms_output.put_line('token_1:' || l_errors(i).token_1);
dbms_output.put_line('token_name_2:' || l_errors(i).token_name_2);
dbms_output.put_line('token_2:' || l_errors(i).token_2);
dbms_output.put_line('encoded_message:' || l_errors(i)
.encoded_message);
dbms_output.put_line('translated_message:' || l_errors(i)
.translated_message);
End Loop;
dbms_output.put_line('p_customer_trx_id=' || l_customer_trx_id);
End;<span style="font-family:Arial, Helvetica, sans-serif;"><span style="white-space: normal;">
</span></span>

Oracle EBS AR 客户API

------------------------------------
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里怎么通过api创建ar事务处理的主要内容,如果未能解决你的问题,请参考以下文章

进入EBS AR 事务处理界面报错

Oracle EBS AR 更新客户组织层

转:Oracle EBS订单的流程(Order->AR)

Oracle EBS OPM 生产批创建事务处理

Oracle EBS AR 更新客户

Oracle EBS AR 更新客户账户层