Saturday 2 June 2018

How to Update Customer Location Address in the Oracle Apps EBS R12 Using Script


----****** How to Update Customer Location Address in the Oracle Apps EBS R12 Using Script *********** ----------


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 := 'LOC_Address1';
   p_location_rec.address2 := 'LOC_Address2';
   p_location_rec.address3 := 'LOC_Address3';
   p_location_rec.address4 := 'LOC_Address4';
   p_location_rec.city := 'LOC_CITY';
   p_location_rec.state := 'LOC_STATE';
   p_location_rec.postal_code := 'POSTAL_CODE';
   p_location_rec.country := 'IN';
   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;


No comments:

Post a Comment

How to change Employee Number Generation from Manual to Automatic in Oracle HRMS (When attempting to apply for a job in iRecruitment)

When attempting to apply for a job in iRecruitment, the following error occurs: ERROR: You must enter an Application Number. Solution: How t...