Thursday, March 10, 2016

‘API to Create a Party Site TCA R12 (HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE)’

API to Create a Party Site TCA R12 (HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE)


                                                                                                                                 
DESCRIPTION: This routine is used to create a Party Site for a party. Party Site relates an existing party from the HZ_PARTIES table with an address location from the HZ_LOCATIONS table.The API creates a record in the HZ_PARTY_SITES table. You can create multiple party sites with multiple locations and mark one of those party sites as identifying for that party. The identifying party site address components are denormalized into the
HZ_PARTIES table. If orig_system is passed in, the API also creates a record in the HZ_ORIG_SYS_REFERENCES table to store the mapping between the source system reference and the TCA primary key.
API:   HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE
BASE TABLES AFFECTED :  HZ_PARTY_SITES
TEST INSTANCE : R12.1.3
NOTES:
Enter the values for Party Id and Location Id as valid values from HZ_PARTIES and HZ_LOCATIONS respectively.
SELECT party_id    FROM hz_parties;
SELECT location_id FROM hz_locations;

SCRIPT:

SET SERVEROUTPUT ON;
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
-- 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_party_site_rec.party_id                 := 530682;
p_party_site_rec.location_id              := 28215;
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module        := 'BO_API';

DBMS_OUTPUT.PUT_LINE('Calling the API hz_party_site_v2pub.create_party_site');

HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE
                   (
                    p_init_msg_list     => FND_API.G_TRUE,
                    p_party_site_rec    => p_party_site_rec,
                    x_party_site_id     => x_party_site_id,
                    x_party_site_number => x_party_site_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 Site is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');
    DBMS_OUTPUT.PUT_LINE('Party Site Id     = '||x_party_site_id);
    DBMS_OUTPUT.PUT_LINE('Party Site Number = '||x_party_site_number);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Party Site 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');
END;
/


No comments:

Post a Comment

Types of animations

Animation is a diverse and creative field with a variety of styles that artists and filmmakers use to bring their visions to life. Here are ...