Wednesday, February 11, 2009

Copying a request Group Content to another request group

Hi All,
Recently i got a requirement to create request and attach all the standard reports of GL to these request groups...it seems a lot tedious task to do manually...so i developed this script to copy the request group content to other request groups..THis is very useful if you have to create multiple requestgroups and attach reports to all,....

declare
cursor z isselect b.CONCURRENT_PROGRAM_NAME PROGRAMNAME,c.APPLICATION_NAME APPNAME from FND_REQUEST_GROUP_UNITS a
,fnd_concurrent_programs b
,fnd_application_tl c
,FND_REQUEST_GROUPS d
where a.request_Group_id=d.request_Group_id and a.REQUEST_UNIT_ID=b.CONCURRENT_PROGRAM_ID
and b.APPLICATION_ID=c.APPLICATION_ID
and d.request_Group_name='GL Concurrent Program Group';
begin
FOR REC IN Z LOOP
FND_PROGRAM.ADD_TO_GROUP(program_short_name =>REC.PROGRAMNAME
,program_application=>REC.APPNAME
,request_group=>'XX_GL_MOCA'
, group_application=>'Custom Application');
END LOOP;
END;

10 comments:

  1. Very good one.

    but I am trying to do this ..
    -----------------------------------
    declare
    cursor z is select b.CONCURRENT_PROGRAM_NAME PROGRAMNAME,c.APPLICATION_NAME APPNAME , d.REQUEST_GROUP_ID , d.REQUEST_GROUP_NAME
    from FND_REQUEST_GROUP_UNITS a
    ,fnd_concurrent_programs b
    ,fnd_application_tl c
    ,FND_REQUEST_GROUPS d
    where a.request_Group_id=d.request_Group_id and a.REQUEST_UNIT_ID=b.CONCURRENT_PROGRAM_ID
    and b.APPLICATION_ID=c.APPLICATION_ID
    and c.APPLICATION_ID = '200'
    and d.request_Group_name='All Reports';
    begin
    FOR REC IN Z LOOP
    FND_PROGRAM.ADD_TO_GROUP(program_short_name =>REC.PROGRAMNAME
    ,program_application=>REC.APPNAME
    ,request_group=>'HTI Entry Payables Reports'
    , group_application=>'Payables');
    END LOOP;
    END;
    ----------------------------------

    I am getting errors -

    ORA-00001: unique constraint (APPLSYS.FND_REQUEST_GROUP_UNITS_U1) violated
    ORA-06512: at "APPS.FND_PROGRAM", line 1365
    ORA-06512: at line 12
    -----------------------------------

    Can you plz help me out ...

    ReplyDelete
  2. Hii
    My Name is Varun, Today we are going live and I just noticed that FNDLOAD failed for our custom request groups. Thanks to this scripts, it saved the day.

    ReplyDelete
  3. Hi Raj,
    I too got the same error. Please add the condition of language in the cursor as
    and c.language = 'US';

    It worked for me, hope to you too.

    Take care

    Regards,Afzal.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Thanks for the script! great help!

    ReplyDelete
  7. declare
    cursor CUR_DATA is
    select (SELECT CONCURRENT_PROGRAM_NAME FROM fnd_concurrent_programs WHERE CONCURRENT_PROGRAM_ID = A.REQUEST_UNIT_ID AND APPLICATION_ID = A.UNIT_APPLICATION_ID ) PROGRAMNAME,
    (SELECT APPLICATION_NAME FROM FND_APPLICATION_TL WHERE APPLICATION_ID = A.UNIT_APPLICATION_ID) APPNAME
    from FND_REQUEST_GROUP_UNITS a
    ,FND_REQUEST_GROUPS d
    ,FND_APPLICATION C
    where a.request_Group_id=d.request_Group_id
    and D.APPLICATION_ID=c.APPLICATION_ID
    and d.request_Group_name='OLD REQUEST GROUP';
    begin
    FOR REC IN CUR_DATA LOOP
    FND_PROGRAM.add_to_group(REC.PROGRAMNAME, -- Concurrent Program Short Name
    REC.APPNAME , -- Application Short Name
    'NEW REQUEST GROUP NAME HERE', -- Report Group Name WHICH SHOULD BE CREATED IN ORDER TO ATTACH PROGRAMS
    'Receivables'); -- Report Group Application
    COMMIT;
    end loop;
    END;

    ReplyDelete
  8. This script executed without error in our dev environment, but did not update the newly created request group.

    ReplyDelete