Thursday, March 10, 2016

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

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

                                                                                                                                 
DESCRIPTION: This routine is used to create a Party Site Use for a Party Site. The API creates a record in the HZ_PARTY_SITE_USES table. Party site use defines a business purpose for a party site such as 'BILL_TO', 'SHIP_TO' etc. You can create a party site use for a party site that is already present in the HZ_PARTY_SITES table. The first active party siteuse that you create is identified as the primary party site use. The primary party site use cannot be inactive.
API:   HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE_USE
BASE TABLES AFFECTED :  HZ_PARTY_SITE_USES
TEST INSTANCE : R12.1.3
SCRIPT:
SET SERVEROUTPUT ON;
DECLARE
p_party_site_use_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_USE_REC_TYPE;
x_party_site_use_id  NUMBER;
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_use_rec.site_use_type     := upper('BILL_TO');
p_party_site_use_rec.party_site_id     := 291634;
p_party_site_use_rec.created_by_module := 'BO_API';

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

HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE_USE
                   (
                    p_init_msg_list      => FND_API.G_TRUE,
                    p_party_site_use_rec => p_party_site_use_rec,
                    x_party_site_use_id  => x_party_site_use_id,
                    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 use is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');
    DBMS_OUTPUT.PUT_LINE('Party Site Id = '||p_party_site_use_rec.party_site_id);
      DBMS_OUTPUT.PUT_LINE('Site Use Id   = '||x_party_site_use_id);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Party Site use got 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

Drilldown from GL to Inventory Transactions, Inv to gl Link Query R12,Inventory to General ledger links, r12 ,Inv to gl drill down

Drilldown from GL to Inventory Transactions, Inv to gl Link Query R12,Inventory to General ledger links, r12 ,Inv to gl drill down Link bet...