Script to update Customer Location Address

Script to update Customer Location Address, www.akhareesh.com

DECLARE
   p_location_rec            HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
   p_object_version_number   NUMBER;
   x_return_status           VARCHAR2 (4000);
   x_msg_count               NUMBER;
   x_msg_data                VARCHAR2 (4000);
BEGIN
   DBMS_OUTPUT.PUT_LINE ('Start of Script');
   mo_global.init ('AR');
   fnd_global.apps_initialize (user_id        => 11,
                               resp_id        => 551122,
                               resp_appl_id   => 457);
   mo_global.set_policy_context ('S', 123);

   p_object_version_number := 1;
   p_location_rec.location_id := 28195;
   p_location_rec.address1 := 'TEST1';
   p_location_rec.address2 := 'TEST2';
   p_location_rec.address3 := 'TEST3';
   p_location_rec.address4 := 'TEST4';
   p_location_rec.CITY := 'TEST5';
   p_location_rec.STATE := 'TEST6';
   p_location_rec.POSTAL_CODE := '123456';
   p_location_rec.COUNTRY := 'US';

   DBMS_OUTPUT.PUT_LINE ('Calling the API hz_location_v2pub.update_location');

   hz_location_v2pub.update_location (
      p_init_msg_list           => FND_API.G_TRUE,
      p_location_rec            => p_location_rec,
      p_object_version_number   => p_object_version_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 ('Successfully Location address updated ');
   ELSE
      ROLLBACK;

      FOR i IN 1 .. x_msg_count
      LOOP
         x_msg_data := oe_msg_pub.get (p_msg_index => i, p_encoded => 'F');
         DBMS_OUTPUT.put_line (i || ') ' || x_msg_data);
      END LOOP;

      DBMS_OUTPUT.put_line ('Location address update failed:' || x_msg_data);
   END IF;

   DBMS_OUTPUT.PUT_LINE ('End of Script');
END;
/

*/