API to create Group in TCA R12 (HZ_PARTY_V2PUB.CREATE_GROUP)

API to create Group in TCA R12 (HZ_PARTY_V2PUB.CREATE_GROUP)





API :HZ_PARTY_V2PUB.CREATE_GROUP
TEST INSTANCE: R12.1.3
DETAILS OF THE ROUTINE:
This API is used to create a group. The API creates a record in the HZ_PARTIES table with party type ‘GROUP’. The HZ_PARTIES table holds the basic information about the party. There is no profile information for a Group party unlike an Organization or Person party.
SCRIPT:

SET SERVEROUTPUT ON;
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
-- Setting the Context --
mo_global.init('AR');
fnd_global.apps_initialize ( user_id      => 1318
                            ,resp_id      => 50559
                            ,resp_appl_id => 222);
mo_global.set_policy_context('S',204);
fnd_global.set_nls_context('AMERICAN');

-- Initializing the Mandatory API parameters
P_group_rec.group_name        := 'TEAM Group';
P_group_rec.group_type        := 'NGO';
p_group_rec.created_by_module := 'BO_API';

DBMS_OUTPUT.PUT_LINE('Calling the API hz_party_v2pub.create_group');

hz_party_v2pub.create_group
            (
              p_init_msg_list    => FND_API.G_TRUE,
              p_group_rec        => p_group_rec,
              x_party_id         => x_party_id,
              x_party_number     => x_party_number,
              x_return_status    => x_return_status,
              x_msg_count        => x_msg_count,
              x_msg_data         => x_msg_data
                  );


IF x_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Party of Type Group is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');
    DBMS_OUTPUT.PUT_LINE('Party Id = '||TO_CHAR(x_party_id));
    DBMS_OUTPUT.PUT_LINE('Party Number = '||x_party_number);  
ELSE
    DBMS_OUTPUT.put_line ('Creation of Party of Type Group failed:'||x_msg_data);
    ROLLBACK;
    FOR i IN 1 .. x_msg_count
    LOOP
      x_msg_data := FND_msg_pub.get( p_msg_index => i, p_encoded => 'F');
      dbms_output.put_line( i|| ') '|| x_msg_data);
    END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Completion of API hz_party_v2pub.create_group');
END;
/


Post a Comment