Oracle EBS PL/SQL Concurrent Program Generator: Package and FND_PROGRAM Registration
This generator produces a complete PL/SQL concurrent program for Oracle E-Business Suite 12.1 or 12.2: the package with the errbuf and retcode signature, a canonical date parameter, CSV output and error handling, plus the FND_PROGRAM API calls that register it. A forms navigation block is included for teams that register through the UI.
Fill in
Label only: output type stays TEXT; the file content is CSV.
Same as the program short name makes it incompatible with itself (one run at a time). Delete the INCOMPATIBILITY call if not needed.
Block 1: package spec and body
CREATE OR REPLACE PACKAGE XXCUST_ITEM_EXTRACT_PKG AS
PROCEDURE MAIN (errbuf OUT NOCOPY VARCHAR2,
retcode OUT NOCOPY VARCHAR2,
p_from_date IN VARCHAR2,
p_item_prefix IN VARCHAR2);
END XXCUST_ITEM_EXTRACT_PKG;
/
CREATE OR REPLACE PACKAGE BODY XXCUST_ITEM_EXTRACT_PKG AS
PROCEDURE MAIN (errbuf OUT NOCOPY VARCHAR2,
retcode OUT NOCOPY VARCHAR2,
p_from_date IN VARCHAR2,
p_item_prefix IN VARCHAR2) IS
l_date DATE;
l_rows NUMBER := 0;
BEGIN
retcode := '0';
-- FND_STANDARD_DATE passes the canonical string YYYY/MM/DD HH24:MI:SS
l_date := NVL(FND_DATE.CANONICAL_TO_DATE(p_from_date), TRUNC(SYSDATE) - 1);
FND_FILE.PUT_LINE(FND_FILE.LOG, 'Started ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
|| ' date=' || TO_CHAR(l_date, 'DD-MON-YYYY') || ' text=' || p_item_prefix);
-- CSV header (output CSV = Y)
FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'ORGANIZATION_ID,ITEM,DESCRIPTION,LAST_UPDATE_DATE');
-- Replace with your own query
FOR r IN (SELECT msi.organization_id, msi.segment1, msi.description, msi.last_update_date
FROM mtl_system_items_b msi
WHERE msi.segment1 LIKE p_item_prefix || '%'
AND msi.last_update_date >= l_date
ORDER BY msi.segment1, msi.organization_id) LOOP
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,
r.organization_id || ',' || r.segment1 || ',"' || REPLACE(r.description, '"', '""') || '",'
|| TO_CHAR(r.last_update_date, 'YYYY-MM-DD HH24:MI:SS'));
l_rows := l_rows + 1;
END LOOP;
FND_FILE.PUT_LINE(FND_FILE.LOG, 'Rows written: ' || l_rows);
IF l_rows = 0 THEN
retcode := '1'; -- completes with Warning
errbuf := 'No rows matched the parameters';
END IF;
EXCEPTION
WHEN OTHERS THEN
retcode := '2'; -- completes with Error
errbuf := SUBSTR(SQLERRM, 1, 240);
FND_FILE.PUT_LINE(FND_FILE.LOG, SQLERRM);
FND_FILE.PUT_LINE(FND_FILE.LOG, DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
END MAIN;
END XXCUST_ITEM_EXTRACT_PKG;
/Block 2: check FND_PROGRAM parameter names on your instance
-- Named notation below follows the 12.x package spec. Confirm the names first.
SELECT object_name, overload, position, argument_name, in_out, defaulted
FROM all_arguments
WHERE owner = 'APPS'
AND package_name = 'FND_PROGRAM'
AND object_name IN ('EXECUTABLE', 'REGISTER', 'PARAMETER', 'ADD_TO_GROUP', 'INCOMPATIBILITY')
ORDER BY object_name, overload, position;Block 3: register executable, program, parameters, request group, incompatibility
BEGIN
FND_PROGRAM.EXECUTABLE(
executable => 'XX Item Extract CSV',
application => 'XXCUST',
short_name => 'XX_ITEM_EXTRACT',
description => 'XX Item Extract CSV',
execution_method => 'PL/SQL Stored Procedure',
execution_file_name => 'XXCUST_ITEM_EXTRACT_PKG.MAIN');
FND_PROGRAM.REGISTER(
program => 'XX Item Extract CSV',
application => 'XXCUST',
enabled => 'Y',
short_name => 'XX_ITEM_EXTRACT',
description => 'XX Item Extract CSV',
executable_short_name => 'XX_ITEM_EXTRACT',
executable_application => 'XXCUST',
use_in_srs => 'Y',
output_type => 'TEXT');
FND_PROGRAM.PARAMETER(
program_short_name => 'XX_ITEM_EXTRACT',
application => 'XXCUST',
sequence => 10,
parameter => 'P_from_date',
description => 'from_date',
enabled => 'Y',
value_set => 'FND_STANDARD_DATE',
required => 'N',
display => 'Y',
display_size => 11,
description_size => 50,
concatenated_description_size => 25,
prompt => 'from_date');
FND_PROGRAM.PARAMETER(
program_short_name => 'XX_ITEM_EXTRACT',
application => 'XXCUST',
sequence => 20,
parameter => 'P_item_prefix',
description => 'item_prefix',
enabled => 'Y',
value_set => '15 Characters',
required => 'Y',
display => 'Y',
display_size => 15,
description_size => 50,
concatenated_description_size => 25,
prompt => 'item_prefix');
FND_PROGRAM.ADD_TO_GROUP(
program_short_name => 'XX_ITEM_EXTRACT',
program_application => 'XXCUST',
request_group => 'All Reports',
group_application => 'SQLAP');
-- Delete if no incompatibility is needed. scope is 'Set' or 'Program Only'.
FND_PROGRAM.INCOMPATIBILITY(
program_short_name => 'XX_ITEM_EXTRACT',
application => 'XXCUST',
inc_prog_short_name => 'XX_ITEM_EXTRACT',
inc_prog_application => 'XXCUST',
scope => 'Set');
COMMIT;
END;
/Block 4: the same setup through the forms
System Administrator (or Application Developer) > Concurrent > Program > Executable Executable: XX Item Extract CSV Short Name: XX_ITEM_EXTRACT Application: XXCUST Execution Method: PL/SQL Stored Procedure Execution File Name: XXCUST_ITEM_EXTRACT_PKG.MAIN System Administrator > Concurrent > Program > Define Program: XX Item Extract CSV Short Name: XX_ITEM_EXTRACT Application: XXCUST Executable Name: XX_ITEM_EXTRACT Output Format: Text Parameters: 10 P_from_date (FND_STANDARD_DATE), 20 P_item_prefix (15 Characters) Incompatibilities: XX_ITEM_EXTRACT System Administrator > Security > Responsibility > Request Group: All Reports Application: SQLAP add Program XX Item Extract CSV
Run Block 2 first. The Developer's Guide text for FND_PROGRAM lists some older parameter names (for example executable_name in REGISTER); the 12.x package spec uses executable_short_name and adds short_name to EXECUTABLE. Use whatever ALL_ARGUMENTS shows. Confirm the value set names in FND_FLEX_VALUE_SETS and that the request group exists under that application. The custom application must be registered and its schema granted access by APPS.
Have your concurrent program reviewed
Send the generated package and registration script; we check it against 12.2 online patching standards and your naming conventions.
Optional. The tool and every export work without this. No spam.
How to use it
Enter the custom application short name (registered in Application Developer > Application > Register), package and procedure names, program short and user names, the two parameters with their value sets, and the request group the program should appear in. Compile Block 1 in the APPS schema or in the custom schema with a grant and synonym. Run Block 2 to confirm FND_PROGRAM argument names on your release, then run Block 3 once. Rerunning Block 3 fails because the executable already exists; use FND_PROGRAM.DELETE_PROGRAM and DELETE_EXECUTABLE in a development instance or edit in the forms instead.
- errbuf and retcode must be the first two parameters, in that order
- Parameter sequence numbers in FND_PROGRAM.PARAMETER fix the argument order
- PL/SQL parameters are VARCHAR2 because the manager passes strings
How the manager reads retcode and errbuf
The concurrent manager calls the procedure positionally: errbuf, retcode, then each parameter in sequence order. On return, retcode '0' completes the request Normal, '1' Warning and '2' Error, and errbuf becomes the completion text shown in the Requests window. FND_FILE.PUT_LINE(FND_FILE.LOG, ...) writes to the log file and FND_FILE.OUTPUT to the output file. A date parameter on FND_STANDARD_DATE arrives as a canonical string, so convert it with FND_DATE.CANONICAL_TO_DATE rather than TO_DATE with a guessed mask. The WHEN OTHERS handler sets Error and writes DBMS_UTILITY.FORMAT_ERROR_BACKTRACE so the log shows the failing line.
Worked example
With the defaults, the program XX_ITEM_EXTRACT under XXCUST takes a from date and an item prefix, writes one CSV line per item updated since that date in MTL_SYSTEM_ITEMS_B, ends with Warning if nothing matched, and is incompatible with itself so two runs never overlap. It is added to the All Reports request group under the application you enter (change both defaults to a group your responsibility uses). Submit it from a responsibility using that group, open View Output and save it with a .csv extension. Descriptions are wrapped in double quotes with inner quotes doubled, so commas inside item descriptions do not shift columns.
Version differences and gotchas
Output type TEXT is the right choice for a CSV body: the viewer shows it as text and users save it as .csv. For a true Excel file, register output type XML, write XML to FND_FILE.OUTPUT and attach an XML Publisher template with an Excel output. In 12.2, compile custom objects in the run edition and follow the online patching standards (editioning views, no direct table DDL in APPS). FND_PROGRAM calls must run as APPS. Add the program to a request group the target responsibility actually uses, or users will not find it.
Frequently Asked Questions
What does retcode mean in an Oracle EBS concurrent program?
retcode is the second OUT parameter of a PL/SQL concurrent program. Set it to '0' for Normal completion, '1' for Warning and '2' for Error. errbuf, the first OUT parameter, carries the completion message shown next to the status. If the procedure raises an unhandled exception the request ends in Error with the Oracle error text.
How do I add a concurrent program to a responsibility?
Add it to the request group that the responsibility uses: System Administrator > Security > Responsibility > Request, or FND_PROGRAM.ADD_TO_GROUP with the program short name, program application, request group name and group application. Find the group from FND_RESPONSIBILITY_VL.REQUEST_GROUP_ID joined to FND_REQUEST_GROUPS.
How do I write CSV output from a concurrent program?
Register the program with output type TEXT, write a header and data lines with FND_FILE.PUT_LINE(FND_FILE.OUTPUT, ...), quote text fields and double any inner quotes. Users save the output with a .csv extension. For a proper Excel workbook use XML output with an XML Publisher template instead.
How do I stop two runs of the same program overlapping?
Make the program incompatible with itself: FND_PROGRAM.INCOMPATIBILITY with the same short name as inc_prog_short_name, or add it on the Incompatibilities tab of the Concurrent Program form. The Conflict Resolution Manager then holds the second request in Pending/Standby until the first finishes.
If you want developers and support staff to ask your EBS instance how a program is defined and why a run failed, in plain English on your own servers, we can set that up.
Related Tools
Oracle EBS FND_REQUEST.SUBMIT_REQUEST Code Generator
Fill in user, responsibility, program and arguments and get a PL/SQL block that submits a concurrent request from the database, optionally adds an XML Publisher layout and waits for completion.
Developer ToolsOracle EBS Concurrent Program Parameters and Responsibility SQL Generator
Three SQL queries for any concurrent program: definition and executable, parameters in order with value sets and defaults, and the request groups and responsibilities that can submit it.
OracleOracle EBS Concurrent Program Registration Request Template
A request form that captures everything an EBS developer needs to register a custom concurrent program: executable, execution method, parameters, request group and incompatibilities.
OracleOracle EBS Concurrent Request Phase and Status Reference
Look up every common phase and status combination for a concurrent request, with what it means and the first thing to check.
More Developer Tools tools
See all- Oracle EBS Onhand Quantity SQL Generator
- Oracle EBS BOM Explosion SQL Generator
- Oracle EBS Pending Transactions SQL Generator for Period Close
- Oracle EBS Public PL/SQL API Reference (OM, INV, PO, AP, AR, TCA, FND)
- Oracle EBS Forms Personalization Tables and Trigger Events Reference
- Oracle EBS Forms FRM Error Codes Reference (FRM-92101, FRM-40735)
- Oracle EBS XML Publisher RTF Template Syntax Reference
- Oracle EBS OE_ORDER_PUB.PROCESS_ORDER Script Generator
- Oracle EBS FND_USER_PKG Script Generator (Create User, Add Responsibility, Reset Password)
Keep exploring
Free tools
- Oracle EBS Concurrent Program Registration Request TemplateA request form that captures everything an EBS developer needs to register a custom concurrent program: executable, execution method, parameters, request group and incompatibilities.
- Oracle EBS Concurrent Program Parameters and Responsibility SQL GeneratorThree SQL queries for any concurrent program: definition and executable, parameters in order with value sets and defaults, and the request groups and responsibilities that can submit it.
- Oracle EBS FND_REQUEST.SUBMIT_REQUEST Code GeneratorFill in user, responsibility, program and arguments and get a PL/SQL block that submits a concurrent request from the database, optionally adds an XML Publisher layout and waits for completion.
ERP fixes and how-tos
- How to Register a Custom Concurrent Program in Oracle EBSRegister a custom Oracle EBS concurrent program end to end: build the executable, define the program and parameters, and add it to a request group so users can run it.
- Concurrent request completes with Warning and an FDPSTP messageFix Oracle EBS concurrent requests completing with warning and the FDPSTP post-processing message - check the request log for the real underlying program error before treating this as a display or printing issue.
- How to purge concurrent requests and manager data in Oracle EBSHow to schedule Purge Concurrent Request and/or Manager Data in Oracle EBS: the parameters, what is deleted, what else to purge, and mistakes that slow the system.
Integrations
- How to use ChatGPT with Oracle E-Business SuiteUsing ChatGPT with Oracle E-Business Suite: export vs live access, custom GPT actions over ISG REST, enterprise data controls and when to keep data on-prem.
- How to connect Claude to Oracle E-Business SuiteConnect Claude to Oracle E-Business Suite via MCP, the Anthropic API, AWS Bedrock or Vertex, and know when an on-prem open-weight model is the better fit.