Sunteți pe pagina 1din 13

Run Report From Personalization

Purpose : Run Request From Tools Menu And Get Parameter From Current Record

1. To Get Request Information


A- Login to Oracle Apps with the specified user name and password
B- Navigate to System Administrator Responsibility > Concurrent >Program >Define
Program Parameter
Report Template Information
Application Inventory INV
Program XX LOT Number Label XX-INV-LOT-INFO
Template Name XX-INV-LOT-INFO

2. Login To Oracle Database Using Apps user


- Create Package Or Add this Procedure To Existing Package

Package
Specification CREATE OR REPLACE PACKAGE APPS.XX_RUN_REQUEST
AS
PROCEDURE XX_INV_LOT_INFO
( P_1 number Default Null,
P_2 varchar2 Default Null ,
P_3 varchar2 Default Null ,
P_4 varchar2 Default Null
) ;
END XX_RUN_REQUEST;
Package Body CREATE OR REPLACE PACKAGE BODY APPS.XX_RUN_REQUEST AS
PROCEDURE XX_INV_LOT_INFO
(
-- Calling Request by Personlization
--ERRBUF out VARCHAR2 , RETCODE out NUMBER
/* Parameter For E Business Suit Report Status and Logs ** Don't Use Here
Because that will be Called From Personalization */

--- Report Parameter


P_1 number Default Null ,
P_2 varchar2 Default Null ,
P_3 varchar2 Default Null ,
P_4 varchar2 Default Null
---- Module and Layout Parameter
/*
P_Module_NAME varchar2 ,--default 'INV' ,
P_TEMPLATE_CODE varchar2 ,--default 'XX' ,
P_PROG_SHORT varchar2 --default 'XX'
*/
)
IS

req_id number;
xml_layout boolean;
print_status boolean;
l_return boolean;
typ varchar(10):='Y';
UserName varchar2(255);
x_time boolean;
l_phase varchar2(255);
l_status varchar2(255);
l_dev_phase varchar2(255);
l_dev_status varchar2(255);
l_message varchar2(255);
timestart varchar2(255);

BEGIN
apps.fnd_global.apps_initialize(user_id =>fnd_global.USER_ID ,resp_id
=>fnd_global.RESP_ID ,resp_appl_id =>fnd_global.RESP_APPL_ID);
UserName := fnd_global.user_name;

SELECT SYSDATE + 3 / 1440 INTO timestart FROM DUAL; --> Calc 3 minuts After the
Current sysdate on Varaib;e timestart

IF FND_REQUEST.set_options('NO', 'YES') then --->> appear the Request to


user and protect against update

/*Optionally call before submitting a concurrent request to set request


options.
to appear to user on his concuurent Screen " Concureent Request Form "
first Parmeter implicit
Values NO --> Appear to user
YES --> appear For only system Administrator
ERROR --> Appear Only for user if Ended with Fails
WOrNING --> appear to user only if End with Error or Warning
-------------------------
seconf parameter protected ( Protected Against update )
YES --> Protected
NO --> Not Protected
Third anf FOur to detec the Trritory and language
*/

xml_layout := fnd_request.add_layout ('INV','XX-INV-LOT-INFO','en',NULL,'PDF');


--->

IF( fnd_request.set_print_options('', 'LANDSCAPE', 0, True, 'N'))then -- don't


know what is mean with '' //
-----Add the Printer to the Request Screen under Application Developer
----- if Printer defined under Request Screen , it is Not Changed Through Code
and will Taken '' as the Previous Code
----- Define the LANDSCAPE or PORTRAIT
----- Number of Copies
----- Save Output
----- Print the main Request and sub Request

--- Run Request

req_id := fnd_request.submit_request('INV','XX-INV-LOT-INFO'
,NULL,timestart,FALSE, P_1,P_2,P_3,P_4);

if FND_SUBMIT.SET_REL_CLASS_OPTIONS ('INV', NULL,'H', sysdate +10/1440)then ---


> as Scheduled to run After period 10 minutes
/*

function set_rel_class_options (application IN varchar2 default NULL,


class_name IN varchar2 default NULL,
cancel_or_hold IN varchar2 default 'H',
stale_date IN varchar2 default NULL)
return boolean is
*/
--if req_id<>0 then
--l_return :=fnd_concurrent.wait_for_request (request_id => req_id,
-- INTERVAL => 5,
-- max_wait => 60,
-- phase => l_phase,
-- STATUS => l_status,
-- dev_phase => l_dev_phase,
-- dev_status =>
l_dev_status,
-- MESSAGE => l_message
-- );
--dbms_output.put_line('4');
--end if;
commit;
end if;
end if;
end if;
END;

END XX_RUN_REQUEST;
/

3. Navigate To Inventory > On-hand, Availability> Lots


4. Click Help > Diagnostics > Custom code > Click on the last selection: 'Personalize'
5. Under Conditions tab > Trigger Event = SPECIAL10
6. Set the Context level to User and Value to
--Note: to simplify setup required, you can choose to set the condition context to responsibility.
This would allow you to assign a group of users to a responsibility, then the setup above would
only need completed once at the responsibility level. Otherwise this setup step would be required
for each user.

7. Click to Actions tab and define following actions -


Seq. Type Language Builtin Type Argument
10 Builtin All Execute a 'declare
Procedure P_1 number := '||${ps.mfg_organization_id.value} || ' ;
P_2 varchar2(400) :=
'''||${item.MTL_LOT_NUMBERS.lot_number.value}|| ''';
P_3 varchar2(400) := '''||${item.mtl_lot_numbers.item_name.value}||
''';
P_4 varchar2(400) := '''||${item.mtl_lot_numbers.item_name.value}||
''';
begin
APPS.XX_RUN_REQUEST.XX_INV_LOT_INFO(P_1,P_2,P_3,P_4
);
end'
8.Save the changes.
Add New Line

5. Under Conditions tab > Trigger Event = WHEN-NEW-FORM-INSTANCE


6. Set the Context level to User and Value to
--Note: to simplify setup required, you can choose to set the condition context to responsibility.
This would allow you to assign a group of users to a responsibility, then the setup above would
only need completed once at the responsibility level. Otherwise this setup step would be required
for each user.
7. Click to Actions tab and define following actions -

Seq. Type Language Menu Entry Menu Label


10 Menu All SPECIAL10 Print Lot Label
8.Save the changes.

9.Close The Lots form and re-open it. Now test it.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Test Scenario
1- Open Lots From
View Requests
‫‪Done‬‬ ‫الحمد هلل‬

S-ar putea să vă placă și