Thursday, September 14, 2017

Submit a Concurrent Program/Request from PL/SQL

Oracle has provided the feasibility to submit a concurrent request from backend using "fnd_request.submit_request" API.

Before submitting the API we need to set the environment and this can be done using "fnd_global.apps_initialize"

Here is a sample code to submit a concurrent program from PL/SQL

Note:- This code is to submit a Concurrent Program, not the Request Set. To Submit the Request Set from the backend, We have a different API.

--
DECLARE
   l_responsibility_id     NUMBER;
   l_resp_application_id   NUMBER;
   l_security_group_id     NUMBER;
   l_user_id               NUMBER;
   l_request_id            NUMBER;
BEGIN
   --
   -- Get the apps environment variables --
   --
   SELECT user_id, responsibility_id, responsibility_application_id,
          security_group_id
     INTO l_user_id, l_responsibility_id, l_resp_application_id,
          l_security_group_id
     FROM fnd_user_resp_groups
    WHERE user_id = (SELECT user_id
                       FROM fnd_user
                      WHERE user_name = '&USER_NAME')
      AND responsibility_id =
             (SELECT responsibility_id
                FROM fnd_responsibility_vl
               WHERE responsibility_name = '&RESP_NAME');

   --
   --To set environment context.
   --
   apps.fnd_global.apps_initialize (l_user_id,
                                    l_responsibility_id,
                                    l_resp_application_id
                                   );
   --
   --Submitting Concurrent Request
   --
      l_request_id := 
fnd_request.submit_request(application => 'XXCUST', -- Application Short Name
            program     => 'XX_DEPT_DTLS', -- Program Short Name
            description => 'XX_DESCRIPTION', -- Any Description
            start_time  => SYSDATE, -- Start Time
            sub_request => FALSE, -- Subrequest Default False
            argument1   => 'ARG1' -- Parameters Starting
            );
   --
   COMMIT;

   --
   IF l_request_id = 0
   THEN
      DBMS_OUTPUT.put_line ('Concurrent request failed to submit');
   ELSE
      DBMS_OUTPUT.put_line ('Successfully Submitted the Concurrent Request: '||l_request_id);
   END IF;
   --
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error While Submitting Concurrent Request '
                            || TO_CHAR (SQLCODE)'-'|| SQLERRM
                           );
END;
/

Friday, September 8, 2017

Who Columns in Oracle Apps Table

Standard WHO Columns

The following are the Standard WHO Columns in most of the Oracle tables:

created_by
creation_date
last_update_date
last_updated_by
last_update_login

Use fnd_profile.VALUE ('USER_ID') for retrieving the user_id which will be used by created_by column.

Creation date and last_update_date will be normally SYSDATE.

last_updated_by is same as created_by

Use USERENV ('SESSIONID') for getting the last_update_login id.

Thursday, September 7, 2017

Fetch DYNAMIC/RUNTIME Table Column Name with Values

CREATE TABLE APPS.STUDENT
(
ID_T NUMBER,
NAME_T VARCHAR2(50 BYTE),
MARK_T NUMBER

)

select * from student

ID_T NAME_T MARK_T
1 chidam 100
2 div 200
3 aksh 300


PLSQL Scripts

declare
  --v1.1 added
  l_cur    number;
  l_dtbl   dbms_sql.desc_tab;
  l_cnt    number;
  l_status number;
  l_val    varchar2(200);
begin
  l_cur := dbms_sql.open_cursor;
  dbms_sql.parse(l_cur, 'SELECT * from student', dbms_sql.native);
  dbms_sql.describe_columns(l_cur, l_cnt, l_dtbl);
  for i in 1 .. l_cnt
  loop
    dbms_sql.define_column(l_cur, i, l_val, 240);
  end loop;
  l_status := dbms_sql.execute(l_cur);
  while (dbms_sql.fetch_rows(l_cur) > 0) loop
    for i in 1 .. l_cnt loop
      dbms_sql.column_value(l_cur, i, l_val);
      dbms_output.put_line(l_dtbl(i).col_name || ' --> ' || l_val);
    end loop;
  end loop;
  dbms_sql.close_cursor(l_cur);
end;




OUTPUT

ID_T --> 1
NAME_T --> chidam
MARK_T --> 100

ID_T --> 2
NAME_T --> div
MARK_T --> 200

ID_T --> 3
NAME_T --> aksh
MARK_T --> 300

Monday, May 8, 2017

Queries for Value Sets

Value Sets based on table:

This Query gives details of value sets that are based on a oracle application tables.

select ffvs.flex_value_set_id,
       ffvs.flex_value_set_name,
       ffvs.description set_description,
       ffvs.validation_type,
       ffvt.value_column_name,
       ffvt.meaning_column_name,
       ffvt.id_column_name,
       ffvt.application_table_name,
       ffvt.additional_where_clause
  FROM fnd_flex_value_sets ffvs, fnd_flex_validation_tables ffvt
 WHERE ffvs.flex_value_set_id = ffvt.flex_value_set_id
   AND ffvs.flex_value_set_name = 'XXX_COUNTRY_VS'

