FND_CONCURRENT.WAIT_FOR_REQUEST
When running a large report in the concurrent manager through a PL/SQL Procedure.
The concurrent manager appears to indicate that the request has completed normally however only the first step has completed and the XML Report Publisher portion has not yet completed.
I think this lies in an issue with the API FND_CONCURRENT.WAIT_FOR_REQUEST because it does not wait for the XML Publisher portion to complete.
Please advise.
We had a similar issue where the conc request log was saying that the post processing had started and finished at certain times but if we viewed the OPP log we saw that the times were entirely different and the post processing hadn't really finished when the conc request said it did.
An SR with oracle support resulted in us applying patch 5473035 and this seems to have solved the problem.
Similar Messages
-
Hi All,
In one of our custom module, I am facing one issue with the fnd_concurrent.wait_for_request. I am calling one custom function through the ‘Workflow Background Process’. This function is submitting a concurrent program using fnd_request.submit_request which in turn submitting two other concurrent programs in the same way. Now all jobs are completing successfully but it is not working as expected.
I am calling fnd_concurrent.wait_for_request in the custom function after submitting the concurrent program with a maximum wait of 200 seconds. But the phase and status returning is RUNNING and NORMAL respectively even if it has completed successfully. I am raising the exception when phase and status not equal to COMPLETED and NORMAL respectively and it is getting into that exception which won't happen idealy. I have even tried to pass maximum wait as 0, at that time the first program is running for a long time and not even completing.
Can anyone help me resolving this issue.
Thanks in advance.
Regards,
Charls K VHi Charls,
I have successfully implemented at our end in 11i. Pl.try at your end.
v_request_id := FND_REQUEST.SUBMIT_REQUEST (passed your arguments... );
COMMIT;
IF NVL( v_request_id , 0 ) = 0 THEN
DBMS_OUTPUT.PUT_LINE( 'Item Assignment to Organization Program Not Submitted');
p_status := 'FAILURE' ;
p_err_msg := 'ERROR RAISED AFTER SUBMITTING THE IMPORT ITEM ORG.ASSIGNMENT CONCURRENT REQUEST ... ' ;
ELSE
v_finished := FND_CONCURRENT.WAIT_FOR_REQUEST
request_id => v_request_id,
interval => 0,
max_wait => 0,
phase => v_phase,
status => v_status,
dev_phase => v_request_phase,
dev_status => v_request_status,
message => v_message
LOOP
EXIT WHEN ( UPPER(v_request_phase) = 'COMPLETE' OR v_phase = 'C');
END LOOP;
HTH
Sanjay -
Supplier Open Interface Errors
I created an supplier interface in plsql. Want I want to do is kick off the following concurrent programs from pl/sql using fnd_request.submit_request
Supplier Open Interface Import
Supplier Sites Open Interface Import
Now when I run the pl/sql without the call to the fnd_submit, then run the concurrent programs through the app in Payables Manager, it works fine. BUT when I add the fnd_submit call, it executes fine but there is a weird error dealing with reports. Now this seems like some kind of privilege thing maybe?
Below is my call to FND_SUBMIT and also my initialize. Also is the error. Ideas on what is up?
Maybe it is because the code is in a custom schema and not under apps??
APPS.fnd_global.apps_initialize(user_id =>'0'
,resp_id =>'50517'
,resp_appl_id =>'200');
v_header_req := APPS.FND_REQUEST.submit_request( application => 'SQLAP',
program => 'APXSUIMP');
v_site_req := APPS.FND_REQUEST.submit_request( application => 'SQLAP',
program => 'APXSSIMP');
Payables: Version : 12.0.0
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
APXSSIMP module: Supplier Sites Open Interface Import
Current system time is 24-MAR-2009 16:52:02
+-----------------------------
| Starting concurrent program execution...
+-----------------------------
APPLLCSP Environment Variable set to :
Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
American_America.UTF8
Enter Password:
MSG-00001: After SRWINIT
MSG-00002: After Get_Company_Name
MSG-00003: After Get_NLS_Strings
MSG-00004: After Importing Suppliers
REP-1419: 'beforereport': PL/SQL program aborted.
REP-0069: Internal error
REP-57054: In-process job terminated:Terminated with error:
REP-1419: MSG-00001: After SRWINIT
MSG-00002: After Get_Company_Name
MSG-00003: After Get_NLS_Strings
MSG-00004: After Importing Suppliers
REP-1419: 'beforereport': PL/SQL program aborted.
Report Builder: Release 10.1.2.2.0 - Production on Tue Mar 24 16:52:06 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Start of log messages from FND_FILE
End of log messages from FND_FILE
Program exited with status 1
Concurrent Manager encountered an error while running Oracle*Report for your concurrent request 370808.
Review your concurrent request log and/or report output file for more detailed information.
Executing request completion options...
Finished executing request completion options.
Concurrent request completed
Current system time is 24-MAR-2009 16:52:07Hello Jason,
We have done somewhat the same, I see you dont add any arguments in the submit request call.
Maybe all below is already known, maybe it helps you to find just what is wrong in your case.
We did it this way:
l_id := fnd_request.submit_request( application => 'SQLAP'
+, program => p_name+
+, description => null+
+, start_time => null+
+, sub_request => null--fnd_global.conc_request_id+
+, argument1 => 'APXSUIMP'+
+, argument2 => 'ALL'+
+, argument3 => 1000+
+, argument4 => 'N'+
+, argument5 => 'N'+
+);+
After this we immediately execute a commit (as this will trigger the request start).
After that we also wait for the request to finish by doing the following:
if fnd_concurrent.wait_for_request
+( l_request_id+
+, 2 --interval+
+, 0 --max_wait+
+, l_phase --phase+
+, l_status --status+
+, l_dev_phase --dev_phase+
+, l_dev_status --dev_status+
+, l_message )+
then ...
Hope this helps,
Mark -
Issue in Java concurrent program for Digital Signature Stamping
Hi All,
Im calling a Java concurrent program which does digital signature stamping on the PDF report generated.Program able to able to read the PDF file as input and also digital signature stored as file in the application but
ends in error in create signature method , need help in this regard.
Error:
Parameter 0 is Request id of with out Digital signature file
Parameter 1 is employee id of approver
Parameter:0:99203256
Parameter:1:1414603
$$$$ start query fileinfo with callable statment
programName>>>>>>>>BTPOPORPXML
$$$$ Without digital Signature file Name $$$
$/inst_top/finprod/apps/FINPROD_CPNQERPAAPZP10/logs/appl/conc/out/BTPOPORPXML_99203256_1.PDF
PFX File Reading Start
PFX File Reading Ends
PFX File size is: 6460 Byte size is: 6460
Elements present
java.lang.NullPointerException
at
com.lowagie.text.pdf.PdfSignatureAppearance.getAppearance
(Unknown Source)
at
com.lowagie.text.pdf.PdfSignatureAppearance.preClose
(Unknown Source)
at
com.lowagie.text.pdf.PdfSignatureAppearance.preClose
(Unknown Source)
at com.lowagie.text.pdf.PdfStamper.close(Unknown
Source)
at
btvl.oracle.apps.po.digsig.BTVLDigSign.runProgram
(BTVLDigSign.java:151)
at oracle.apps.fnd.cp.request.Run.main
(Run.java:157)
Edited by: 999033 on May 16, 2013 7:20 PMHi Charls,
I have successfully implemented at our end in 11i. Pl.try at your end.
v_request_id := FND_REQUEST.SUBMIT_REQUEST (passed your arguments... );
COMMIT;
IF NVL( v_request_id , 0 ) = 0 THEN
DBMS_OUTPUT.PUT_LINE( 'Item Assignment to Organization Program Not Submitted');
p_status := 'FAILURE' ;
p_err_msg := 'ERROR RAISED AFTER SUBMITTING THE IMPORT ITEM ORG.ASSIGNMENT CONCURRENT REQUEST ... ' ;
ELSE
v_finished := FND_CONCURRENT.WAIT_FOR_REQUEST
request_id => v_request_id,
interval => 0,
max_wait => 0,
phase => v_phase,
status => v_status,
dev_phase => v_request_phase,
dev_status => v_request_status,
message => v_message
LOOP
EXIT WHEN ( UPPER(v_request_phase) = 'COMPLETE' OR v_phase = 'C');
END LOOP;
HTH
Sanjay -
Is it possible to have custom PL/SQL signoff/logout pages per partner app?
Hello -
We are currently using one OID server as our SSO midtier for an Oracle portal and Oracle EnterpriseOne applications. Following document (342942.1) we have successfully been able to create a customized sign-off/logoff page. However this page defined is the same for all partner application. We would like the ability to send the users to one page if they logoff from the portal, and to another page if they logoff EnterpriseOne. Is there a way to determine which partner app is calling for a logoff, and we could populate the p_done_url variable from there?
Thank you.Why not just wait for the request to complete in your PL/SQL?
function FND_CONCURRENT.WAIT_FOR_REQUEST
(request_id IN number default NULL,
interval IN number default 60,
max_wait IN number default 0,
phase OUT varchar2,
status OUT varchar2,
dev_phase OUT varchar2,
dev_status OUT varchar2,
message OUT varchar2) return boolean;
Trust iguru here.. the users will not notice. -
Problem calling XML Report Publisher from Oracle Reports
Hi,
I'm facing a problem in calling XML Report Publisher from Oracle Reports.
Basically, I'm trying to customise Dunning Letter program. The program which is submitted calls another program. I have customised the second program and added a call to a stored procedure which in turn calls XML Report Publisher.I have created a template and attached it to the second program as well.
The procedure code is as follows.
v_request_id := FND_REQUEST.SUBMIT_REQUEST(application => 'AR'
,program => 'ARDLP_NON_SRS'
,description => 'Dunning Letter Print from Dunning Letter Generate'
,sub_request => FALSE
l_status := fnd_concurrent.WAIT_FOR_REQUEST
( REQUEST_ID => v_request_id,
INTERVAL => 15,
MAX_WAIT => 180,
PHASE => l_phase,
STATUS => l_status_code,
DEV_PHASE => l_dev_phase,
DEV_STATUS => l_dev_status,
MESSAGE => l_message );
v_xml_req_id := FND_REQUEST.submit_request(application => 'XDO',
program => 'XDOREPPB',
argument1 => v_request_id,
argument2 => 'FLS DE AR Dunning Letter Print - German',
argument3 => 603, -- changed 665 -- was 551,
argument4 => NULL,
argument5 => 'N',
argument6 => 'RTF',
argument7 => 'PDF');
Now, there are two problems I'm facing...
1. when the second program('Dunning Letter Print from Dunning Letter Generate') gets called it executes this procedure ... logically the 'Dunning Letter Print from Dunning Letter Generate' should get called twice ... second time from the procedure. Its getting called multiple times .. as many as 15 - 20 times.
2. The Xml Report Publisher program ultimately gets called but its erroring out with the following error:
java.sql.SQLException: No corresponding LOB data found :SELECT L.FILE_DATA FILE_DATA, DBMS_LOB.GETLENGTH(L.FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LANGUAGE DEFAULT_LANGUAGE, B.DEFAULT_TERRITORY DEFAULT_TERRITORY,B.TEMPLATE_TYPE_CODE TEMPLATE_TYPE_CODE, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.START_DATE START_DATE, B.END_DATE END_DATE, B.TEMPLATE_STATUS TEMPLATE_STATUS, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.DS_APP_SHORT_NAME DS_APP_SHORT_NAME, B.DATA_SOURCE_CODE DATA_SOURCE_CODE, L.LOB_TYPE LOB_TYPE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE (L.LOB_TYPE = 'TEMPLATE' OR L.LOB_TYPE = 'MLS_TEMPLATE') AND L.APPLICATION_SHORT_NAME= :1 AND L.LOB_CODE = :2 AND L.APPLICATION_SHORT_NAME = B.APPLICATION_SHORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND ( (L.LANGUAGE = :3 AND L.TERRITORY = :4 ) OR (L.LANGUAGE = :5 AND L.TERRITORY = :6) OR (L.LANGUAGE= B.DEFAULT_LANGUAGE AND L.TERRITORY= B.DEFAULT_TERRITORY ) )
I have checked from database that the XDO_LOBS/ XDO_TEMPLATES_B table has corresponding registration data.
I don't know what's creating the problem.
If anyone has customised the Dunning Letter program before or having any idea about this problem, please help me out ..
Thankssatrajit,
Now I am getting the same error you got, Can you please tell me the solution you found?.
XML Report Publisher 5.0
Updating request description
Waiting for XML request
Retrieving XML request information
Preparing parameters
Process template
--XDOException
java.sql.SQLException: No corresponding LOB data found :SELECT L.FILE_DATA FILE_DATA, DBMS_LOB.GETLENGTH(L.FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LANGUAGE DEFAULT_LANGUAGE, B.DEFAULT_TERRITORY DEFAULT_TERRITORY,B.TEMPLATE_TYPE_CODE TEMPLATE_TYPE_CODE, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.START_DATE START_DATE, B.END_DATE END_DATE, B.TEMPLATE_STATUS TEMPLATE_STATUS, B.USE_ALIAS_TABLE USE_ALIAS_TABLE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE L.LOB_TYPE = :1 AND L.APPLICATION_SHORT_NAME= :2 AND L.LOB_CODE = :3 AND L.APPLICATION_SHORT_NAME = B.APPLICATION_SHORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND ( (L.LANGUAGE = :4 AND L.TERRITORY = :5 ) OR (L.LANGUAGE = :6 AND L.TERRITORY = :7) OR (L.LANGUAGE= B.DEFAULT_LANGUAGE AND L.TERRITORY= B.DEFAULT_TERRITORY ) )
at oracle.apps.xdo.oa.schema.server.TemplateInputStream.initStream(TemplateInputStream.java:309)
at oracle.apps.xdo.oa.schema.server.TemplateInputStream.<init>(TemplateInputStream.java:187)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.getTemplateFile(TemplateHelper.java:776)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:1269)
at oracle.apps.xdo.oa.cp.JCP4XMLPublisher.runProgram(JCP4XMLPublisher.java:807)
at oracle.apps.fnd.cp.request.Run.main(Run.java:148) -
I am having a parent program which fires the child process.
I want the parent program to wait until all the child program are completed.
for this i have written this code.
from the curosr c1 i am taking all the child processes.
Now when i am putting the exit condition(EXIT WHEN J = V_COUNT1) in the for loop then
everything is working fine and parent program completes only after all
the child processes are completed.
but when i am not putting this condition the parent program does not complete it remains in the loop
i dont understand why?
declare
cursor c1 is
SELECT fcr.request_id
FROM
fnd_concurrent_programs fcp,
fnd_concurrent_requests fcr
WHERE
fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcp.concurrent_program_name LIKE 'WSHRDPIK' -- name of the pick slip report
AND fcr.request_id > (SELECT max(fcr.request_id)
FROM fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp
WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcp.concurrent_program_name LIKE 'OAI_PROCESS_SHIPMENTS')
AND phase_code NOT LIKE 'C'
AND requested_by IN (SELECT user_id
FROM fnd_user
WHERE user_name LIKE 'MAKANIV');
BEGIN
open c1;
FETCH c1 Bulk Collect into v_count;
close c1;
v_count1 := v_count.count;
for i in v_count.first..v_count.last loop
v_success := FND_CONCURRENT.GET_REQUEST_STATUS(v_count(i)
,NULL
,NULL
,v_phase
,v_status
,v_dev_phase
,v_dev_status
,v_message);
WHILE v_dev_phase != 'COMPLETE'
LOOP
v_success:= FND_CONCURRENT.WAIT_FOR_REQUEST(v_count(i)
,2
,10
,v_phase
,v_status
,v_dev_phase
,v_dev_status
,v_message);
EXIT WHEN v_dev_phase = 'COMPLETE';
END LOOP;
-- J:= J + 1;
-- EXIT WHEN J = V_COUNT1;
END loop;
END;Dear Salvatore,
Have you opened the CURSOR ??
Try the following :
=============================================
declare
cursor C1 (INPUT_VAR in number) is select column1 from table where column2 =INPUT_VAR ;
begin
for I in C1 (1111) Loop --- you can try any number
dbms_output.put_line(I.ID) ;
end loop;
end ;
=============================================
Bst Rgds ,
Franco Lin
I am new to this forum, and new to PL/SQL. I am writing my first larger project that will be in part implemented with PL/SQL. I have a simple cursor that sound like that:
CURSOR name
IS
SELECT column1
FROM table
WHERE column2 = PL/SQL-variable;
When I run this Function the SELECT returns nothing. When I make the same SELECT from SQL*PLUS I receive 1 row.
I have checked the variable via dbms_output.put_line, and make the mentioned SELECT with it.
Has anyone a solution for this?
Thanks in advance for any help.
Regards
Salvatore Cagliari
null -
R12 Supplier Open Interface issue- Supplier Sites Rolling up to address
I am doing a supplier conversion, and when I do...the sites roll up to the address. You look at the address book and the sites with the same address roll up. I don't want this.
We want a one-to-one relationship. One site, one address...no matter if it is the same or not. Is there a flag or something I can set to avoid this issue?
ThanksHello Jason,
We have done somewhat the same, I see you dont add any arguments in the submit request call.
Maybe all below is already known, maybe it helps you to find just what is wrong in your case.
We did it this way:
l_id := fnd_request.submit_request( application => 'SQLAP'
+, program => p_name+
+, description => null+
+, start_time => null+
+, sub_request => null--fnd_global.conc_request_id+
+, argument1 => 'APXSUIMP'+
+, argument2 => 'ALL'+
+, argument3 => 1000+
+, argument4 => 'N'+
+, argument5 => 'N'+
+);+
After this we immediately execute a commit (as this will trigger the request start).
After that we also wait for the request to finish by doing the following:
if fnd_concurrent.wait_for_request
+( l_request_id+
+, 2 --interval+
+, 0 --max_wait+
+, l_phase --phase+
+, l_status --status+
+, l_dev_phase --dev_phase+
+, l_dev_status --dev_status+
+, l_message )+
then ...
Hope this helps,
Mark -
Getting error in mailing program :Cause: FDPSTP failed due to ORA-29277
in the following program i am submitting a request and sending concurrent program log file (.REQ file)as an attachment but getting
following error,plese tell me where i am wrong
ORACLE error 29277 in FDPSTP
Cause: FDPSTP failed due to ORA-29277: invalid SMTP operation
ORA-06512: at "SYS.UTL_SMTP", line 44
ORA-06512: at "SYS.UTL_SMTP", line 150
ORA-06512: at "SYS.UTL_SMTP", line 383
ORA-06512: at "SYS.UTL_SMTP", line 399
ORA-0651
code:
CREATE OR REPLACE PACKAGE BODY APPS.xx_create_acct
AS
PROCEDURE submit_request(
errbuf OUT VARCHAR2,
retcode OUT VARCHAR2,
Source_Application varchar2,
Application number,
Dummy_Parameter_0 varchar2,
Ledger number,
Process_Category varchar2,
End_Date varchar2,
Create_Accounting_Flag varchar2,
Dummy_Parameter_1 varchar2,
Accounting_Mode varchar2,
Dummy_Parameter_2 varchar2,
Errors_Only_Flag varchar2,
Report varchar2,
Transfer_to_GL_Flag varchar2,
Dummy_Parameter_3 varchar2,
Post_to_GL_Flag varchar2,
GL_Batch_Name varchar2,
Mixed_Currency_Precision Number,
Include_Zero_Amt_Lines_Flag varchar2,
Request_ID varchar2,
Entity_ID Number,
Source_Application_Name varchar2,
Application_Name varchar2,
Ledger_Name varchar2,
Process_Category_Name varchar2,
Create_Accounting varchar2,
Accounting_Mode_Name varchar2,
Errors_Only varchar2,
Report_Level varchar2,
Transfer_to_GL varchar2,
Post_in_GL varchar2,
Include_Zero_Amount_Lines varchar2,
Valuation_Method varchar2,
Security_ID_Integer_1 varchar2,
Security_ID_Integer_2 varchar2,
Security_ID_Integer_3 varchar2,
Security_ID_Char_1 varchar2,
Security_ID_Char_2 varchar2,
Security_ID_Char_3 varchar2,
Concurrent_Request_ID number,
P_INCLUDE_USER_TRX_ID_FLAG varchar2,
P_INCLUDE_USER_TRX_IDENTIFIERS varchar2,
P_DEBUG_FLAG varchar2
IS
l_senderemail VARCHAR2 (2000) := '[email protected]';
l_request_id NUMBER;
errmsg VARCHAR2 (1000);
req_id NUMBER;
phase VARCHAR2 (200);
status VARCHAR2 (200);
dphase VARCHAR2 (200);
dstatus VARCHAR2 (200);
MESSAGE VARCHAR2 (200);
wait_stat BOOLEAN;
l_file_name VARCHAR2 (200);
l_file_path VARCHAR2 (2000);
crlf VARCHAR2 (4) := CHR (13) || CHR (10);
v_set_layout_option BOOLEAN;
dir_name varchar2(100);
/* CURSOR req_status
IS
SELECT SUBSTR (outfile_name, 55, 23) filename,
SUBSTR (outfile_name, 1, 64) outfilepath
FROM applsys.fnd_concurrent_requests
WHERE request_id = l_request_id
AND phase_code = 'C'
AND status_code = 'C';*/
directory_path VARCHAR2 (2000);
lv_subject VARCHAR2 (100);
lv_msg VARCHAR2 (700);
lv_msghdr VARCHAR2 (100);
lv_pdf_filename VARCHAR2 (200);
BEGIN
apps.fnd_global.apps_initialize
(user_id => apps.fnd_global.user_id,
resp_id =>apps.fnd_global.resp_id,
resp_appl_id => apps.fnd_global.resp_appl_id
l_request_id :=
apps.fnd_request.submit_request
( 'BOM',
'CSTCRACCRCV',
NULL,
NULL,
FALSE,
Source_Application,
Application ,
Dummy_Parameter_0,
Ledger ,
Process_Category,
End_Date ,
Create_Accounting_Flag,
Dummy_Parameter_1 ,
Accounting_Mode ,
Dummy_Parameter_2,
Errors_Only_Flag,
Report ,
Transfer_to_GL_Flag,
Dummy_Parameter_3,
Post_to_GL_Flag ,
GL_Batch_Name ,
Mixed_Currency_Precision,
Include_Zero_Amt_Lines_Flag,
Request_ID ,
Entity_ID,
Source_Application_Name,
Application_Name,
Ledger_Name ,
Process_Category_Name,
Create_Accounting ,
Accounting_Mode_Name,
Errors_Only ,
Report_Level,
Transfer_to_GL,
Post_in_GL ,
Include_Zero_Amount_Lines,
Valuation_Method ,
Security_ID_Integer_1,
Security_ID_Integer_2,
Security_ID_Integer_3,
Security_ID_Char_1 ,
Security_ID_Char_2 ,
Security_ID_Char_3 ,
Concurrent_Request_ID,
P_INCLUDE_USER_TRX_ID_FLAG,
P_INCLUDE_USER_TRX_IDENTIFIERS,
P_DEBUG_FLAG
COMMIT;
IF (l_request_id <= 0)
THEN
errmsg := apps.fnd_message.get ();
ELSE
wait_stat :=
apps.fnd_concurrent.wait_for_request (l_request_id,
10,
360,
phase,
status,
dphase,
dstatus,
MESSAGE
IF dphase = 'COMPLETE'
THEN
dir_name :='XX_CREATE_ACCT_LOG';
l_file_name := 'l' || l_request_id || '.REQ';
lv_subject := NULL;
lv_msg := NULL;
lv_msghdr := NULL;
lv_pdf_filename := NULL;
lv_subject := 'testing mail :Request for Create Accounting not completed';
lv_msg :=
'Please find attachement here with the Status Of Create Accounting Reciving from cost management'
|| crlf;
lv_msghdr := 'Dear Sir' ;
lv_pdf_filename := l_file_name;
send_mail (l_senderemail,
'[email protected]',
lv_subject,
lv_msghdr,
lv_msg,
lv_pdf_filename,
'text/application',
dir_name
END IF;
END IF;
END submit_request;
PROCEDURE send_mail (
p_sender IN VARCHAR2,
p_recipient IN VARCHAR2,
p_subject IN VARCHAR2,
p_mailbodyhdr IN VARCHAR2,
p_mailbody IN VARCHAR2,
p_filename IN VARCHAR2,
p_filetype IN VARCHAR2,
dir_name in VARCHAR2
AS
v_msg VARCHAR2 (32000);
src_file BFILE;
i INTEGER := 1;
v_raw RAW (500);
v_length INTEGER := 0;
v_buffer_size INTEGER := 57;
v_mailconn UTL_SMTP.connection;
gc_crlf VARCHAR2 (4) := CHR (13)
|| CHR (10);
gc_lf VARCHAR2 (4) := CHR (10);
crlf VARCHAR2 (2) := CHR (13)
|| CHR (10);
gc_mailhost VARCHAR2 (255) := '172.16.11.2';
-- gc_maildomain VARCHAR2 (255) := 'pune.com';
msg VARCHAR2 (32767);
boundary CONSTANT VARCHAR2 (256)
:= '-----7D81B75CCC90D2974F7A1CBD';
first_boundary CONSTANT VARCHAR2 (256)
:= '--' || boundary || UTL_TCP.crlf;
last_boundary CONSTANT VARCHAR2 (256)
:= '--' || boundary || '--' || UTL_TCP.crlf;
-- A MIME type that denotes multi-part email (MIME) messages.
multipart_mime_type CONSTANT VARCHAR2 (256)
:= 'multipart/mixed; boundary="' || boundary || '"';
BEGIN
DBMS_OUTPUT.ENABLE (100000);
--fnd_file.put_line (fnd_file.output, '------------------------------------------------------' );
v_mailconn := UTL_SMTP.open_connection (gc_mailhost, 26);
UTL_SMTP.helo (v_mailconn, gc_mailhost);
UTL_SMTP.mail (v_mailconn, p_sender);
UTL_SMTP.rcpt (v_mailconn, p_recipient);
UTL_SMTP.open_data (v_mailconn);
msg :=
'Date: '
|| TO_CHAR (SYSDATE, 'Dy, DD Mon YYYY hh24:mi:ss')
|| crlf
|| 'From:[email protected] '
-- || p_sender
|| crlf
|| 'Subject: '
|| p_subject
|| crlf
|| 'To: [email protected]'
-- || p_recipient
|| crlf
|| 'MIME-Version: 3.1'
|| crlf
|| -- Use MIME mail standard
'Content-Type: multipart/mixed;'
|| crlf
|| ' boundary="-----SECBOUND"'
|| crlf
|| crlf
|| '-------SECBOUND'
|| crlf
|| 'Content-Type: text/plain;'
|| crlf
|| 'Content-Transfer_Encoding: 7bit'
|| crlf
|| crlf
|| p_mailbodyhdr
|| crlf
|| crlf
|| p_mailbody
|| crlf
|| crlf
|| crlf
|| crlf
|| -- Message body
'Regards'
|| crlf
|| 'HR and Payroll Team'
|| crlf
|| crlf
|| ' Note- Please ignore the leave status and number of days.'
|| crlf
|| crlf
|| '-------SECBOUND'
|| crlf
|| 'Content-Type'
|| ': '
|| p_filetype
|| crlf
|| 'Content-Disposition: attachment; filename="'
-- || 'Create Accounting'
-- || '.REQ'
||p_filename -- p_filename
|| '"'
|| crlf
|| 'Content-Transfer-Encoding: base64'
|| crlf
|| crlf;
UTL_SMTP.write_data (v_mailconn, msg);
src_file := BFILENAME (dir_name, p_filename);
DBMS_LOB.fileopen (src_file, DBMS_LOB.file_readonly);
v_length := DBMS_LOB.getlength (src_file);
WHILE i < v_length
LOOP
DBMS_LOB.READ (src_file, v_buffer_size, i, v_raw);
UTL_SMTP.write_raw_data (v_mailconn,
UTL_ENCODE.base64_encode (v_raw)
UTL_SMTP.write_data (v_mailconn, UTL_TCP.crlf);
i := i + v_buffer_size;
END LOOP while_loop;
UTL_SMTP.write_data (v_mailconn, last_boundary);
UTL_SMTP.write_data (v_mailconn, UTL_TCP.crlf);
DBMS_LOB.fileclose (src_file);
UTL_SMTP.close_data (v_mailconn);
UTL_SMTP.quit (v_mailconn);
EXCEPTION
WHEN OTHERS
THEN
UTL_SMTP.quit (v_mailconn);
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
-- FND_FILE.PUT_LINE (FND_FILE.LOG,'error while fetching values from CO_CODE'|| SQLERRM );
END send_mail;
END xx_create_acct;Edited by: BluShadow on 18-Apr-2011 09:49
added {noformat}{noformat} tags. Please see the [url=SQL and PL/SQL FAQ and PL/SQL FAQ[/url] for info on how to post on the forumsI didn't get the information, What I want. Anyway, in the BLOB writing portion you have to create a temporary LOB and load your file into that temporary LOB and the write it into chunks.
Something like
DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
/* Writing the BLOL in chunks */
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
UTL_SMTP.write_raw_data(v_connection_handle,
UTL_ENCODE.BASE64_ENCODE(l_buffer));
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
l_buffer := NULL;
l_pos := l_pos + l_amount;
END LOOP;For more example see these posts:
Re: Sending UTL_SMTP mail with single jpg attachment issue
Re: getting junk letters instead of photo in an email. -
Submitting Concurrent request from PL/SQL
Hi
I am currently attempting to submit a concurrent program from a pl/sql block that itself is being run as a concurrent program. However the call to submit_request would only returned zero.
I inserted a call to FND_GLOBAL.INITIALIZE as suggested on another forum and am now getting .. ORA-00942: table or view does not exist has been detected in FND_GLOBAL.INITIALIZE.
Surely if a table or view did not exist the package fnd_global would not compile (it does compile)
Any suggestions in terms of
Do i need a call to fnd_global.initialize
Without it would to submit_request return zero
..etc
The parent conc prog code is as follows:
v_action := 'run file download stage'||utl_tcp.crlf;
-- Write to concurrent log.
apps.fnd_file.put_line(apps.fnd_file.log,'v_action: '||v_action);
apps.fnd_profile.get('USER_ID', v_user_id);
apps.fnd_profile.get('RESP_ID', v_resp_id);
apps.fnd_profile.get('RESP_APPL_ID', v_resp_appl_id);
apps.fnd_file.put_line(apps.fnd_file.log, v_user_id);
apps.fnd_file.put_line(apps.fnd_file.log, v_resp_id);
apps.fnd_file.put_line(apps.fnd_file.log, v_resp_appl_id);
apps.fnd_global.apps_initialize(v_user_id,v_resp_id,v_resp_appl_id);
v_req_id := apps.fnd_request.submit_request
(application => 'GPMS_CUST',
program => 'GPMS_EXCH_RATES',
description => 'GPMS Exchange Rate Download - FTP stage',
start_time => NULL,
sub_request => FALSE
COMMIT;
apps.fnd_file.put_line(apps.fnd_file.log,'apps.fnd_message.GET: '||apps.fnd_message.GET);
apps.fnd_file.put_line(apps.fnd_file.log,'0.5 v_req_id: '||v_req_id);
IF v_req_id != 0
THEN
apps.fnd_file.put_line(apps.fnd_file.log,'1.0 '||v_req_id);
IF apps.fnd_concurrent.wait_for_request
(request_id => v_req_id,
interval => v_interval,
phase => v_req_phase,
status => v_req_status,
dev_phase => v_req_dev_phase,
dev_status => v_req_dev_status,
message => v_req_message)
THEN
apps.fnd_file.put_line(apps.fnd_file.log,'1.1: '||v_req_dev_phase||' '||v_req_dev_status );
IF v_req_dev_phase !='COMPLETE' OR v_req_dev_status != 'NORMAL'
THEN
apps.fnd_file.put_line(apps.fnd_file.log,'1.3');
RETCODE :=2;
errbuf := 'errbuf contents here***';
ELSE
RETCODE := 0;
END IF;
END IF;
else
apps.fnd_file.put_line(apps.fnd_file.log,'1.4: sqlerrm:'|| sqlerrm);
END IF;
However as mentioned this returns the following in the concurrent log..
**Ends**28-DEC-2006 16:24:49
Start of log messages from FND_FILE
v_action: run file download stage
11170
20420
1
exception: ORA-20001: Oracle error -942: ORA-00942: table or view does not exist has been detected in FND_GLOBAL.INITIALIZE.
End of log messages from FND_FILE
Thanks for any Help
willOk
Done some more reading and looks like i may not need the call to
fnd_global.apps_initialize
as i am running this from an apps session using a parent concurrent prog.
I have commented the above call out, however get the following in the concurrent log..
Start of log messages from FND_FILE
v_action: run file download stage
11170
20420
1
apps.fnd_message.GET: ORACLE error -2289 in SUBMIT: others
Cause: SUBMIT: others failed due to ORA-02289: sequence does not exist.
The SQL statement being executed at the time of the error was: &SQLSTMT and was executed from the file &ERRFILE.
0.5 v_req_id: 0
1.4: sqlerrm:ORA-0000: normal, successful completion
End of log messages from FND_FILE
There seems to be a missing sequence being called from fnd_request.submit, however if this was the case the package would not compile.. correct?
Any help would be appreciated..
Will -
Child CPs are always in PENDING STATE.
Procedure parent_cp (errbuf out nocopy varchar2, retcode out nocopy varchar2) IS
ret number;
i number;
BEGIN
fnd_msg_pub.initialize;
BEGIN ---Block A
req_data := fnd_conc_global.request_data;
if (req_data is not null) then
i := to_number(req_data);
if (i < 5 ) then
errbuf := 'Done!';
retcode := 0 ;
return;
end if;
else
i := 1;
end if;
for j in 1 .. 4 loop
vRequestId(j) := fnd_request.submit_request('CZ', 'Child','Delete Localized Text - Child Number : ' ||TO_CHAR(vChildNo), NULL,TRUE, vChildMdlRange);
fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => to_char(vChildNo)) ;
IF (vRequestId(j) = 0 ) THEN
errbuf := fnd_Message.get;
retcode := 2;
ELSE
errbuf := 'Sub-Request submitted!';
retcode := 0 ;
END IF;
END LOOP;
END;
BEGIN ---block B
For j in vRequestId.FIRST..vRequestId.LAST LOOP
fnd_file.put_line(fnd_file.log,' reuest' || vRequestId(j));
vrequeststatus := fnd_concurrent.get_request_status(vRequestId(j),
NULL,
NULL,
phase,
status,
dev_phase ,
dev_status ,
message );
WHILE (dev_phase != 'COMPLETE') LOOP
fnd_file.put_line(fnd_file.log,' while loop' || vRequestId(j));
vrequeststatus := fnd_concurrent.wait_for_request(vRequestId(j),
60,
10,
phase ,
status ,
dev_phase ,
dev_status ,
message );
END LOOP;
END LOOP;
dbms_output.put_line(' Block after submitting Child CP ');
END;
END parent_cp;
The above procedure was the Parent CP. Here the problem is in fnd_request.submit_request('CZ', 'Child','Delete Localized Text - Child Number : ' ||TO_CHAR(vChildNo), NULL,TRUE, vChildMdlRange); i have given sub_request as True and used fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => to_char(vChildNo)) ; to make parent CP to pause it.
It submits 4 child CPs as expected but the phase as INACTIVE and status NO MANAGER and PARENT CP was always in running state.
If i make sub_request parameter of fnd_request.sub_request to FALSE . It submits 4 child CPs as expected with the phase as PENDING and status NORMAL and PARENT CP was always in running state. But child cps are never changing the Phase to RUNNING. It is always in PENDING STATE.
Please suggest how to use fnd_conc_global.set_req_globals and fnd_concurrent.wait_for_request together.Pl do not post duplicates - Parent Concurrent Program executes rest of the logic before PAUSED STATE.
-
Oracle.apps.fnd.cache.CacheException in login page
Hi,
i wrote one method in am and return that values to co and the following is the code in AM
public String Status(String reqid){
String Status2=null;
String Status;
while(Staus.equals("I")||Staus.equals("R")||Staus.equals("P"))
try{
try
Thread.sleep(1000);
} catch (InterruptedException e)
System.out.println("eroor in am thread block");
String Query ="select phase_code,status_code from fnd_concurrent_requests where request_id=?";
PreparedStatement stmt = getOADBTransaction().createPreparedStatement(Query,1);
stmt.setString(1,requestid);
ResultSet resultset= stmt.executeQuery();
if (resultset != null)
while (resultset.next())
if (resultset.getString(1) != null)
Staus = resultset.getString(1); // here to fetch the column from the query
Status2=resultset.getString(2);
catch(SQLException exception)
//Incase of any error while running the query throw an exception.
throw new OAException("Error in Query"+ exception, OAException.ERROR);
return Status2;
here iam checking phase code of the programe ,f it is C iam returning the status to variable in CO.it is taking one hour time to complete to get the status code :C
in the application,program is runnig but after getting "C" also the progres is still running. i closed the session and opened again and it is giving following error:
oracle.apps.fnd.cache.CacheException
Please help me to solve this , i got the request id but while getting status only iam facing issue..Hi,
1. Are you submitting this concurrent program from your code, if yes then you should issue commit immediately after submitting the request.
OR
2. Try using below PL/SQL block code in your AM (please convert to java call ).
DECLARE
l_request_id NUMBER;
o_call_status BOOLEAN;
o_request_phase VARCHAR2(200);
o_request_status VARCHAR2(200);
o_dev_request_phase VARCHAR2(200);
o_dev_request_status VARCHAR2(200);
o_request_status_mesg VARCHAR2(2000);
BEGIN
o_call_status := fnd_concurrent.wait_for_request(l_request_id,
20,
0,
o_request_phase,
o_request_status,
o_dev_request_phase,
o_dev_request_status,
o_request_status_mesg);
END;
Regards,
Sandeep M. -
How to trigger xml publisher API (ex:Delivering Documents via e-Mail)?
Dear All:
How to use xml publisher API ?
In user's guide always talk API's code.(ex:Delivering Documents via e-Mail
// create delivery manager instance
DeliveryManager dm = new DeliveryManager();
// create a delivery request
DeliveryRequest req =
dm.createRequest(DeliveryManager.TYPE_SMTP_EMAIL);
// set email subject
req.addProperty(DeliveryPropertyDefinitions.SMTP_SUBJECT, "Invoice");
// set SMTP server host
req.addProperty(
DeliveryPropertyDefinitions.SMTP_HOST, "mysmtphost");
// set the sender email address
req.addProperty(DeliveryPropertyDefinitions.SMTP_FROM,
"[email protected]");
// set the destination email address
req.addProperty(
DeliveryPropertyDefinitions.SMTP_TO_RECIPIENTS,
"[email protected], [email protected]" );
// set the content type of the email body
req.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_TYPE,
"text/html");
// set the document file name appeared in the email
req.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_FILENAME,
"body.html");
// set the document to deliver
req.setDocument("/document/invoice.html");
// submit the request
req.submit();
// close the request
req.close(); )
Not say how to use this code to account effect !!
Having anybody to use API before?
Please tell me how to use that,thanks!!
BY Emily_yeHi Emily
I had the same question. After much research and a lot of deduction I produced the following:
import oracle.apps.fnd.cp.request.*;
import java.io.*;
import java.sql.*;
import java.util.Vector;
import oracle.apps.fnd.util.*;
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.common.pdf.util.PDFDocMerger;
import oracle.apps.xdo.delivery.DeliveryException;
import oracle.apps.xdo.delivery.DeliveryManager;
import oracle.apps.xdo.delivery.DeliveryPropertyDefinitions;
import oracle.apps.xdo.delivery.DeliveryRequest;
import oracle.jdbc.driver.OracleCallableStatement;
public class RunTravProgram implements JavaConcurrentProgram {
CpContext mCtx; // global reference to concurrent program context
LogFile logFile; // global reference to context logfile
OutFile outFile; // global reference to context outfile
Connection mConn = null;
ReqCompletion lRC;
//File Separator
private String mFileSeparator;
// globals for template
String XDOAppShortName = "";
String XDOtemplateCode = "";
// hard-wired constants for template addition
final String XDOLanguage = "en";
final String XDOTerritory = "US";
final String XDOFinal_format = "PDF";
final String XDOtemplateType = "TEMPLATE_SOURCE";
String PDFFile = "";
String outFilePath = "";
String progShortName = "";
String progDesc = "";
Integer iRequestID = 0;
String sWatermark = ""; // watermark text
String emailAddress = ""; // Not Implemented
String emailServer = "";
public static final String M_SUCCESS = "SUCCESS";
public static final String M_ERROR = "ERROR";
public static final String M_WARNING = "WARNING";
* Create a Java FND ConcurrentRequest objec to call fnd_request.submit_request
* The first three parameters are:
* Application Short Name -- Application Short name (ie. WAHC)
* Current Program Short Name -- Concurrent Program being called
* Current Program Description -- description for above
* These should be the first three parameters passed by the concurrent
* program in this order. The next two are constants set to null
* These are followed by the parameters passed by the first concurrent
* program that are being passed to the next concurrent program.
* I am limiting the parameter list to ten for now.
// Dynamic PLSQL statement used to get a concurrent request completion status
// This is necessary because the java class does not provide this method :-(
String mGetCompleteStatus =
"DECLARE R_VAL BOOLEAN; " + "b_phase VARCHAR2 (80) := NULL; " +
"b_status VARCHAR2 (80) := NULL; " +
"b_dev_phase VARCHAR2 (80) := NULL; " +
"b_dev_status VARCHAR2 (80) := NULL; " +
"b_message VARCHAR2 (240) := NULL; " + "BEGIN " +
"r_val := fnd_concurrent.wait_for_request (:1,5,1000," +
"b_phase,b_status,b_dev_phase,b_dev_status,b_message); " +
":2 := b_phase; " + ":3 := b_status; " + ":4 := b_message; " + "end;";
public RunTravProgram() {
// no constructor necessary for now
* Concurrent Processing provides an interface 'JavaConcurrentProgram' with abstract method
* runProgram() which passes the concurrent processing context 'CpContext'. The concurrent
* program developer will implement all of their business logic for a concurrent program in
* runProgram(). The main() method, implemented by AOL, will call runProgram() after
* performing all of the required initialization for the concurrent program, including
* establishing a database connection, initializing the required contexts, and setting up
* the log and output files. CpContext will have the request specific log and output
* file input methods
public void runProgram(CpContext pCpContext) {
mCtx = pCpContext;
OracleCallableStatement lStmt = null;
boolean bCompletion = true;
String sPhase = "";
String sStatus = "";
String sMessage = "";
//get handle on request completion object for reporting status
lRC = pCpContext.getReqCompletion();
// assign logfile
logFile = pCpContext.getLogFile();
// assign outfile
outFile = pCpContext.getOutFile();
// assign fileseparator
mFileSeparator = getFileSeparator();
// get the JDBC connection object
mConn = pCpContext.getJDBCConnection();
outFilePath =
((new File(outFile.getFileName())).getParent() == null ? "" :
(new File(outFile.getFileName())).getParent() +
mFileSeparator);
logFile.writeln("OutFile File Path: -> " + outFilePath, 0);
// get parameter list object from CpContext
// these come from the concurrent program
ParameterList lPara = pCpContext.getParameterList();
// create a temporary array and retrieve the parameters created by
// the program. Currently limiting the number of parameters to 10 for now
String pvals[] = new String[10];
int pcount = 0;
while (lPara.hasMoreElements()) {
NameValueType aNVT = lPara.nextParameter();
pvals[pcount] = aNVT.getValue();
pcount++;
if (pcount > 9)
break;
// send parameter values to the log file
logFile.writeln("Arg 1: APPL_SHORT_NAME -> " + pvals[0], 0);
logFile.writeln("Arg 2: CURR_PROG_SHORT_NAME -> " + pvals[1], 0);
logFile.writeln("Arg 3: CURR_PROG_DESCRIPTION -> " + pvals[2], 0);
logFile.writeln("Arg 4: TEMPLATE_CODE -> " + pvals[3], 0);
logFile.writeln("Arg 5: P_PLANT_CODE -> " + pvals[4], 0);
logFile.writeln("Arg 6: P_BATCH_NO -> " + pvals[5], 0);
logFile.writeln("Arg 7: P_SHOW_PROMISE -> " + pvals[6], 0);
logFile.writeln("Arg 8: P_WATERMARK -> " + pvals[7], 0);
XDOtemplateCode = pvals[3]; // store the template name globally
progShortName = pvals[1]; // store the program short name globally
XDOAppShortName = pvals[0]; // store the application short name
sWatermark = pvals[7]; // store the watermark globally
progDesc = pvals[2];
try {
// create a concurrent request object
ConcurrentRequest cr = new ConcurrentRequest(mConn);
// use the parameters to call fnd_request.submit_request
cr.addLayout(XDOAppShortName, XDOtemplateCode, XDOLanguage,
XDOTerritory, XDOFinal_format);
Vector param = new Vector();
param.add(pvals[4]); // plant code
param.add(pvals[5]); // batch ID
param.add(pvals[6]); // Show SO info flag
iRequestID =
cr.submitRequest(XDOAppShortName, progShortName, progDesc,
null, false, param);
mConn.commit();
// send the request ID to the log file
logFile.writeln("-- Request ID: ->" + Integer.toString(iRequestID),
0);
// call fnd_concurrent.wait_for_request to wait until the request
// has ended - use this to check the request status before proceeding
lStmt =
(OracleCallableStatement)mConn.prepareCall(mGetCompleteStatus);
lStmt.setInt(1, iRequestID);
lStmt.registerOutParameter(2, java.sql.Types.VARCHAR, 0, 255);
lStmt.registerOutParameter(3, java.sql.Types.VARCHAR, 0, 255);
lStmt.registerOutParameter(4, java.sql.Types.VARCHAR, 0, 255);
lStmt.execute();
// get the results of the completion
sPhase = lStmt.getString(2);
sStatus = lStmt.getString(3);
sMessage = lStmt.getString(4);
lStmt.close();
// send the results of the request processing to the log file
logFile.writeln("-- Phase: -> " + sPhase, 0);
logFile.writeln("-- Status: -> " + sStatus, 0);
logFile.writeln("-- Message: -> " + sMessage, 0);
// test here to make sure it completed correctly
if (sPhase.equals("Completed") && sStatus.equals("Normal")) {
// construct the PDF file name generated by the called request
PDFFile = progShortName + "_" + iRequestID + "_1.pdf";
// add a watermark to the generated PDF
// create an output stream for the existing PDF
// and set ouput to append
OutputStream pdfout =
new FileOutputStream(outFilePath + PDFFile, true);
// create an inputstream array (required by calling method)
InputStream pdfin[] = new InputStream[1];
pdfin[0] = new FileInputStream(outFilePath + PDFFile);
// add the watermark passed as a parameter
bCompletion = addWatermark(pdfin, pdfout);
// assign the modified file to the context out
// this will print using this request
if (bCompletion)
outFile.setOutFile(outFilePath + PDFFile);
// release the connection object
// and set the completion status for the request
if (bCompletion) {
pCpContext.getReqCompletion().setCompletion(ReqCompletion.NORMAL,
} else {
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} catch (SQLException s) {
logFile.writeln("SQL Error: Exception thrown w/ error message: " +
s.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} catch (IOException ioe) {
logFile.writeln("IO Error: Exception thrown w/ error message: " +
ioe.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} catch (Exception e) {
logFile.writeln("General Exception: " + e.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} finally {
try {
if (lStmt != null)
lStmt.close();
pCpContext.releaseJDBCConnection();
} catch (SQLException e) {
logFile.writeln(e.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
* addWatermark()
* @param pdfin
* @param pdfout
* @return boolean
* This method will work for an existing document or a newly generated
* one. Set the outputstream append flag to false for a new document
* and true for an existing one.
* NOTE: PDFDocMerger requires an inputstream array even if it only
* contains one document.
private boolean addWatermark(InputStream[] pdfin, OutputStream pdfout) {
if (!sWatermark.equals("")) {
try {
PDFDocMerger docMerger = new PDFDocMerger(pdfin, pdfout);
//docMerger.setTextDefaultWatermark(sWatermark);
docMerger.setTextWatermark(sWatermark, 80f, 50f);
docMerger.setTextWatermarkAngle(25);
docMerger.setTextWatermarkColor(1.0f, .50f, .50f);
docMerger.setTextWatermarkFont("Garamond", 100);
docMerger.process();
docMerger = null;
return true;
} catch (XDOException e) {
logFile.writeln("Watermark process Failed: " + e.getMessage(),
0);
return false;
return true;
* Returns the file separator
private String getFileSeparator() {
return (System.getProperty("file.separator"));
* EBSEmailDelivery
* @return
* Just for testing right now.
private boolean EBSEmailDelivery() {
if (!emailAddress.equals("")) {
try {
// create delivery manager instance
DeliveryManager delMgr = new DeliveryManager();
// create a delivery request
DeliveryRequest delReq =
delMgr.createRequest(DeliveryManager.TYPE_SMTP_EMAIL);
// set email subject
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_SUBJECT,
"EBS Report:" + progDesc +
" for request: " + iRequestID);
// set SMTP server host
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_HOST,
emailServer); // need to supply the email smtp server
// set the sender email address
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_FROM,
emailAddress);
// set the destination email address
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_TO_RECIPIENTS,
emailAddress);
// set the content type of the email body
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_TYPE,
"application/pdf");
// set the document file name appeared in the email
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_FILENAME,
PDFFile);
// set the document to deliver
delReq.setDocument(outFilePath + PDFFile);
// submit the request
delReq.submit();
// close the request
delReq.close();
return true;
} catch (DeliveryException de) {
logFile.writeln("email process Failed: " + de.getMessage(), 0);
return false;
return true;
This is the class for a JCP I created to perform the following:
1) Launch an existing Concurrent Program that produces PDF output
2) Grab the PDF and apply a watermark based on user input or conditions
3) associate the modified PDF to CP output for PASTA printing
It isn't elegant but it is fairly simple. I added the email capability and tested it but am not implementing it at the present time.
there is a fair amount of information out there that explains how to create a JCP councurrent program but very little that demonstrates the class needed.
I hope this helps -
How to call a concurrent program with some parameters in a stored procedure
Hi All,
I have made two procedures, xx_nidhi_proc1 and xx_nidhi_proc2.
xx_nidhi_proc1 takes four parameters from front end and is registered as concurrent program in oracle apps and running fine alone.
xx_nidhi_proc2 calls the concurrent program of xx_nidhi_proc1 which is XX_NIDS_PROC1_PROG1.
But the problem in my code is , It runs the second concurrent program for xx_nidhi_proc2 but shows the Inactive- No Manager status for my first concurrent program XX_NIDS_PROC1_PROG1,
Please find out the error in my code...
CREATE OR REPLACE PACKAGE BODY NIDHI IS
procedure xx_nidhi_proc1 (errbuf OUT VARCHAR2,
retcode OUT VARCHAR2,
name_t varchar2,
empno varchar2,
doj date,
desig varchar2) is
begin
fnd_file.PUT_LINE(Fnd_File.output,'/**************Start of the output **********/');
fnd_file.PUT_LINE(Fnd_File.output, 'Name:'||name_t);
fnd_file.PUT_LINE(Fnd_File.output, 'Number:'||empno);
fnd_file.PUT_LINE(Fnd_File.output, 'DOJ:'|| to_char(doj, 'DD-MON-RRRR'));
fnd_file.PUT_LINE(Fnd_File.output, 'Designation:'||desig);
fnd_file.PUT_LINE(Fnd_File.output,'/**************End of the output **********/');
errbuf:='SUCCESS';
retcode:='SUCCESS';
end xx_nidhi_proc1;
--calls the xx_nidhi_proc1 as concurrent program.
procedure xx_nidhi_proc21 (errbuf OUT VARCHAR2,
retcode OUT VARCHAR2)
is
v_request_id number;
begin
fnd_file.PUT_LINE(Fnd_File.output,'/**************Start of the output **********/');
fnd_file.PUT_LINE(Fnd_File.output, 'Deptartment Number:'||'Computer');
fnd_file.PUT_LINE(Fnd_File.output, 'Location:'||'TCS Towers');
fnd_file.PUT_LINE(fnd_file.output,'Starting XX_NIDS_PROC1_PROG1');
fnd_global.apps_initialize(user_id => 1318 ,resp_id => 50578, resp_appl_id => 201);
v_request_id := FND_REQUEST.SUBMIT_REQUEST('PO',
'XX_NIDS_PROC1_PROG1',
null,
null,
TRUE,
'Nidhi gupta',
138609,
'12-Dec-2003',
'ASE');
commit;
fnd_file.PUT_LINE(fnd_file.OUTPUT,'Request ID is '||to_char(v_request_id));
fnd_file.PUT_LINE(fnd_file.OUTPUT,'End XX_NIDS_PROC1_PROG1');
fnd_file.PUT_LINE(Fnd_File.output,'/**************End of the output **********/');
errbuf:='SUCCESS';
retcode:='SUCCESS';
end xx_nidhi_proc21;
Thanks
Nidhi
END NIDHI;Nidhi this might help u
v_num_request_load_id :=
fnd_request.submit_request (c_chr_application_short_name,
c_chr_apl_short_name,
NULL,
NULL,
FALSE,
p_chr_allocation_view,
p_chr_flow_type,
p_chr_operating_unit,
p_dte_planned_from,
p_dte_planned_to,
p_num_application_id,
p_num_loc_seg1_id,
p_num_loc_seg2_id,
p_num_organization_id,
p_num_responsibility_id,
p_num_session_id,
p_num_user_id,
p_chr_arrival_status,
p_chr_statuses,
p_chr_locations,
p_chr_transport_unit
COMMIT;
IF v_num_request_load_id = 0
THEN
o_num_stat := 2;
o_chr_err_msg := 'Report could not be submitted';
END IF;
o_chr_err_msg := 'Request Id :' || v_num_request_load_id;
v_boo_wait :=
fnd_concurrent.wait_for_request (v_num_request_load_id,
c_num_interval,
c_num_max_wait,
v_chr_phase,
v_chr_status,
v_chr_dev_phase,
v_chr_dev_status,
v_chr_err_buf
IF v_chr_dev_phase = 'COMPLETE' /* 1.1 */
THEN
IF v_chr_dev_status = 'NORMAL' /* 1.2 */
THEN
BEGIN
-- some your own logic
EXCEPTION
WHEN OTHERS THEN
o_chr_err_msg := o_chr_err_msg||' Unable to determine Report File Path.';
o_num_stat := 2;
END;
ELSIF v_chr_dev_status = 'WARNING' /* 1.2 */
THEN
o_chr_err_msg := o_chr_err_msg||' Report program completed with Warning.';
ELSE /* 1.2 */
o_chr_err_msg := o_chr_err_msg||' Report program completed with Error.';
END IF; /* 1.2 */
ELSE /* 1.1 */
o_chr_err_msg := 'Report program Timed Out.';
END IF; /* 1.1 */ -
Dynamic attach RTF in AfterReport Trigger
Hi all,
I have a concurrent program where i want in runtime to attach RTF template based on some logic. I placed my code in After Report Trigger but i receive error when submitting the concurrent request:
REP-1401: 'afterreport': Fatal PL/SQL error occurred.
ORA-06503: PL/SQL: Function returned without valueI checked the code and i see no reason of getting this error.
The executable of my Report is "Oracle Reports" and the output format is XML.
Here is the code of the trigger:
function AfterReport return boolean is
v_set_layout_option boolean;
v_conc_request_id number;
v_printer_name varchar2(100);
v_printer boolean;
v_template_name varchar2(100);
v_invoice_type ra_cust_trx_types_all.type%type;
v_batch_source_name varchar2(100);
begin
dbms_application_info.set_client_info(:P_ORG_ID);
select
type, rbsa.name
into
v_invoice_type, v_batch_source_name
from
ra_customer_trx_all ra_ctp
,ra_cust_trx_types_all ra_cty
,ra_batch_sources_all rbsa
where ra_ctp.customer_trx_id = :p_customer_trx_id
and ra_ctp.cust_trx_type_id = ra_cty.cust_trx_type_id
and ra_ctp.org_id = ra_cty.org_id
and rbsa.BATCH_SOURCE_ID = ra_ctp.BATCH_SOURCE_ID
and ra_ctp.org_id = rbsa.org_id
v_template_name :=
case
when v_invoice_type = 'INV' then 'XX_AR_INVOICE_CURR'
when v_invoice_type = 'CM' then 'XX_AR_INVOICE_CURR_CR'
when v_invoice_type = 'DM' then 'XX_AR_INVOICE_CURR_DEBIT'
when v_invoice_type = 'PROFORMA' then 'XX_AR_INVOICE_CURR_PROFORMA'
when v_invoice_type = 'INVALIDATE' then 'XX_AR_INVOICE_CURR_INVAL'
when v_invoice_type = 'MONTHLY' then 'XX_AR_INVOICE_CURR_MONTHLY'
end;
v_set_layout_option := apps.fnd_request.add_layout( template_appl_name => 'AR' --application
,template_code => v_template_name
,template_language => 'en'
,template_territory => 'US'
,output_format => 'PDF');
begin
select printer_name
into v_printer_name
from fnd_concurrent_programs
where CONCURRENT_PROGRAM_NAME = 'XX_AR_INVOICE_CURR';
exception
when others then
null;
end;
if v_printer_name is not null then
v_printer := fnd_request.set_print_options(v_printer_name,
null,
1, -- no of copies
TRUE,
'N');
end if;
exception when others then return (false);
return (TRUE);
end;Version:Report Builder 10.1.2.2.0
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
"CORE 11.1.0.7.0 Production"
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionAny ideas?
Thanks in advance,
Bahchevanov.
Edited by: bahchevanov on Dec 27, 2011 7:27 AM
Edited by: bahchevanov on Dec 27, 2011 7:28 AMSolved! It seems that is impossible to attache template runtime via Report Builder(or it is...). So i made a new concurrent program with executable - PL/SQL Stored Procedure where i submit the request i want and attach an appropriate RTF file. Here is my procedure:
procedure submit_XX_AR_INVOICE_CURR(ERRBUF OUT varchar2, RETCODE OUT number, p_customer_trx_id number ) as
v_rid number;
v_org_id number;
call_status BOOLEAN;
request_phase VARCHAR2(30);
request_status VARCHAR2(30);
dev_request_status VARCHAR2(30);
dev_request_phase VARCHAR2(30);
request_status_mesg VARCHAR2(255);
v_invoice_type ra_cust_trx_types_all.type%type;
v_report_short_name varchar2(100);
v_batch_source_name varchar2(100);
check_status boolean;
v_set_layout_option boolean;
lv_document_type varchar2(10 char);
lv_org_id varchar2(10 char);
lv_tax_code varchar2(10 char);
v_template_name varchar2(50 char);
begin
select type, rbsa.name
into v_invoice_type, v_batch_source_name
from ra_customer_trx_all ra_ctp
join ra_cust_trx_types_all ra_cty on ra_ctp.cust_trx_type_id = ra_cty.cust_trx_type_id and ra_ctp.org_id = ra_cty.org_id
join ra_batch_sources_all rbsa on rbsa.BATCH_SOURCE_ID = ra_ctp.BATCH_SOURCE_ID and ra_ctp.org_id = rbsa.org_id
where ra_ctp.customer_trx_id = p_customer_trx_id
SELECT FND_PROFILE.VALUE('ORG_ID') INTO lv_org_id FROM dual;
v_template_name :=
CASE
WHEN v_invoice_type = 'INV' THEN 'XX_AR_INVOICE_CURR'
WHEN v_invoice_type = 'CM' THEN 'XX_AR_INVOICE_CURR_CR'
WHEN v_invoice_type = 'DM' THEN 'XX_AR_INVOICE_CURR_DEBIT'
WHEN v_invoice_type = 'PROFORMA' THEN 'XX_AR_INVOICE_CURR_PROF'
WHEN v_invoice_type = 'INVALIDATE' THEN 'XX_AR_INVOICE_CURR_INVAL'
WHEN v_invoice_type = 'MONTHLY' THEN 'XX_AR_INVOICE_CURR_MONTH'
END;
v_report_short_name := 'XX_AR_INVOICE_CURR';
v_set_layout_option := apps.fnd_request.add_layout(template_appl_name => 'AR' --application
,template_code => v_template_name -- template_name from XML_Publisher
,template_language => 'en' -- ISO format
,template_territory => 'US' -- ISO format
,output_format => 'PDF'); -- PDF, EXCEL, RTF
v_rid := fnd_request.submit_request('AR' -- application
,v_report_short_name -- program name ( GL interface)
,'Печат' -- description
,sysdate -- start time
,FALSE -- sub request
,p_customer_trx_id
,lv_org_id
,chr(0)
if nvl(v_rid,0) = 0 then
errbuf := sqlerrm;
RETCODE := 2;
end if;
commit;
check_status := FND_CONCURRENT.WAIT_FOR_REQUEST(v_rid
,2
,0
,request_phase
,request_status
,dev_request_phase
,dev_request_status
,request_status_mesg);
if (dev_request_phase != 'COMPLETE' or dev_request_status != 'NORMAL') then
dbms_output.put_line(dev_request_phase || ' -- ' || dev_request_status);
errbuf := sqlerrm;
RETCODE := 2;
end if;
dbms_output.put_line('v_rid :' || v_rid);
end submit_XX_AR_INVOICE_CURR;Best Regards,
Bahchevanov.
Maybe you are looking for
-
Assign posting periods to authorization group in tcode S_ARL_87003642
Hello, I want to restrict posting periods for some users. Therefore, I have created 2 functions associated to 2 authorization groups. In transaction S_ARL_87003642, when I try to assign different posting periods to each authorization group to the sam
-
My ipad is in restore mode, how can I get it out of restore mode
I am having issues with my Ipad. It is now stuck in restore mode. I am not sure if it has been backed up in itunes or not. How do I tell if it has, and how do I get it our of restore mode if it has not?
-
Where to find detail message flow in scenario of AQ to DB adapter?
I have installed hub, aq and DB adapter. The repository, adapters seem to be run fine. I put some messages in AQ and found out that there were no messages appeared in DB. The messages could be found in AQ_OUTBOUND_QUEUE. Sine there is no error messag
-
Switching Audio-Out to internal speaker with Audio still plugged in?
Hello, unfortunately I snapped my optical audio plug in my iMac and now it's stuck in the jack. What a mess. Until I take it to the service, I would like to use my internal speakers. Most unfortunately, as the part of the plug is still stuck in the j
-
Two SAPScript forms on a single page
Hello Is there a way (in SAPScript) to have two forms (sapscript forms defined in SE71) printed in a single page ? What I would like to achieve is to have several sapscript forms defined in the system and to be able to combine them in a single page d