Sie sind auf Seite 1von 10

step 1 ------R12----------for creating customer records in hz_parties & hz_cust_

accounts-----------------------DECLARE
p_cust_account_rec
p_organization_rec
p_customer_profile_rec
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
BEGIN

hz_cust_account_v2pub.cust_account_rec_type;
hz_party_v2pub.organization_rec_type;
hz_customer_profile_v2pub.customer_profile_rec_type;
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1318,50559,222);
p_cust_account_rec.account_name := 'Satya Tech';
-- p_cust_account_rec.account_number :='12345';
p_cust_account_rec.status := 'A';
p_cust_account_rec.created_by_module := 'HZ_CPUI';
--------------------mandatory field
p_customer_profile_rec.profile_class_id := 0;
p_customer_profile_rec.created_by_module := 'HZ_CPUI';
p_organization_rec.organization_name := 'sesh_org';
--------------------mandatory field
p_organization_rec.created_by_module := 'HZ_CPUI';
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;
/
COMMIT ;
***************************

Output information ....


x_cust_account_id: 13070
x_account_number: 3965
x_party_id: 50275
x_party_number: 31297
x_profile_id: 12071
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
SELECT * FROM hz_parties WHERE party_name LIKE 'cust_sw_api'
SELECT * FROM hz_cust_accounts WHERE TRUNC(creation_date)=TRUNC(SYSDATE)

STEP 2 --------------for creating customer locations in hz_locations----------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
fnd_global.apps_initialize (1318,50559,222);
p_location_rec.country := 'US';
p_location_rec.address1 := 'addr1_sw';
p_location_rec.city := 'Secunderabad';
p_location_rec.postal_code := '12345';
p_location_rec.county := 'kent';
p_location_rec.state := 'CA';
p_location_rec.created_by_module := 'HZ_CPUI';
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 ('p_location_rec.address1:'|| p_location_rec.address1)
;
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line

('x_location_id: ' || x_location_id);


('x_return_status: ' || x_return_status);
('x_msg_count: ' || x_msg_count);
('x_msg_data: ' || x_msg_data);
('***************************');

END;
/
***************************
Output information ....
p_location_rec.address1:addr1_sw
x_location_id: 18779
x_return_status: S
x_msg_count: 0
x_msg_data:

***************************
SELECT * FROM hz_locations where location_id=19881;
--------------------u cannot see the address location output in applications fro
ntend now, after creating site only u can see it-----------------------------------

step 3 --for creating customer records in hz_party_sites------------------------DECLARE


p_party_site_rec
x_party_site_id
x_party_site_number
x_return_status
x_msg_count
x_msg_data
BEGIN

hz_party_site_v2pub.party_site_rec_type;
NUMBER;
VARCHAR2 (2000);
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1318,50559,222);
p_party_site_rec.party_id := 402680;
p_party_site_rec.location_id := 26395;
-- p_party_site_rec.party_site_number:= 98989898;
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := 'HZ_CPUI';
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;
/
COMMIT ;
***************************
Output information ....
x_party_site_id: 29276
x_party_site_number: 17697
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
SELECT * FROM

hz_party_sites WHERE party_id=29276;

step 4 -----------for creating records in hz_cust_acct_sites_all---------------

---------------------DECLARE
p_cust_acct_site_rec
x_return_status
x_msg_count
x_msg_data
x_cust_acct_site_id
BEGIN

hz_cust_account_site_v2pub.cust_acct_site_rec_type;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);
NUMBER;

fnd_global.apps_initialize (1318,50559,222);
p_cust_acct_site_rec.cust_account_id := 117735;
p_cust_acct_site_rec.party_site_id := 222632;
-- p_cust_acct_site_rec.LANGUAGE := 'US';
p_cust_acct_site_rec.created_by_module := 'HZ_CPUI';
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;
/
COMMIT ;
***************************
Output information ....
x_cust_acct_site_id: 7697
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
SELECT * FROM hz_cust_acct_sites_all where cust_account_id=26309;
----------------------------------now u can see the address location output in a
pplications frontend-----------------------------------------step 5 ------------------for creating records in hz_cust_site_uses_all-----------------------------DECLARE
p_cust_site_use_rec
p_customer_profile_rec
xbillto_site_use_id
x_site_use_id
x_return_status
x_msg_count
x_msg_data
BEGIN