Independent Value set Details:

This query gives details of independent FND Value sets i.e. Values are static and these are not derived from any application table.


SELECT ffvs.flex_value_set_id,
       ffvs.flex_value_set_name,
       ffvs.description         set_description,
       ffvs.validation_type,
       ffv.flex_value_id,
       ffv.flex_value,
       ffvt.flex_value_meaning,
       ffvt.description         value_description
  FROM fnd_flex_value_sets ffvs,
       fnd_flex_values     ffv,
       fnd_flex_values_tl  ffvt
 WHERE ffvs.flex_value_set_id = ffv.flex_value_set_id
   and ffv.flex_value_id = ffvt.flex_value_id
   AND ffvt.language = USERENV('LANG')
   AND ffvs.flex_value_set_name = 'XXX_COUNTRY_VS'

Wednesday, May 3, 2017

WebADI Upload Download Command

WebADI LDT Command :-

  1. Download è FNDLOAD apps/<password> 0 Y DOWNLOAD $BNE_TOP/patch/115/import/bneintegrator.lct XX_TST_1_XINTG.ldt BNE_INTEGRATORS INTEGRATOR_ASN=XXINV INTEGRATOR_CODE=XX_TST_1_XINTG

  1. Upload è FNDLOAD apps/<password> 0 Y UPLOAD $BNE_TOP/patch/115/import/bneintegrator.lct XX_TST_1_XINTG.ldt


Form Function LDT Command :-

  1. Download è FNDLOAD apps/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XXINV_SSM_ITEM_UPL_WADI.ldt FUNCTION FUNCTION_NAME="XXINV_SSM_ITEM_UPL_WADI"


  1. Upload è FNDLOAD apps/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XXINV_SSM_ITEM_UPL_WADI.ldt

Thursday, April 6, 2017

LDT Download/Upload Commands in Oracle Apps

1. To download Ldt file for a Concurent Program
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct file_name.ldt PROGRAM APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' CONCURRENT_PROGRAM_NAME='[Concurrent program Short Name]'

      Above command downloads the executable information and Value Sets associated to the program.
2. To download Ldt file for a Data Definition
FNDLOAD [username]/[password] O Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct file_name.ldt XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' DATA_SOURCE_CODE='[Data Definition Short Name]'

      Above command downloads the template definition too.
3. To download Ldt file for a Request Set
FNDLOAD [username]/[password] 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt REQ_SET REQUEST_SET_NAME='[REQUEST_SET_SHORT_NAME]'

      Make sure we run the below command too.
4. To download Ldt file for a Request Set Links
FNDLOAD [username]/[password] 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt REQ_SET_LINKS REQUEST_SET_NAME='[REQUEST_SET_SHORT_NAME]'
5. To download Ldt file for a Lookup Up
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct file_name.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' LOOKUP_TYPE='[LOOKUP_TYPE]'
6. To download Ldt file for a request group for a Concurrent Program
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt REQUEST_GROUP REQUEST_GROUP_NAME='[REQUEST_GROUP_NAME]' APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' REQUEST_GROUP_UNIT UNIT_APP='[UNIT_APPLICATION_SHORT_NAME]' UNIT_TYPE='P' UNIT_NAME='[Concurrent program Short Name]'

7. To download Ldt file for a request group for a Request Set
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt REQUEST_GROUP REQUEST_GROUP_NAME='[REQUEST_GROUP_NAME]' APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' REQUEST_GROUP_UNIT UNIT_APP='[UNIT_APPLICATION_SHORT_NAME]' UNIT_TYPE='S' UNIT_NAME='[Request Set Name]'
8. To download Ldt file for a Value Set
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt VALUE_SET FLEX_VALUE_SET_NAME='[VALUE_SET_NAME]'
9. To download Ldt file for a Value Set with values
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt VALUE_SET_VALUE FLEX_VALUE_SET_NAME='[VALUE_SET_NAME]'
10. To download Ldt file for a DFF
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt DESC_FLEX APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' DESCRIPTIVE_FLEXFIELD_NAME='[flex field Name]' P_CONTEXT_CODE='[Context Code]'
11. To download Ldt file for a DFF for a particular attribute column
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt DESC_FLEX APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' DESCRIPTIVE_FLEXFIELD_NAME='[flex field Name]' DESCRIPTIVE_FLEX_CONTEXT_CODE='[Context Code]' END_USER_COLUMN_NAME='[Attribute Column Name]' APPLICATION_COLUMN_NAME='[attribute column number]'
12. To download Ldt file for a profile Option
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct file_name.ldt PROFILE PROFILE_NAME='[PROFILE_OPTION_NAME]' APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]'
13. To download Ldt file for a Audit Group
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/affaudit.lct file_name.ldt FND_AUDIT_GROUPS APPLICATION_SHORT_NAME='[APPLICATION_SHORT_NAME]' GROUP_NAME = '[Audit Group Name]'
14. To download Ldt file for a Audit Schema
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/affaudit.lct file_name.ldt FND_AUDIT_SCHEMAS ORACLE_USERNAME='ORACLE_USERNAME' APPLICATION_SHORT_NAME='APPLICATION_SHORT_NAME'
15. To download Ldt file for a Responsibility
FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct file_name.ldt FND_RESPONSIBILITY RESP_KEY="[Responsibility Name]"

