Loading

Tuesday, March 8, 2011

Create Party of type Organization in Oracle TCA using API hz_party_v2pub.create_organization

                                                                                                            

Test Instance                    : R12.1.3
Purpose of the API          : CREATE ORGANIZATION API
API Package Used            : HZ_PARTY_V2PUB
PL/SQL Procedure used : CREATE_ORGANIZATION
Base Tables Affected      : HZ_PARTIES , HZ_ORGANIZATION_PROFILES
Notes:
1.       Ensure that the Profile Option HZ : Generate Party Number is Set to ‘Yes’ at Site Level. 
  1. Value for created_by_module must be a value defined in lookup type HZ_CREATED_BY_MODULES in the table FND_LOOKUP_VALUES 
SCRIPT:

SET SERVEROUTPUT ON;
DECLARE

p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE;
x_return_status    VARCHAR2(2000);
x_msg_count        NUMBER;
x_msg_data         VARCHAR2(2000);
x_party_id         NUMBER;
x_party_number     VARCHAR2(2000);
x_profile_id       NUMBER;

BEGIN
p_organization_rec.organization_name := 'New TCA Organization';
p_organization_rec.created_by_module := 'BO_API';

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

hz_party_v2pub.create_organization
             (
              p_init_msg_list    => FND_API.G_TRUE,
              p_organization_rec => p_organization_rec,
              x_return_status    => x_return_status,
              x_msg_count        => x_msg_count,
              x_msg_data         => x_msg_data,
              x_party_id         => x_party_id,
              x_party_number     => x_party_number,
              x_profile_id       => x_profile_id
                   );

IF x_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Organization is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');
    DBMS_OUTPUT.PUT_LINE('Party Id         ='|| x_party_id);
    DBMS_OUTPUT.PUT_LINE('Party_Number     ='|| x_party_number);
    DBMS_OUTPUT.PUT_LINE('Profile Id       ='|| x_profile_id);  
ELSE
    DBMS_OUTPUT.put_line ('Creation of Organization failed:'||x_msg_data);
    ROLLBACK;
    FOR i IN 1 .. x_msg_count
    LOOP
      x_msg_data := oe_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');
END;
/

0 Responses to “Create Party of type Organization in Oracle TCA using API hz_party_v2pub.create_organization”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.