关闭

客户信息导入参考程序

标签: outputmoduletableemaildateweb
485人阅读 评论(0) 收藏 举报
分类:

--客户导入参考程序
------------------------------------
-- 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      := 'Fenner_01';
  P_CUST_ACCOUNT_REC.CREATED_BY_MODULE := 'TCAPI_EXAMPLE';

  P_ORGANIZATION_REC.ORGANIZATION_NAME := 'Fenner_01';
  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('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('***************************');

END;

/****************************
Output information ....
x_cust_account_id: 10033
x_account_number: 2441
x_party_id: 11337
x_party_number: 20413
x_profile_id: 3231
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('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('***************************');

END;

/****************************
Output information ....
x_location_id: 21581
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                 := 11337; --<<value for party_id from step 2>
  P_PARTY_SITE_REC.LOCATION_ID              := 21581; --<<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('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('***************************');

END;

/****************************
Output information ....
x_party_site_id: 5967
x_party_site_number: 4476
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   := 10033; --<<value for cust_account_id you get from step 2>
  P_CUST_ACCT_SITE_REC.PARTY_SITE_ID     := 5967; --<<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('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('***************************');

END;

/****************************
Output information ....
x_cust_acct_site_id: 4672
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 := 4672; --<<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('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('***************************');

END;

/* 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       := 'FENNERCTFN_01';
  P_CREATE_PERSON_REC.PERSON_LAST_NAME        := 'FENNERCTLN_01';
  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('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('***************************');

END;

/****************************
Output information ....
x_party_id: 11338
x_party_number: 20414
x_profile_id: 8323
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         := 11338; --<<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          := 11337; --<<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('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('***************************');

END;

/****************************
Output information ....
x_org_contact_id: 4566
x_party_rel_id: 5789
x_party_id: 11339
x_party_number: 20415
x_return_status: S
x_msg_count: 0
x_msg_data:
--***************************/

------------------------------------
-- 9. Create a contact using party_id you get in step 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          := 11339; --<<value for party_id from step 8>
  P_CR_CUST_ACC_ROLE_REC.CUST_ACCOUNT_ID   := 10033; --<<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('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('***************************');

END;

/****************************
Output information ....
x_cust_account_role_id: 4556
x_return_status: S
x_msg_count: 0
x_msg_data:
--***************************/

/* END contact */

COMMIT;

/* Begin phone */
------------------------------------------------------
-- 10. Create phon using party_id you get in atep 8
------------------------------------------------------
DECLARE
  P_CONTACT_POINT_REC HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
  P_PHONE_REC         HZ_CONTACT_POINT_V2PUB.PHONE_REC_TYPE;
  P_EDI_REC_TYPE      HZ_CONTACT_POINT_V2PUB.EDI_REC_TYPE;
  P_EMAIL_REC_TYPE    HZ_CONTACT_POINT_V2PUB.EMAIL_REC_TYPE;
  P_TELEX_REC_TYPE    HZ_CONTACT_POINT_V2PUB.TELEX_REC_TYPE;
  P_WEB_REC_TYPE      HZ_CONTACT_POINT_V2PUB.WEB_REC_TYPE;

  X_CONTACT_POINT_ID NUMBER;
  X_RETURN_STATUS    VARCHAR2(2000);
  X_MSG_COUNT        NUMBER;
  X_MSG_DATA         VARCHAR2(2000);

BEGIN

  P_CONTACT_POINT_REC.CONTACT_POINT_TYPE := 'PHONE';
  P_CONTACT_POINT_REC.OWNER_TABLE_NAME   := 'HZ_PARTIES';
  P_CONTACT_POINT_REC.OWNER_TABLE_ID     := 11339; --<value for party_id from step 8>
  P_CONTACT_POINT_REC.CREATED_BY_MODULE  := 'TCAPI_EXAMPLE';
  P_PHONE_REC.PHONE_NUMBER               := '407';
  P_PHONE_REC.PHONE_LINE_TYPE            := 'GEN';

  HZ_CONTACT_POINT_V2PUB.CREATE_CONTACT_POINT('T'
                                             ,P_CONTACT_POINT_REC
                                             ,P_EDI_REC_TYPE
                                             ,P_EMAIL_REC_TYPE
                                             ,P_PHONE_REC
                                             ,P_TELEX_REC_TYPE
                                             ,P_WEB_REC_TYPE
                                             ,X_CONTACT_POINT_ID
                                             ,X_RETURN_STATUS
                                             ,X_MSG_COUNT
                                             ,X_MSG_DATA);

  DBMS_OUTPUT.PUT_LINE('***************************');
  DBMS_OUTPUT.PUT_LINE('Output information ....');
  DBMS_OUTPUT.PUT_LINE('x_contact_point_id: ' || X_CONTACT_POINT_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('***************************');

END;

/****************************
Output information ....
x_contact_point_id: 8141
x_return_status: S
x_msg_count: 0
x_msg_data:
--***************************/

--commit;

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:124078次
    • 积分:1258
    • 等级:
    • 排名:千里之外
    • 原创:13篇
    • 转载:70篇
    • 译文:1篇
    • 评论:1条
    文章分类
    最新评论