Release Hold

 /* Formatted on 09/15/2020*/


declare

   x_invoice_id                    number;

   x_hold_lookup_code              varchar2 (240);

   x_held_by                       varchar2 (240);

   x_calling_sequence              number;

   x_release_lookup_code           varchar2 (240);

   x_release_reason                varchar2 (240);

   x_responsibility_id             varchar2 (240);

   x_last_updated_by              varchar2 (240);

   x_last_update_date              date;

   x_holds_count                   number;

   x_approval_status_lookup_code   varchar2 (240);

   lv_user_id number;

   cursor c1

   is

      select apia.invoice_id,

             apha.hold_lookup_code,

             apha.held_by,

             apha.last_updated_by,

             apha.last_update_date,

             apha.responsibility_id

        from ap_invoices_all apia, ap_holds_all apha

       where     1 = 1

             and apia.payment_status_flag = 'N'

             and apia.invoice_id = apha.invoice_id

             and apha.release_lookup_code is null

             and apia.invoice_id = 240781634;

begin

   lv_user_id:=FND_GLOBAl.USER_ID;

   fnd_global.apps_initialize (lv_user_id, 20639, 200);

   mo_global.set_policy_context ('S', 101);

   mo_global.init ('SQLAP');


   for i in c1

   loop

      x_invoice_id := i.invoice_id;

      x_hold_lookup_code := i.hold_lookup_code;

      x_held_by :=lv_user_id;

      x_calling_sequence := null;

      x_release_lookup_code := 'VARIANCE CORRECTED';

      x_release_reason := 'Invoice variance corrected';

      x_responsibility_id := i.responsibility_id;

      x_last_updated_by :=lv_user_id;

      x_last_update_date := i.last_update_date;

      x_holds_count := null;

      x_approval_status_lookup_code := null;


      --      ap_holds_pkg.release_single_hold (x_invoice_id,

      --                                        x_hold_lookup_code,

      --                                        x_release_lookup_code,

      --                                        x_held_by,

      --                                        x_calling_sequence);

 

      ap_holds_pkg.quick_release (x_invoice_id,

                                  x_hold_lookup_code,

                                  x_release_lookup_code,

                                  x_release_reason,

                                  x_responsibility_id,

                                  x_last_updated_by,

                                  x_last_update_date,

                                  x_holds_count,

                                  x_approval_status_lookup_code,

                                  x_calling_sequence);


   end loop;

   commit;

end;

Uploading: 1817392 of 1817392 bytes uploaded.