Running The Create Group API
Name of the API: CREATE GROUP API
Base Tables Affected: HZ_PARTIES
PL/SQL Procedure used : CREATE_GROUP
Package Used: HZ_PARTY_V2PUB
Mandatory Parameters:
p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE
p_group_rec IN GROUP_REC_TYPE
x_party_id OUT NUMBER
x_party_number OUT VARCHAR2
x_return_status OUT VARCHAR2
x_msg_count OUT NUMBER
x_msg_data OUT VARCHAR2
PROCEDURE create_group (
p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE,
p_group_rec IN GROUP_REC_TYPE,
x_party_id OUT NUMBER,
x_party_number OUT VARCHAR2,
x_return_status OUT VARCHAR2,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2
)
General Tips for Running the Create Group API
a) Save the API in a script file and then run the script from the SQL Prompt (Example: RUN create_party_group.txt)
b) Enter the values for the Parameters from inside the script file itself unless it is required to enter some value from the SQL Prompt.
c) Set the organization id before running the script as: EXEC fnd_client_info.set_org_context ('<orgid>');
d) Ensure that the Profile Option HZ: Generate Party Number is set to ‘Yes’ at Site Level.
Code for Create Group API
DECLARE
p_group_rec HZ_PARTY_V2PUB.GROUP_REC_TYPE;
x_party_id NUMBER;
x_party_number VARCHAR2 (2000);
x_return_status VARCHAR2 (2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (2000);
BEGIN
Fnd_client_info.set_org_context ('&Org_Id');
P_group_rec.group_name := '&Group_Name';
P_group_rec.group_type := '&Group_Type';
p_group_rec.created_by_module := 'TCA_EXAMPLE';
hz_party_v2pub.CREATE_GROUP ('T',
p_group_rec,
x_party_id,
x_party_number,
x_return_status,
x_msg_count,
x_msg_data);
DBMS_OUTPUT.put_line (
'x_return_status =' || SUBSTR (x_return_status, 1, 255));
DBMS_OUTPUT.put_line ('x_msg_count =' || TO_CHAR (x_msg_count));
DBMS_OUTPUT.put_line ('Party Id =' || TO_CHAR (x_party_id));
DBMS_OUTPUT.put_line ('Party Number = ' || x_party_number);
DBMS_OUTPUT.put_line (
'Group Name = ' || SUBSTR (p_group_rec.group_name, 1, 50));
DBMS_OUTPUT.put_line ('x_msg_data = ' || SUBSTR (x_msg_data, 1, 255));
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;
Sample Output of the Create Group Script
x_return_status = S
x_msg_count = 0
Party Id = 7861
Party Number = 6246
Group Name = ISC Group
x_msg_data = ''
Script To Verify whether the Create Group API is successful
SELECT party_id,
SUBSTR (party_number, 1, 5),
SUBSTR (party_name, 1, 20),
SUBSTR (object_version_number, 1, 1),
SUBSTR (created_by_module, 1, 25)
FROM hz_parties
WHERE party_id = 7861;
Party_id = 7861
Party_number = 6246
Party_name = ISC Group
Obj_ver = 1
Created_by_module = TCA_EXAMPLE