How to call Database Task from Custom Menu

  • 7 February 2022
  • 3 replies
  • 373 views

Badge +2

Hi All,

 

We have custom Procedure in Custom Package [C_Payroll_PKG.C_Run_payroll ], this procedure i need to give our users to execute it. Basically this procedure takes more than 3 hrs to run, therefore i created database take to call this procedure. Now i want the user to run this database task via custom menu. I created the cusom menu with the following:

Action Type: PL/SQL Block

PL/SQL Block:
declare

v_job_no number;

begin

ifsapp.dbms_job.submit (v_job_no , ‘C_Payroll_PKG.C_Run_Payroll’,sysdate);

end;



when i press Test button to check it, i got the following Error:

FNDSQLFORBIDDEN: Forbidden PLSQL code rejected: “DBMS_JOB” ..

If its not possible to run db job from custom  menu and advice aproach you are suggesting??

Regards,
Nasser Al-Shabibi


This topic has been closed for comments

3 replies

Userlevel 7
Badge +19

You can use following method to post a background job in IFS. You will be able to see the progress from the application in “Background Jobs” window. Parameter description_ can be adjusted to something suitable.

BEGIN
IFSAPP.Transaction_SYS.Deferred_Call(procedure_name_ => 'C_Payroll_PKG.C_Run_Payroll',
argument_type_db_ => 'NONE',
arguments_ => '',
description_ => 'Run Payroll');
END;

 

Badge +2

Dear Tomas, 
I really appreciate you valuable update, it helped me to follow the right path.

After implementing the Transaction_SYS.Deferred_Call based on your advice, the database task is executed succssfully, but when i check the background job deails , I’m getting another issue as explained below:
Seems to me arguments which i’m passing are not accepted.

declare
attr_ varchar2(2000);
v_id_ number;
BEGIN
client_sys.clear_attr(attr_);
client_sys.add_to_attr('company_id_', 'RCA' ,attr_);
client_sys.add_to_attr('payroll_id_', '2021-8' ,attr_);
client_sys.add_to_attr('regulation_id_', '%',attr_);
client_sys.add_to_attr('emp_id_','%',attr_);
client_sys.add_to_attr('wage_code_id_', '%' ,attr_);
client_sys.add_to_attr('absence_code_','%',attr_);

transaction_sys.deferred_call( id_=> v_id_,
procedure_name_ => 'Hrp_Pay_List_API.C_Execute_Absence_Data',
argument_type_db_=>'ATTRIBUTE',
arguments_=> attr_,
description_=>'Hrp_Pay_List_API.C_Execute_Absence_Data');
COMMIT;

END;
Custom Menu PL/SQL Code
This how Our Customized Procedure structrued

Hopefully, what i’ve uploaded will make it clear to you for further invistigation.

 

Many Thanks for you valuable help

Nasser

Userlevel 6
Badge +14

@OmaNasseA ,

 

Try with:

argument_type_db_=>'PARAMETER’,

Probably also remove commit;