hz_cust_account_site_v2pub.cust_site_use_rec_type;
hz_customer_profile_v2pub.customer_profile_rec_type;
NUMBER;
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1318,50559,222);

p_cust_site_use_rec.cust_acct_site_id := 11275;
p_cust_site_use_rec.site_use_code := 'BILL_TO';
p_cust_site_use_rec.location:='same billto n shipto'; ----in place of number
we can specify location name ---optional
p_cust_site_use_rec.created_by_module := 'HZ_CPUI';
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 ('p_cust_site_use_rec.location for Bill_To: ' || p_cust_
site_use_rec.location);
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_data);
DBMS_OUTPUT.put_line ('***************************');
/* p_cust_site_use_rec.cust_acct_site_id := 8071;
p_cust_site_use_rec.site_use_code := 'SHIP_TO';
p_cust_site_use_rec.bill_to_site_use_id := x_site_use_id; --billto_site_use_i
d
p_cust_site_use_rec.created_by_module := 'RECEIVABLES';
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_data);
DBMS_OUTPUT.put_line ('***************************'); */
END;
/
COMMIT ;
***************************
Output information ....
p_cust_site_use_rec.location for Bill_To: same billto n shipto
x_site_use_id: 10027
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
***************************
Output information ....
x_site_use_id: 10028

x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
select * from hz_cust_site_uses_all where cust_acct_site_id=8030;
-----------------------------------------------------end of creating cust detail
s--------------------------------------------------------====================NOT NECESSARY========================================
Step 6 ------------------for creating contact in hz_parties at site-level----------------DECLARE
p_create_person_rec
x_party_id
x_party_number
x_profile_id
x_return_status
x_msg_count
x_msg_data
BEGIN

hz_party_v2pub.person_rec_type;
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1007939, 222, 20678);


p_create_person_rec.person_pre_name_adjunct := '';
p_create_person_rec.person_first_name := 's';
---'TESTING_PER'
p_create_person_rec.person_last_name := 'latha';
----'TESTING_LAST
'
p_create_person_rec.created_by_module := 'RECEIVABLES';
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;
/
COMMIT;
***************************
Output information ....
x_party_id: 67493
x_party_number: 32472
x_profile_id: 42781
x_return_status: S
x_msg_count: 0
x_msg_data:

***************************
SELECT * FROM hz_parties where party_id=67493;
-- In this back-end approach when u create a contact as above, u will get extra
record whose party_type is person in hz_parties table
where as if u do in front-end u will not get that record created in hz_parties t
able */
--------u cannot see the contacts now, it can be seen after creating cust_accoun
t_roles in applications frontend------------------------

step 7

-----------for creating contact at site-level--------------

DECLARE
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
BEGIN

hz_party_contact_v2pub.org_contact_rec_type;
NUMBER;
NUMBER;
NUMBER;
VARCHAR2 (2000);
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1007939, 222, 20678);


p_org_contact_rec.created_by_module := 'RECEIVABLES';
p_org_contact_rec.party_rel_rec.subject_id :=67493;
-------------------party_id of person
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 := 67492;
---------pa
rty_id of customer to which u want to assign the above person contact
p_org_contact_rec.party_site_id:=40419;
-------party_site_id of a site of customer for which u want to create contact poi
nts at site-level
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);
-----RE
LATIONSHIP_ID of person and organization i.e. PARTY_RELATIONSHIP_ID
DBMS_OUTPUT.put_line ('x_party_id: ' || x_party_id);
------party_id of the relationship
DBMS_OUTPUT.put_line ('x_party_number: ' || x_party_number);

DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
END;
/
COMMIT;

('x_return_status: ' || x_return_status);


('x_msg_count: ' || x_msg_count);
('x_msg_data: ' || x_msg_data);
('***************************');

