Using API
(FND_PROGAM) you will create a concurrent program, executable, and add
parameters to existing program.
Also delete a concurrent program and executable using API
Below are sample PLSQL scripts.
--1) Register an Executable
DECLARE
lc_executable_name
VARCHAR2(240) := 'Daily Claim Report';
lc_short_name
VARCHAR2(50) := 'XX007CLAIM';
lc_application_name
VARCHAR2(240) := 'XXPO'; -- Short name
lc_description
VARCHAR2(240) := 'Claim Report';
lc_executable_method VARCHAR2(240)
:= 'PL/SQL Stored Procedure';
lc_execution_file_name VARCHAR2(45) :=
'XX007_Claim.main';
lc_language_code
VARCHAR2(5) := 'US'; -- Default Value is 'US'
ln_executable_id NUMBER := 0;
BEGIN
FND_PROGRAM.EXECUTABLE
(executable => lc_executable_name,
application => lc_application_name,
short_name
=> lc_short_name,
description => lc_description,
execution_method
=> lc_executable_method,
execution_file_name
=> lc_execution_file_name,
subroutine_name
=> NULL,
icon_name
=> NULL,
language_code
=> lc_language_code
);
COMMIT;
--
-- To check whether Concurrent Executable is registered or not
--
BEGIN
SELECT executable_id INTO ln_executable_id
FROM fnd_executables
WHERE executable_name = 'XX007CLAIM'
AND application_id = (SELECT application_id FROM fnd_application
WHERE application_short_name = 'XXPO');
EXCEPTION
WHEN others THEN
dbms_output.put_line('Error in Executable: '||SQLERRM);
END;
--
--
EXCEPTION
WHEN others THEN
dbms_output.put_line('Error:
'||SQLERRM);
END;
/
--2) Register a Concurrent Program
DECLARE
--
lc_program VARCHAR2(240);
lc_application VARCHAR2(10);
lc_enabled VARCHAR2(5);
lc_short_name VARCHAR2(30);
lc_description VARCHAR2(240);
lc_executable_short_name
VARCHAR2(30);
lc_executable_application VARCHAR2(10);
lc_save_output VARCHAR2(5);
lc_print VARCHAR2(5);
lc_style_required VARCHAR2(5);
lc_use_in_srs VARCHAR2(5);
lc_allow_disabled_values VARCHAR2(5);
lc_run_alone VARCHAR2(5);
lc_output_type VARCHAR2(30);
lc_enable_trace VARCHAR2(5);
lc_restart VARCHAR2(5);
lc_nls_compliant VARCHAR2(5);
lc_language_code VARCHAR2(20);
ln_executable_id NUMBER;
lc_check VARCHAR2(5) := NULL;
--
BEGIN
--
lc_program := 'Daily Claim Report
XX007';
lc_application := 'XXPO';
lc_enabled := 'Y';
lc_short_name := 'XX007CLAIM';
lc_description := 'OracleAppsDNA Test Program';
lc_executable_short_name :=
'XX007CLAIM';
lc_executable_application :=
'XXPO';
lc_save_output := 'Y';
lc_print := 'Y';
lc_style_required :=
'N';
lc_use_in_srs := 'Y';
lc_allow_disabled_values :=
'N';
lc_run_alone := 'N';
lc_output_type := 'TEXT';
lc_enable_trace := 'Y';
lc_restart := 'Y';
lc_nls_compliant :=
'Y';
lc_language_code :=
'US';
ln_executable_id := 0;
--
-- Executable is
mandatory to create Concurrent Program:
BEGIN
SELECT executable_id INTO ln_executable_id
FROM
fnd_executables
WHERE executable_name = 'XX007CLAIM'
AND application_id = (SELECT application_id
FROM fnd_application
WHERE
application_short_name = 'XXPO');
EXCEPTION
WHEN others THEN
dbms_output.put_line('Error
in Executable: '||SQLERRM);
END;
--
--Calling API to
create concurrent program definition
--
apps.fnd_program.register
(program => lc_program,
application => lc_application,
enabled => lc_enabled,
short_name => lc_short_name,
description => lc_description,
executable_short_name => lc_executable_short_name,
executable_application => lc_executable_application,
execution_options => NULL,
priority => NULL,
save_output
=> lc_save_output,
print => lc_print,
cols => NULL,
ROWS => NULL,
STYLE => NULL,
style_required => lc_style_required,
printer => NULL,
request_type
=> NULL,
request_type_application => NULL,
use_in_srs => lc_use_in_srs,
allow_disabled_values => lc_allow_disabled_values,
run_alone => lc_run_alone,
output_type => lc_output_type,
enable_trace
=> lc_enable_trace,
restart => lc_restart,
nls_compliant
=> lc_nls_compliant,
icon_name
=> NULL,--
language_code => lc_language_code,
mls_function_short_name => NULL,
mls_function_application => NULL,
incrementor
=> NULL,
refresh_portlet
=> NULL
);
--
COMMIT;
--To check whether Concurrent Program is registered or not
--
BEGIN
SELECT 'Y'
INTO lc_check
FROM
fnd_concurrent_programs
WHERE
concurrent_program_name = 'XX007CLAIM'
AND application_id = (SELECT application_id
FROM fnd_application
WHERE
application_short_name = 'XXPO');
--
DBMS_OUTPUT.put_line ('Concurrent Program Registered Successfully');
--
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line ('Concurrent Program Registration Failed');
END;
END;
/
--3) Add parameters to created Concurrent Program.
BEGIN
FND_PROGRAM.PARAMETER
(program_short_name => 'XX007CLAIM',
application => 'XXPO',
sequence => 10,
parameter => 'Claim_Num',
description => 'Claim Number', --DEFAULT NULL,
enabled => 'Y', --DEFAULT 'Y',
value_set => '15 Characters', -- this is existing value set name
default_type => NULL, -- DEFAULT NULL,
default_value => NULL, -- DEFAULT NULL,
required => 'N', -- DEFAULT 'N',
enable_security => 'N', -- DEFAULT 'N',
range => NULL, --DEFAULT NULL,
display => 'Y', --DEFAULT 'Y',
display_size => 15,
description_size => 50,
concatenated_description_size => 25,
prompt => 'Claim_Num', --DEFAULT NULL,
token => NULL --DEFAULT NULL
);
COMMIT;
EXCEPTION
WHEN others THEN
dbms_output.put_line('Parameter not added.');
END;
/
--4) Delete a concurrent Program and Executable using API:
DECLARE
v_short_name VARCHAR2 (50) := 'XX007CLAIM';
v_app_full_name VARCHAR2(80) := 'Custom PO';
BEGIN
--
-- API call to delete Concurrent Program:
--
fnd_program.delete_program ( v_short_name,v_app_full_name);
dbms_output.put_line ('Concurrent Program successfully Deleted: ' || v_short_name);
--
--API call to delete Executable
--
fnd_program.delete_executable (v_short_name, v_app_full_name);
dbms_output.put_line ('Executable successfully Deleted: ' || v_short_name);
END;
/