Tuesday, January 25, 2022

how to get Responsibility used by Concurrent Request Id

##how to get Responsibility  used by Concurrent Request Id.###

####Provide the Concurrent Program Request_ID  as input###


select c.request_id, r.responsibility_name

from fnd_responsibility_vl r, fnd_concurrent_requests c

where c.request_id = 106765679

and c.responsibility_application_id = r.application_id

and c.responsibility_id = r.responsibility_id




####SQL to get Concurrent Request ID for a Concurrent Program###



SELECT a.REQUEST_ID,d.user_concurrent_program_name FROM  APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_programs c,APPLSYS.fnd_concurrent_programs_tl d  

where  a.program_application_id = d.application_id

and a.concurrent_program_id = c.concurrent_program_id

and a.program_application_id = c.application_id 


and d.user_concurrent_program_name like 'NAPP Missing Access Key%'



####SQL to get the details of the Scheduled Concurrrent Programs #####

SELECT fcr.request_id,

       DECODE(fcpt.user_concurrent_program_name,

              'Report Set',

              'Report Set:' || fcr.description,

              fcpt.user_concurrent_program_name) CONC_PROG_NAME,

       argument_text PARAMETERS,

       NVL2(fcr.resubmit_interval,

            'PERIODICALLY',

            NVL2(fcr.release_class_id, 'ON SPECIFIC DAYS', 'ONCE')) PROG_SCHEDULE_TYPE,

       DECODE(NVL2(fcr.resubmit_interval,

                   'PERIODICALLY',

                   NVL2(fcr.release_class_id, 'ON SPECIFIC DAYS', 'ONCE')),

              'PERIODICALLY',

              'EVERY ' || fcr.resubmit_interval || ' ' ||

              fcr.resubmit_interval_unit_code || ' FROM ' ||

              fcr.resubmit_interval_type_code || ' OF PREV RUN',

              'ONCE',

              'AT :' ||

              TO_CHAR(fcr.requested_start_date, 'DD-MON-RR HH24:MI'),

              'EVERY: ' || fcrc.class_info) PROG_SCHEDULE,

       fu.user_name USER_NAME,

       requested_start_date START_DATE

  FROM apps.fnd_concurrent_programs_tl fcpt,

       apps.fnd_concurrent_requests    fcr,

       apps.fnd_user                   fu,

       apps.fnd_conc_release_classes   fcrc

 WHERE fcpt.application_id = fcr.program_application_id

   AND fcpt.concurrent_program_id = fcr.concurrent_program_id

   AND fcr.requested_by = fu.user_id

   AND fcr.phase_code = 'P'

   AND fcr.requested_start_date > SYSDATE

   AND fcpt.LANGUAGE = 'US'

   AND fcrc.release_class_id(+) = fcr.release_class_id


   AND fcrc.application_id(+) = fcr.release_class_app_id;


### Sql Query to get Concurrent program name and its parameter 


SELECT fcpl.user_concurrent_program_name     , 

               fcp.concurrent_program_name     , 

               par.end_user_column_name     , 

               par.form_left_prompt prompt     , 

               par.enabled_flag     , 

               par.required_flag     , 

               par.display_flag

FROM   fnd_concurrent_programs fcp     , 

              fnd_concurrent_programs_tl fcpl     , 

              fnd_descr_flex_col_usage_vl par

WHERE  fcp.concurrent_program_id = fcpl.concurrent_program_id

     AND  fcpl.user_concurrent_program_name = &conc_prg_name

     AND  fcpl.LANGUAGE = 'US'

     AND  par.descriptive_flexfield_name = '$SRS$.' || fcp.concurrent_program_name


Sql Query to get the responsibility name,request group name when request set name as input. 

select frt.responsibility_name,  

         frg.request_group_name,

         frgu.request_unit_type,

         frgu.request_unit_id,

         fcpt.user_request_set_name

From apps.fnd_Responsibility fr,

         apps.fnd_responsibility_tl frt,

         apps.fnd_request_groups frg,

         apps.fnd_request_group_units frgu,

         apps.fnd_request_Sets_tl fcpt

where frt.responsibility_id = fr.responsibility_id

    and frg.request_group_id = fr.request_group_id

    and frgu.request_group_id = frg.request_group_id

    and fcpt.request_set_id = frgu.request_unit_id

    and frt.language = USERENV('LANG')

    and fcpt.language = USERENV('LANG')

    and fcpt.user_request_set_name = '&request_set_name'

 order by 1,2,3,4

**** How to change table rows into column ****

 **** How to change table rows into 1 column  ****


Ex:1

select listagg(aa.name, ',') within group (order by aa.name) from (

SELECT *  

FROM apps.pa_projects_all ppa

where ppa.segment1='15832'

) aa

**** How to change table rows into column  ****

Ex:2

select listagg(aa.name, ',') within group (order by aa.name) from (

SELECT *  

FROM apps.pa_projects_all ppa

where ppa.project_type like '%Admin Support%'

and last_update_date>sysdate-30

) aa

Thursday, January 13, 2022

How To Submit a Concurrent Request from backend

 /*********************************************************

*PURPOSE: To Submit a Concurrent Request from backend    *

*AUTHOR: Shailender Thallam                              *

**********************************************************/

--

DECLARE

l_responsibility_id NUMBER;

l_application_id    NUMBER;

l_user_id            NUMBER;

l_request_id            NUMBER;

BEGIN

  --

  SELECT DISTINCT fr.responsibility_id,

    frx.application_id

     INTO l_responsibility_id,

    l_application_id

     FROM apps.fnd_responsibility frx,

    apps.fnd_responsibility_tl fr

    WHERE fr.responsibility_id = frx.responsibility_id

  AND LOWER (fr.responsibility_name) LIKE LOWER('XXTest Resp');

  --

   SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = 'ENTER YOUR USER NAME';

  --

  --To set environment context.

  --

  apps.fnd_global.apps_initialize (l_user_id,l_responsibility_id,l_application_id);

  --

  --Submitting Concurrent Request

  --

  l_request_id := fnd_request.submit_request ( 

                            application   => 'XXCUST', 

                            program       => 'XXEMP', 

                            description   => 'XXTest Employee Details', 

                            start_time    => sysdate, 

                            sub_request   => FALSE,

    argument1     => 'Smith'

  );

  --

  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');

  END IF;

  --

EXCEPTION

WHEN OTHERS THEN

  dbms_output.put_line('Error While Submitting Concurrent Request '||TO_CHAR(SQLCODE)||'-'||sqlerrm);

END;

/