Saturday 19 January 2013

anonymous block for contact point creation

------------------*****anonymous block for contact point creation****---------------
DECLARE
  p_contact_point_rec hz_contact_point_v2pub.contact_point_rec_type;
  p_edi_rec hz_contact_point_v2pub.edi_rec_type;
  p_email_rec hz_contact_point_v2pub.email_rec_type;
  p_phone_rec hz_contact_point_v2pub.phone_rec_type;
  p_telex_rec hz_contact_point_v2pub.telex_rec_type;
  p_web_rec hz_contact_point_v2pub.web_rec_type;
  x_return_status    VARCHAR2 (2000);
  x_msg_count        NUMBER;
  x_msg_data         VARCHAR2 (2000);
  x_contact_point_id NUMBER;
BEGIN
  p_contact_point_rec.contact_point_type    := 'PHONE';
  p_contact_point_rec.owner_table_name      := 'HZ_PARTIES';
  p_contact_point_rec.owner_table_id        := '63294';
  p_contact_point_rec.primary_flag          :='Y';
  p_contact_point_rec.contact_point_purpose := 'BUSINESS';
  p_phone_rec.phone_area_code               := '650';
  p_phone_rec.phone_country_code            := '1';
  p_phone_rec.phone_number                  := '506-7000';
  p_phone_rec.phone_line_type               := 'GEN';
  p_contact_point_rec.created_by_module     := 'HZ_CPUI';
  hz_contact_point_v2pub.create_contact_point ('T',
  p_contact_point_rec,
  p_edi_rec,
  p_email_rec,
  p_phone_rec,
  p_telex_rec,
  p_web_rec,
  x_contact_point_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_contact_point_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;
 

1 comment: