# Oracle EBS FND_REQUEST.SUBMIT_REQUEST Code Generator

> Source: https://netray.co/tools/oracle-ebs-fnd-request-submit-request-generator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

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.

## Category

developer

## Erp

Oracle E-Business Suite

## Audience

- PL/SQL developer
- Oracle Apps technical consultant
- EBS administrator

## Tool

**Kind:** template

**Output:** code

**Language:** sql

**Fields:**

#### USER_ID (FND_USER)

**Key:** user_id

**Type:** number

**Default:** 1318

**Help:** SELECT user_id FROM fnd_user WHERE user_name = 'YOURUSER'

#### RESPONSIBILITY_ID

**Key:** resp_id

**Type:** number

**Default:** 20420

**Help:** From FND_RESPONSIBILITY_VL. The responsibility's request group must contain the program.

#### Responsibility APPLICATION_ID

**Key:** resp_appl_id

**Type:** number

**Default:** 1

**Help:** FND_RESPONSIBILITY_VL.APPLICATION_ID for that responsibility.

#### Operating unit ORG_ID

**Key:** org_id

**Type:** number

**Default:** 204

**Help:** Used by MO_GLOBAL.SET_POLICY_CONTEXT and FND_REQUEST.SET_ORG_ID. Delete those two lines for programs that are not multi-org.

#### Program application short name

**Key:** appl

**Type:** text

**Default:** XXCUST

#### Program short name

**Key:** program

**Type:** text

**Default:** XX_OPEN_ORDERS_CSV

**Help:** FND_CONCURRENT_PROGRAMS.CONCURRENT_PROGRAM_NAME, not the user-visible name.

#### Request description

**Key:** description

**Type:** text

**Default:** Submitted from PL/SQL

#### Start time (blank = now)

**Key:** start_time

**Type:** text

**Help:** Format DD-MON-YYYY HH24:MI:SS, for example 23-OCT-2026 02:00:00. Blank becomes NULL, which means run immediately.

#### argument1 (PL/SQL expression)

**Key:** arg1

**Type:** text

**Default:** '204'

**Help:** Quote literals. Use CHR(0) for unused arguments; everything after the first CHR(0) is ignored.

#### argument2

**Key:** arg2

**Type:** text

**Default:** FND_DATE.DATE_TO_CANONICAL(TRUNC(SYSDATE))

#### argument3

**Key:** arg3

**Type:** text

**Default:** 'Y'

#### argument4

**Key:** arg4

**Type:** text

**Default:** CHR(0)

#### argument5

**Key:** arg5

**Type:** text

**Default:** CHR(0)

#### argument6

**Key:** arg6

**Type:** text

**Default:** CHR(0)

#### Layout: template application short name

**Key:** tmpl_appl

**Type:** text

**Default:** XXCUST

**Help:** Delete the ADD_LAYOUT block if the program has no XML Publisher template.

#### Layout: template code

**Key:** tmpl_code

**Type:** text

**Default:** XX_OPEN_ORDERS_CSV

#### Layout: template language

**Key:** tmpl_lang

**Type:** text

**Default:** en

#### Layout: template territory

**Key:** tmpl_terr

**Type:** text

**Default:** US

#### Layout: output format

**Key:** tmpl_format

**Type:** select

**Options:**

- PDF
- EXCEL
- RTF

**Default:** PDF

#### Wait for completion

**Key:** wait

**Type:** select

**Options:**

- Y
- N

**Default:** Y

#### Wait interval (seconds)

**Key:** interval

**Type:** number

**Default:** 15

#### Max wait (seconds, 0 = no limit)

**Key:** max_wait

**Type:** number

**Default:** 1800

**Blocks:**

#### Submit a concurrent request and optionally wait

**Body:** SET SERVEROUTPUT ON
DECLARE
  l_req_id      NUMBER;
  l_layout_ok   BOOLEAN;
  l_done        BOOLEAN;
  l_phase       VARCHAR2(80);
  l_status      VARCHAR2(80);
  l_dev_phase   VARCHAR2(30);
  l_dev_status  VARCHAR2(30);
  l_message     VARCHAR2(2000);
BEGIN
  -- 1. Apps context: user, responsibility, responsibility application
  FND_GLOBAL.APPS_INITIALIZE({{user_id}}, {{resp_id}}, {{resp_appl_id}});

  -- 2. Operating unit (delete both lines for programs that are not multi-org)
  MO_GLOBAL.SET_POLICY_CONTEXT('S', {{org_id}});
  FND_REQUEST.SET_ORG_ID({{org_id}});

  -- 3. XML Publisher layout (delete this block if the program has no template)
  l_layout_ok := FND_REQUEST.ADD_LAYOUT('{{tmpl_appl}}', '{{tmpl_code}}', '{{tmpl_lang}}', '{{tmpl_terr}}', '{{tmpl_format}}');
  IF NOT l_layout_ok THEN
    RAISE_APPLICATION_ERROR(-20001, 'ADD_LAYOUT failed: ' || FND_MESSAGE.GET);
  END IF;

  -- 4. Submit. Arguments are positional VARCHAR2 values in the order of the program parameters.
  l_req_id := FND_REQUEST.SUBMIT_REQUEST(
                application => '{{appl}}',
                program     => '{{program}}',
                description => '{{description}}',
                start_time  => '{{start_time}}',
                sub_request => FALSE,
                argument1   => {{arg1}},
                argument2   => {{arg2}},
                argument3   => {{arg3}},
                argument4   => {{arg4}},
                argument5   => {{arg5}},
                argument6   => {{arg6}});

  IF l_req_id = 0 THEN
    l_message := FND_MESSAGE.GET;
    ROLLBACK;
    RAISE_APPLICATION_ERROR(-20002, 'SUBMIT_REQUEST failed: ' || l_message);
  END IF;

  -- 5. COMMIT is required: the managers only see the FND_CONCURRENT_REQUESTS row after commit
  COMMIT;
  DBMS_OUTPUT.PUT_LINE('Request ID: ' || l_req_id);

  -- 6. Optional wait
  IF '{{wait}}' = 'Y' THEN
    l_done := FND_CONCURRENT.WAIT_FOR_REQUEST(
                request_id => l_req_id,
                interval   => {{interval}},
                max_wait   => {{max_wait}},
                phase      => l_phase,
                status     => l_status,
                dev_phase  => l_dev_phase,
                dev_status => l_dev_status,
                message    => l_message);
    DBMS_OUTPUT.PUT_LINE('Phase/Status: ' || l_phase || ' / ' || l_status);
    DBMS_OUTPUT.PUT_LINE('Dev phase/status: ' || l_dev_phase || ' / ' || l_dev_status);
    IF NOT l_done THEN
      DBMS_OUTPUT.PUT_LINE('Stopped waiting before completion: ' || l_message);
    ELSIF l_dev_status <> 'NORMAL' THEN
      DBMS_OUTPUT.PUT_LINE('Completed with ' || l_dev_status || ': ' || l_message);
    END IF;
  END IF;
END;
/

#### Journal Import (SQLGL / GLLEZL): confirm the parameter order first

**Body:** -- Lists the Journal Import parameters in submission order on YOUR instance.
-- The argumentN positions in the block below must follow column_seq_num order.
SELECT u.column_seq_num,
       u.end_user_column_name,
       u.form_left_prompt,
       u.required_flag,
       u.default_value
FROM   fnd_descr_flex_col_usage_vl u
WHERE  u.application_id = (SELECT application_id FROM fnd_application WHERE application_short_name = 'SQLGL')
AND    u.descriptive_flexfield_name = '$SRS$.GLLEZL'
ORDER  BY u.column_seq_num;

-- Example only: verify for your release against the query above before use.
-- l_run_id is GL_INTERFACE_CONTROL.INTERFACE_RUN_ID for your source and group.
-- l_access_set_id is the data access set (profile GL: Data Access Set, GL_ACCESS_SET_ID).
-- l_req_id := FND_REQUEST.SUBMIT_REQUEST(
--               application => 'SQLGL',
--               program     => 'GLLEZL',
--               description => NULL,
--               start_time  => NULL,
--               sub_request => FALSE,
--               argument1   => TO_CHAR(l_run_id),         -- interface run id (verify)
--               argument2   => TO_CHAR(l_access_set_id),  -- data access set id (verify)
--               argument3   => 'N',                       -- post errors to suspense (verify)
--               argument4   => NULL,                      -- start date (verify)
--               argument5   => NULL,                      -- end date (verify)
--               argument6   => 'N',                       -- create summary journals (verify)
--               argument7   => 'N');                      -- import descriptive flexfields (verify)
-- COMMIT;

**Notes:** Verify on your instance: the program short name and application in FND_CONCURRENT_PROGRAMS_VL, that the responsibility's request group contains the program, the parameter order from the $SRS$ query, and the ADD_LAYOUT template code in XDO_TEMPLATES_B. FND_REQUEST.SET_ORG_ID exists in R12; on 11i remove it. The GLLEZL argument list is an unverified example: build it from the parameter query.

## Content

**Intro:** This generator writes the PL/SQL block that submits an Oracle E-Business Suite concurrent request from the database: apps context, operating unit, optional XML Publisher layout, SUBMIT_REQUEST, COMMIT and an optional WAIT_FOR_REQUEST loop. It targets EBS 12.1 and 12.2 and runs in SQL*Plus or SQL Developer as APPS.

**Sections:**

#### How to use it

**Body:** Enter the USER_ID, RESPONSIBILITY_ID and responsibility APPLICATION_ID the request should run under. The responsibility matters: SUBMIT_REQUEST returns 0 if the program is not in that responsibility's request group. Enter the program application short name and program short name (CONCURRENT_PROGRAM_NAME), then the arguments. Arguments are inserted as PL/SQL expressions, so quote literals ('204'), call functions for dates, and put CHR(0) in every slot after the last real parameter. Fill the layout fields only if the program has an XML Publisher template; otherwise delete that block. Choose whether to wait, then copy the code.

**Bullets:**

- Find IDs: SELECT responsibility_id, application_id FROM fnd_responsibility_vl WHERE responsibility_name = '...'
- Program short name: FND_CONCURRENT_PROGRAMS_VL.CONCURRENT_PROGRAM_NAME
- Parameter order: the $SRS$ query in the second block, pointed at your program
- Run as APPS or a schema with execute on FND_REQUEST and FND_CONCURRENT

#### What each call does

**Body:** FND_GLOBAL.APPS_INITIALIZE sets the user, responsibility and application so the request is owned by a real user and picks up profile values. MO_GLOBAL.SET_POLICY_CONTEXT('S', org_id) and FND_REQUEST.SET_ORG_ID set the operating unit for multi-org programs. FND_REQUEST.ADD_LAYOUT attaches the template and output format and returns a BOOLEAN; it must be called before SUBMIT_REQUEST. SUBMIT_REQUEST returns the request ID, or 0 on failure with the reason on the message stack (read it with FND_MESSAGE.GET). It only inserts the request: nothing runs until you COMMIT. FND_CONCURRENT.WAIT_FOR_REQUEST polls every interval seconds up to max_wait and returns phase, status and the language-independent dev_phase and dev_status (COMPLETE with NORMAL, WARNING or ERROR).

#### Worked example and checking the result

**Body:** With the defaults, the block runs a custom XX_OPEN_ORDERS_CSV program for org 204, passes a canonical date in argument2 and waits up to 30 minutes, polling every 15 seconds. In SQL*Plus you see the request ID and the final dev phase and status. Check the row in the system with SELECT request_id, phase_code, status_code, argument_text, logfile_name, outfile_name FROM fnd_concurrent_requests WHERE request_id = :id. ARGUMENT_TEXT shows exactly what the manager received, which is the quickest way to spot a shifted argument. Which manager runs it depends on manager specialization rules and the program's request type, not on this code; a request in Pending/Standby is usually held by an incompatibility, while Inactive/No Manager means no running manager is specialised to run it.

#### Gotchas

**Body:** Arguments are strings. Dates must be canonical (FND_DATE.DATE_TO_CANONICAL gives YYYY/MM/DD HH24:MI:SS), and value-set validated parameters expect the stored value, not the displayed meaning. Never put a default-NULL argument between real ones: an empty string is a NULL value, while CHR(0) marks the end of the list. Calling SUBMIT_REQUEST inside a running concurrent program with sub_request TRUE needs FND_CONC_GLOBAL.SET_REQ_GLOBALS and the parent pause pattern, which this block does not cover. Do not call WAIT_FOR_REQUEST from inside a request that the same manager queue must run, or you can deadlock the queue.

**Cta:** If you want planners and accountants to start and check EBS requests by asking in plain English on your own servers, we can set that up with read-only defaults and human approval on submissions.

**Faq:**

#### Why does FND_REQUEST.SUBMIT_REQUEST return 0?

**Answer:** Usually the apps context is missing or wrong, the program is not in the responsibility's request group, the program or application short name is misspelt, or the program is disabled. Read FND_MESSAGE.GET straight after the call: it holds the reason. Also check that APPS_INITIALIZE was given the responsibility's own APPLICATION_ID, not the program's.

#### Why is my request not running after SUBMIT_REQUEST?

**Answer:** The request is only an inserted row until you COMMIT, so the managers cannot see it. After commit, a request in Pending/Standby is waiting on an incompatibility, and Inactive/No Manager means no active manager is specialised to run that program. Check the Concurrent Managers form or the phase-status reference.

#### How do I schedule a concurrent program in Oracle Apps from PL/SQL?

**Answer:** Pass start_time as a string in DD-MON-YYYY HH24:MI:SS format for a one-off future run. For repeating schedules, call FND_REQUEST.SET_REPEAT_OPTIONS before SUBMIT_REQUEST, or define the schedule from the Submit Request window, which is easier to maintain and visible to support staff.

#### How do I pass a date parameter?

**Answer:** Use FND_DATE.DATE_TO_CANONICAL(your_date), which produces YYYY/MM/DD HH24:MI:SS, the format FND_STANDARD_DATE and most seeded date value sets expect. Passing TO_CHAR with a session NLS format is the most common cause of invalid date errors in the request log.

## Search terms

fnd_request.submit_request example, concurrent program schedule in oracle apps, submit concurrent program from plsql, fnd_concurrent.wait_for_request, fnd_request.add_layout, concurrent program in oracle ebs, fnd_request.set_org_id, oracle ebs gl batch automation

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