***************************
Output information ....
x_org_contact_id: 18231
x_party_rel_id: 18479
x_party_id: 67494
x_party_number: 32473
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
SELECT * FROM hz_parties WHERE TRUNC(creation_date)=TRUNC(SYSDATE);
SELECT * FROM HZ_RELATIONSHIPS WHERE TRUNC(creation_date)=TRUNC(SYSDATE);
SELECT * FROM HZ_ORG_CONTACTS WHERE TRUNC(creation_date)=TRUNC(SYSDATE);

step 8 -------for creating contact at site-level, by giving the cust_acct_sit


e_id of the site of a customer for a role-----------------DECLARE
p_cr_cust_acc_role_rec
e;
x_cust_account_role_id
x_return_status
x_msg_count
x_msg_data
BEGIN

hz_cust_account_role_v2pub.cust_account_role_rec_typ
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1007939, 222, 20678);


-- 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 := 67494;
----------party_id of RELATIONSHIP
p_cr_cust_acc_role_rec.cust_account_id := 26309;
---------giving cust_account_id of customer for which u want to create role
p_cr_cust_acc_role_rec.cust_acct_site_id :=8030;
-------giving cust_acct_site_id of a site of customer for which u want to create conta
ct
------at site-level from HZ_CUST_ACCT_SITES_ALL table <<value for cust
_acct_site_id from step4>>
---p_cr_cust_acc_role_rec.primary_flag := 'Y';
---if 2 contact persons r there only one can be 'Y'
p_cr_cust_acc_role_rec.role_type := 'CONTACT';
p_cr_cust_acc_role_rec.created_by_module := 'RECEIVABLES';
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
);
('***************************');
('Output information ....');
('x_cust_account_role_id: ' || x_cust_account_role_id);
('x_return_status: ' || x_return_status);
('x_msg_count: ' || x_msg_count);
('x_msg_data: ' || x_msg_data);
('***************************');

DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
END;
/
COMMIT;
***************************
Output information ....
x_cust_account_role_id: 13344
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************

SELECT cust_account_role_id FROM HZ_cust_account_roles WHERE TRUNC(creation_dat


e)=TRUNC(SYSDATE);
----------------------------------now u can see the contacts output in applicati
ons frontend in party relation ship tab----------------------------------------step 9 ---------contact points for customer at site-level,record will be creat
ed in 'Contacts' tab of front-end--------------DECLARE
p_contact_point_rec
p_phone_rec
p_edi_rec_type
p_email_rec_type
p_telex_rec_type
p_web_rec_type
x_contact_point_id
x_return_status
x_msg_count
x_msg_data
BEGIN

hz_contact_point_v2pub.contact_point_rec_type;
hz_contact_point_v2pub.phone_rec_type;
hz_contact_point_v2pub.edi_rec_type;
hz_contact_point_v2pub.email_rec_type;
hz_contact_point_v2pub.telex_rec_type;
hz_contact_point_v2pub.web_rec_type;
NUMBER;
VARCHAR2 (2000);
NUMBER;
VARCHAR2 (2000);

fnd_global.apps_initialize (1007939, 222, 20678);


p_contact_point_rec.contact_point_type := 'PHONE';
p_contact_point_rec.owner_table_name := 'HZ_PARTIES';
p_contact_point_rec.owner_table_id :=67494;
-------party_id of REL
ATIONSHIP to which u want to create contact point at site-level-----p_contact_point_rec.created_by_module := 'RECEIVABLES';
p_phone_rec.phone_number := '1234567';
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,

DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
DBMS_OUTPUT.put_line
END;
/
COMMIT;

p_telex_rec_type,
p_web_rec_type,
x_contact_point_id,
x_return_status,
x_msg_count,
x_msg_data
);
('***************************');
('Output information ....');
('x_contact_point_id: ' || x_contact_point_id);
('x_return_status: ' || x_return_status);
('x_msg_count: ' || x_msg_count);
('x_msg_data: ' || x_msg_data);
('***************************');

***************************
Output information ....
x_contact_point_id: 28175
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
SELECT * FROM HZ_CONTACT_POINTS WHERE TRUNC(creation_date)=TRUNC(SYSDATE);
================================================================================
==========================================

Das könnte Ihnen auch gefallen