, ,

API – Customer Level Attribute Updation (Customer Class , Etc)

declare
p_cust_account_rec    HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
x_return_status       VARCHAR2(2000);
x_msg_count           NUMBER;
xio_p_object_version  NUMBER;
x_msg_data            VARCHAR2(2000);
v_account_id          NUMBER;
V_OBJECT_VERSION      NUMBER;
BEGIN

—    FND_GLOBAL.APPS_INITIALIZE(<user_id>,<resp_id>,<resp_applicarion_id>);
—    MO_GLOBAL.INIT(‘AR’);
—    MO_GLOBAL.SET_POLICY_CONTEXT(‘S’, <org_id>);

     FND_GLOBAL.APPS_INITIALIZE(1535,50930,222);
     MO_GLOBAL.INIT(‘AR’);
     MO_GLOBAL.SET_POLICY_CONTEXT(‘S’, 807);  

     BEGIN
      SELECT  –HCSU.SITE_USE_ID,
               hcas.CUST_ACCOUNT_ID,
                    HCS.OBJECT_VERSION_NUMBER
            INTO    V_ACCOUNT_ID,
                    V_OBJECT_VERSION
            FROM    HZ_PARTIES HP,
                    HZ_PARTY_SITES HPS,
                    HZ_CUST_ACCT_SITES_ALL HCAS,
                    HZ_CUST_SITE_USES_ALL HCSU,
                    hz_cust_accounts_all hcs
            WHERE   HP.PARTY_ID = HPS.PARTY_ID
            AND     HPS.PARTY_SITE_ID = HCAS.PARTY_SITE_ID
            AND     HCAS.CUST_ACCT_SITE_ID =HCSU.CUST_ACCT_SITE_ID
            AND     HCSU.SITE_USE_CODE = ‘BILL_TO’
            AND     HCS.CUST_ACCOUNT_ID = HCAS.CUST_ACCOUNT_ID
            AND     ltrim(rtrim(upper(HP.PARTY_NAME)))= ltrim(rtrim(upper(‘Spinneys Mussafah Warehouse’)));
   
     EXCEPTION WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(‘ERROR IS’||SUBSTR(SQLERRM,1,150));           
     END;

    
     p_cust_account_rec.cust_account_id :=  V_account_ID;             — Site USe to be updated
     xio_p_object_version               :=  V_OBJECT_VERSION;          –xio_p_object_version := 1;
   
  p_cust_account_rec.customer_class_code := ‘RULER’;   — ‘DEALER’ , ‘FAMILY’ , ‘GENERAL’
                                                   
       hz_cust_account_v2pub.update_cust_account(
                                                    FND_API.G_FALSE,
                                                    p_cust_account_rec,
                                                    xio_p_object_version,
                                                    x_return_status,
                                                    x_msg_count,
                                                    x_msg_data);

    dbms_output.put_line(‘***************************’);
    dbms_output.put_line(‘Output information ….’);
    dbms_output.put_line(‘x_return_status: ‘||x_return_status);
    dbms_output.put_line(‘x_msg_count: ‘||x_msg_count);
    dbms_output.put_line(‘xio_p_object_version: ‘||xio_p_object_version);
    dbms_output.put_line(‘x_msg_data: ‘||x_msg_data);
    dbms_output.put_line(‘***************************’);
   
    COMMIT;

END;

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply