Write The code in Report Button using Trigger
WHEN-BUTTON-PRESSED
DECLARE
ln_request_id NUMBER;
lc_boolean BOOLEAN;
BEGIN
IF :xxopm_wr_hdr.WORK_REQUEST_NO IS NULL
THEN
fnd_message.DEBUG ('WORK REQUEST NO is blank.!!! Printing is not possible');
RAISE form_trigger_failure;
END IF;
--Set Layout
lc_boolean :=
fnd_request.add_layout (
template_appl_name => 'XXCUST', -- Template Application Short Name
template_code => 'XXOPM_WRRPT', -- Template Code
template_language => 'en', -- Use language from template definition
template_territory => 'US', -- Use territory from template definition
output_format => 'PDF' -- Use output format from template definition
);
ln_request_id :=
fnd_request.submit_request
('XXCUST', -- Application Short Name
'XXOPM_WRRPT', -- Program Short Name
'Work Request Report', -- Description
Sysdate, -- Start Time
FALSE, -- Sub Request
:XXOPM_WR_HDR.WORK_REQUEST_NO -- User Parameter used in Report.
);
COMMIT;
FND_MESSAGE.DEBUG ('Request Submitted Successfully.!!! with '||:xxopm_wr_hdr.WORK_REQUEST_NO);
EXCEPTION WHEN NO_DATA_FOUND THEN
FND_MESSAGE.DEBUG ('Concurrent request failed to submit BEACUSE NO DATA FOUND');
IF ln_request_id = 0
THEN
FND_MESSAGE.DEBUG ('Concurrent request failed to submit');
ELSE FND_MESSAGE.DEBUG ('Request Submitted Successfully.!!!');
END IF;
END;
WHEN-BUTTON-PRESSED
DECLARE
ln_request_id NUMBER;
lc_boolean BOOLEAN;
BEGIN
IF :xxopm_wr_hdr.WORK_REQUEST_NO IS NULL
THEN
fnd_message.DEBUG ('WORK REQUEST NO is blank.!!! Printing is not possible');
RAISE form_trigger_failure;
END IF;
--Set Layout
lc_boolean :=
fnd_request.add_layout (
template_appl_name => 'XXCUST', -- Template Application Short Name
template_code => 'XXOPM_WRRPT', -- Template Code
template_language => 'en', -- Use language from template definition
template_territory => 'US', -- Use territory from template definition
output_format => 'PDF' -- Use output format from template definition
);
ln_request_id :=
fnd_request.submit_request
('XXCUST', -- Application Short Name
'XXOPM_WRRPT', -- Program Short Name
'Work Request Report', -- Description
Sysdate, -- Start Time
FALSE, -- Sub Request
:XXOPM_WR_HDR.WORK_REQUEST_NO -- User Parameter used in Report.
);
COMMIT;
FND_MESSAGE.DEBUG ('Request Submitted Successfully.!!! with '||:xxopm_wr_hdr.WORK_REQUEST_NO);
EXCEPTION WHEN NO_DATA_FOUND THEN
FND_MESSAGE.DEBUG ('Concurrent request failed to submit BEACUSE NO DATA FOUND');
IF ln_request_id = 0
THEN
FND_MESSAGE.DEBUG ('Concurrent request failed to submit');
ELSE FND_MESSAGE.DEBUG ('Request Submitted Successfully.!!!');
END IF;
END;
No comments:
Post a Comment