Saturday, 19 January 2013

anonymous block for cutomer account sites creation

-------------*********anonymous block for cutomer account sites creation******-------------------
declare
p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
x_cust_acct_site_id NUMBER;
x_return_status VARCHAR2 (2000);
x_msg_count     NUMBER;
x_msg_data      VARCHAR2 (2000);
begin
p_cust_acct_site_rec.cust_account_id   :=17070;
  p_cust_acct_site_rec.party_site_id     :=41276;
  --p_cust_acct_site_rec.LANGUAGE          := 'US';
  p_cust_acct_site_rec.created_by_module := 'HZ_CPUI';
  hz_cust_account_site_v2pub.create_cust_acct_site ('T',
  p_cust_acct_site_rec,
  x_cust_acct_site_id,
  x_return_status,
  x_msg_count,
  x_msg_data );
  IF  x_return_status ='S'THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Customer account site is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust acct site id          = '||TO_CHAR( x_cust_acct_site_id));
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Customer account site 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;
/
 

anonymous block for customer party site creation

-------------********anonymous block for customer party site creation****------------------

declare
p_party_site_rec hz_party_site_v2pub.party_site_rec_type;
x_party_site_id number;
x_party_site_number number;
x_return_status VARCHAR2 (2000);
x_msg_count     NUMBER;
x_msg_data      VARCHAR2 (2000);
 begin
 p_party_site_rec.party_id                 := 68277;
  p_party_site_rec.location_id              :=19959;
  p_party_site_rec.identifying_address_flag := 'Y';
  p_party_site_rec.created_by_module        :='HZ_CPUI';
  hz_party_site_v2pub.create_party_site ('T',
  p_party_site_rec,
  x_party_site_id,
  x_party_site_number,
  x_return_status,
  x_msg_count,
  x_msg_data );
  IF  x_return_status ='S'THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of party site  is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust party site Id           = '||TO_CHAR(x_party_site_id));
    dbms_output.put_line('Cust party site number           = '||TO_CHAR(x_party_site_number));
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of party site 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;
/

 

anonymous block for customer location


---------------********anonymous block for customer location*****---------------------

declare
p_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
x_location_id number;
x_return_status VARCHAR2 (2000);
x_msg_count     NUMBER;
x_msg_data      VARCHAR2 (2000);
 begin
 p_location_rec.country           := 'US';
  p_location_rec.address1          := 'Shivaji nagr';
  p_location_rec.address2          := 'Bhalerao ';
  p_location_rec.city              :='Pune';
  p_location_rec.postal_code       := 411033;
  p_location_rec.state             := 'MH';
  p_location_rec.created_by_module := 'HZ_CPUI';
  hz_location_v2pub.create_location( 'T',
  p_location_rec,
  x_location_id,
  x_return_status,
  x_msg_count,
  x_msg_data); IF  x_return_status ='S'THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Customer location is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust location Id           = '||TO_CHAR(x_location_id));
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Customer location 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;
/

 

anonymous block for customer account creation

-----------******anonymous block for customer account creation******------------------------

declare
p_organization_rec   hz_party_v2pub.organization_rec_type;
p_cust_account_rec   hz_cust_account_v2pub.cust_account_rec_type;
party_rec         hz_party_v2pub.party_rec_type;
p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
  x_return_status varchar2(200);
  x_msg_count number;
  x_msg_data varchar2(200);
  x_party_id number;
  x_party_number number;
  x_profile_id number;
  x_cust_account_id number;
  x_account_number number;
  begin
p_cust_account_rec.account_name      := 'XX_INFO';
  p_cust_account_rec.created_by_module := 'HZ_CPUI';
  p_organization_rec.party_rec.party_id :=68277;