1. To upload Ldt file for a Concurent Program
FNDLOAD [username]/[password]' O Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct file_name.ldt
2. To upload Ldt file for a Data Definition
FNDLOAD [username]/[password] O Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct file_name.ldt
3. To upload Ldt file for a Request Set
FNDLOAD [username]/[password] 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt
4. To upload Ldt file for a Request Set Links
FNDLOAD [username]/[password] 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt
5. To upload Ldt file for a Lookup Up
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct file_name.ldt
6. To upload Ldt file for a request group for a Concurrent Program
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt
7. To upload Ldt file for a request group for a Request Set
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt
8. To upload Ldt file for a Value Set
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt
9. To upload Ldt file for a Value Set with values
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt
10. To upload Ldt file for a DFF
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt
11. To upload Ldt file for a DFF for a particular attribute column
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt
12. To upload Ldt file for a profile Option
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct file_name.ldt
13. To upload Ldt file for a Audit Group
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/affaudit.lct file_name.ldt
14. To upload Ldt file for a Audit Schema
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/affaudit.lct file_name.ldt
15. To upload Ldt file for a Responsibility
FNDLOAD [username]/[password] O Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct file_name.ldt

Tuesday, December 6, 2016

Enable Trace for Concurrent Programs in R12

Tracing the Concurrent program is very good option to Debug any issue while running the concurrent program.

Goal :
To enable the Trace for Concurrent Programs
To Debug the issues in Concurrent Programs or its dependent objects.
Solution :
1. Goto Concurrent Program Definition

Application Developer –> Concurrent –> Program –>
check Enable Trace
Query your concurrent program and check the Enable Trace check box at the bottom of the screen.
2. Set the Profile Concurrent: Allow Debugging to YES.
3. Navigate to the Responsibility from where you are running the program.
4. Before Submitting the Concurrent Program in Submit Request screen there will be an option like Debug Options click on that button.
5. In the Debug Options select the SQL Trace and enable Trace with binds.

6. Submit the Concurrent Program and note down the Request id.
7.Trace file name will always be post fixed with oracle_process_id.To get the oracle_process_id use the below SQL
Select oracle_process_id from fnd_concurrent_requests where request_id= &Request_id;
8.And the Trace file path can be derived using the below SQL
Select * from v$parameter where name=’user_dump_dest’;
9. Get the trace file to your local machine.Understanding the raw trace is very complex so use TKPROF utility to make the Trace file readable.
10. Open the Command Prompt and run the below command
TKPROF < Trace File_Name.trc> <Output_File_Name.out> SORT=fchela
11.A new outfile will be generated with the name given in the above command.Analyse the Output file to know the answers for your problem.
Sql queries to find the log files by Request id


select req.oracle_process_id             tracename,
       req.request_id,
       req.requested_by,
       usr.user_name,
       prog.user_concurrent_program_name,
       req.request_date,
       req.phase_code,
       req.status_code,
       req.logfile_name,
       req.outfile_name,
       dest.value                        as user_dump_dest
  from apps.                           fnd_concurrent_requests req,
       gv$parameter                    dest,
       apps.fnd_concurrent_programs_vl prog,
       apps.fnd_user                   usr
 where req. concurrent_program_id = prog.concurrent_program_id
   and req.requested_by = usr.user_id –and
 request_id like '6013239'
   and dest.name = 'user_dump_dest'
   and request_id like &Request_id;
   
   
Sql query find the log files by username


  select req.oracle_process_id             tracename,
         req.request_id,
         req.requested_by,
         usr.user_name,
         prog.user_concurrent_program_name,
         req.request_date,
         req.phase_code,
         req.status_code,
         req.logfile_name,
         req.outfile_name,
         dest.value                        as user_dump_dest
    from apps.                           fnd_concurrent_requests req,
         gv$parameter                    dest,
         apps.fnd_concurrent_programs_vl prog,
         apps.fnd_user                   usr
   where req. concurrent_program_id = prog.concurrent_program_id
     and req.requested_by = usr.user_id –and
   request_id like '6013239'
     and dest.name = ‘user_dump_dest’
     and usr.user_name like ‘Ramesh%G%’
   order by request_date desc
             Select oracle_process_id
               from fnd_concurrent_requests
              where request_id = &Request_id;


select *
  from apps.        fnd_concurrent_requests req,
       gv$parameter dest,
       apps        .fnd_concurrent_programs_vl prog
 where req. concurrent_program_id = prog.concurrent_program_id
   and request_id like '601300%'
   and dest.name = 'user_dump_dest'

Customer Tax Registration - EBS Query

              SELECT DISTINCT  hp.party_type, hp.party_name, hca.account_name, hp.party_number, hps.party_site_number, ...