--p_customer_profile_rec.cust_account_profile_id:=17035; 
  hz_cust_account_v2pub.create_cust_account (
    'T',
    p_cust_account_rec       ,
    p_organization_rec       ,
    null   ,
    'T',
    x_cust_account_id         ,
    x_account_number          ,
    x_party_id                ,
    x_party_number            ,
    x_profile_id              ,
    x_return_status           ,
    x_msg_count               ,
    x_msg_data               
);
   IF  x_return_status ='S'THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Customer Profile is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust account id           = '||TO_CHAR(x_cust_account_id));
    dbms_output.put_line('Cust account number           = '||TO_CHAR(x_account_number));
    dbms_output.put_line('Cust party id           = '||TO_CHAR(x_party_id));
    dbms_output.put_line('Cust party number       = '||TO_CHAR(x_party_number));
    dbms_output.put_line('Cust profile Id         = '||x_profile_id);
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Customer Profile 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;

 

anonymous block for customer profile creation


--------------******anonymous block for customer profile creation *****----------

declare
p_customer_profile_rec   HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
  x_cust_account_profile_id                  NUMBER;
    x_return_status                           VARCHAR2(200);
    x_msg_count                              NUMBER;
    x_msg_data                              VARCHAR2(200);
begin
p_customer_profile_rec.party_id   :=68277;
--p_customer_profile_rec_type.standard_terms:=v_term_id;
p_customer_profile_rec.created_by_module := 'HZ_CPUI';
HZ_CUSTOMER_PROFILE_V2PUB.CREATE_CUSTOMER_PROFILE
                  ('T',
    p_customer_profile_rec ,
    'T',
    x_cust_account_profile_id ,
    x_return_status           ,
    x_msg_count               ,
    x_msg_data               
);
IF  x_return_status ='S'THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Customer account Profile is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust account profile id           = '||TO_CHAR(x_cust_account_profile_id));
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Customer account Profile 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;
/
 

anonymous block for customer creation as group type

-------------**********anonymous block for customer creation as group type*****--------------------


declare
    p_group_rec          HZ_PARTY_V2PUB.GROUP_REC_TYPE;
    x_party_id           NUMBER;
    x_party_number       VARCHAR2(200);
    x_return_status      VARCHAR2(200);
    x_msg_count          NUMBER;
    x_msg_data           VARCHAR2(200);
begin
p_group_rec.group_name:='xx_cust_group';
p_group_rec.group_type:='GROUP';
p_group_rec.created_by_module:='HZ_CPUI';
HZ_PARTY_V2PUB.create_group(
    'T',
    p_group_rec         ,
    x_party_id          ,
    x_party_number      ,
    x_return_status     ,
    x_msg_count         ,
    x_msg_data         
);
  IF  x_return_status ='S'THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Customer contact is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust contact point id         = '||TO_CHAR(x_party_id));
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Customer contact 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;
 

anonymous block for customer creaton organization type


-----------******anonymous block for customer creaton organization type*******----------------

declare
  p_organization_rec   hz_party_v2pub.organization_rec_type;
  x_return_status varchar2(200);
  x_msg_count number;
  x_msg_data varchar2(200);
  x_party_id number;
  x_party_number number;
  x_profile_id number;
begin
p_organization_rec.organization_name :='xx_org_rel_test123';
  p_organization_rec.created_by_module :='TCA_FORM_WRAPPER';
  hz_party_v2pub.create_organization ('T',
  p_organization_rec,
  x_return_status,
  x_msg_count,
  x_msg_data,
  x_party_id,
  x_party_number,
  x_profile_id );
  IF  x_return_status ='S' THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Creation of Customer Profile is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');  
    dbms_output.put_line('Cust party Id           = '||TO_CHAR(x_party_id));
    dbms_output.put_line('Cust party number       = '||TO_CHAR(x_party_number));
    dbms_output.put_line('Cust profile Id         = '||x_profile_id);
    dbms_output.put_line('Return Status Of Api    = '||x_return_status);
    dbms_output.put_line('No of err msgs          = '||x_msg_count);
    dbms_output.put_line('err information          = '||x_msg_data);
ELSE
    DBMS_OUTPUT.put_line ('Creation of Customer Profile 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;