Calling Workflow background process' explicitly in pl/sql code
Hi All,
We have a requirement where we have to call the 'Workflow background process' explicitly in pl/sql code.
What we want is that we are having some request that runs via a concurrent program, but before that request completes we want to put that on wait and run the 'Workflow background process' explicitly in the code itself (user need not go and manually run it).
Can anyone please advice me how do I do this in a PL/SQL code that is called via a concurrent program.
Regards,
Shruti
Pl post details of OS, database and EBS versions.
One option is to use the FND_SUBMIT API
Most Commonly Used FND APIs in APPS Customizations [ID 221549.1]
Sample Code to Call Customer Interface RACUST Program using FND_SUBMIT Api in 11i and R12 [ID 429278.1]
https://forums.oracle.com/forums/search.jspa?threadID=&q=FND_SUBMIT&objID=c3&dateRange=all&userID=&numResults=15
HTH
Srini
Similar Messages
-
Hello friends,
I am created a drop shipment order with all the setups done . now i have booked the sale order as source type external. but when i run the workflow background process , after completing the report when i check the sale order line status it changes to "closed" instead of "awaiting shipping".
Plz guide me if i have missed something in the setups.
thanks,
SachinHi Sachin,
pls check the below notes from MOS
Drop Ship Sales Order Cycle In Order Management (Doc ID 749139.1)
Vision Demo - How To Create A Drop Ship Sales Order/Purchase Order (Doc ID 1060343.1)
Thanks
-Arif. -
Question: How to call a BPEL process from a PL/SQL procedure
Hi All,
Greetings to all BPEL people. I have a question on how can we call a BPEL process from a PLSQL procedure. It might be a stupid question but i wanted to know whether this fetaure is available in BPEL as our scenario requires us to explore if this functionality is available in BPEL.
Please let me know and also if possible please send me the links for the tutorials if it is available.
Thanks In Advance,
DibyaYes u can do it. there are two ways.
1) First one is using utl_http package of PL/SQL
In this case u can create SOAP request message & send it as Http request to your deployed BPEL process.
This package provides some methods like
set_header,write_text,get_response,read_text etc..
Following is part of code which may be helpful to you.
create or replace package body test_book_order_sub_pkg
is
FUNCTION test_book_order_sub(p_subscription_guid IN RAW,
p_event IN OUT WF_EVENT_T
Return VARCHAR2 IS
soap_request varchar2(30000);
soap_respond varchar2(30000);
http_req utl_http.req;
http_resp utl_http.resp;
launch_url varchar2(240) ;
begin
DBMS_OUTPUT.Put_Line('Subscription : Order has been booked');
soap_request:='<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body xmlns:ns1="http://xmlns.oracle.com/BES_BookOrder">
<ns1:BES_BookOrderProcessRequest>
<ns1:input>725</ns1:input>
</ns1:BES_BookOrderProcessRequest>
</soap:Body>
</soap:Envelope>';
http_req:= utl_http.begin_request
('http://172.28.5.191:8888/orabpel/default/BES_BookOrder/1.0',
'POST',
'HTTP/1.1'
utl_http.set_header(http_req, 'Content-Type', 'text/xml') ;
utl_http.set_header(http_req, 'Content-Length', length(soap_request)) ;
utl_http.set_header(http_req, 'SOAPAction', 'initiate');
utl_http.write_text(http_req, soap_request) ;
http_resp:= utl_http.get_response(http_req) ;
utl_http.read_text(http_resp, soap_respond) ;
utl_http.end_response(http_resp) ;
DBMS_OUTPUT.Put_Line(soap_respond);
return('SUCCESS');
end test_book_order_sub;
end test_book_order_sub_pkg;
2) Second way is make your BPEL process listening to some database Queue(use AQ Adapter). & then put some message in tht queue from ur Pl/SQL code . This will also initiate BPEL instance. Check out AQAdapter tutorials.
/mishit -
JCo client calls as background processes (avoiding timeouts)
Hi Guys!
Could you please assist us to resolve a simple issue:
Our JCo Client call takes sometimes longer than the given timout for sap dialog processes (so, it's now clear, the jco client simply uses the dialog processes and not something smarter/more flexible).
My question is, ho to entice the jco client call to run without runtime timeout and take as long time as necessary. If the only possibility is, to use the tRFC, does anybody have an example for tRFC usage from JCo Client?
Is also a JCo server component needed to implement some callback functionality from SAP system by using the tRFC, or it could be enough to poll the server and implement the timeout on the client level (it could be for us the best solution if we realy must use the tRFC).
Once again, we want to run the JCo client calls unlimited time (as long as needed) without the annoying dialog process timeout. The tRFC is not necessary by use cases now.
Any help would be appreciated!
Many thanks, GenaHi Gena,
so, it's now clear, the jco client simply uses the dialog processes and not something smarter/more flexible
Well, that's a feature of the underlying RFC protocol: All RFC calls are executed in dialog work processes, thus also the runtime limitations for dialog processes apply.
My question is, ho to entice the jco client call to run without runtime timeout and take as long time as necessary. If the only possibility is, to use the tRFC, does anybody have an example for tRFC usage from JCo Client?
The JCo client cannot do anything about it, it's a profile parameter in SAP, i.e. rdisp/max_wprun_time. But as this parameter applies to all dialog processes (so dialog users and RFC calls), so it shouldn't be changed to make a single RFC application work. Anyhow, tRFC won't help you in this case, because all RFC calls are processed in a dialog process no matter of the type of RFC.
Once again, we want to run the JCo client calls unlimited time (as long as needed) without the annoying dialog process timeout.
Impossible without making any changes in SAP. In theory one could modify the RFC function so that it resets the "runtime counter" and thus having the capability to run longer than rdisp/max_wprun_time. I'd recommend though not to do that, especially since a very long running RFC seems rather questionable. Long running tasks should be processed in background.
Cheers, harald -
Workflow Background processing.
Hi all,
Actually my client's requirement is: in Asset master once the Insurance expiry date is reached, automatically a mail shud be sent to concerned person.
Now how to do this?
One solution might be triggering WF once the Asset is created and then putting the Insurance expiry date thru expression in the Latest end of an Activity an when reached - Sending Mail. But as this has to be done automatically hence the task has to be a background task. Is this possible or is there any better way out.
Kindly suggest fast.
Regards,
Sudipto.Your best option is to write a simple report that runs in background everyday to scan the Asset Master and send the mails. You could group the assets by recipient in one mail. No reason to burden the WF system.
Your solution will work (using requested start rather than latest end)once after the first expiry date is reached. What happens after the insurance is renewed and expires again?
BTW, is your previous post below resolved?
Re: Workflow Problem.
Cheers,
Ramki Maley. -
Calling shell scripts from within Oracle PL/SQL codes
Hello,
We are migrating from informix to Oracle. In our Informix Stored Procedure we
were able to call Unix Shell Script by executing a 'SYSTEM' command, such as:
CREATE PROCEDURE magazine(flag1, flag2)
SYSTEM '/pics2/informix/mag.sh' || flag1 || flag2;
END PROCEDURE;
How can I write this in PL/SQL? Is there a simillar command for 'SYSTEM' in PL/SQL?
ThanksMike,
Wrong forum, for this question, suggest you ask it in the PL/SQL forum.
Jim Stern -
How can I call a COM object from a PL/SQL CODE
Hi everyone,
Does anyone know how to call a COM object from a stored procedure in oracle.
a sample of code
please help,
HilaireAre you familiar with external procedures? Basically, you can expose functions exported by a shared library (i.e. a DLL on Windows) to the Oracle database. My assumption is that you'd probably need to write a wrapper DLL around the COM object, since I believe you can only pass fundamental data types back and forth (i.e. no object references). You'd expose the method(s) of that wrapper DLL to the database via external procedures.
Justin
Distributed Database Consulting, Inc.
www.ddbcinc.com/askDDBC -
How to use Workflow Background Engine in Oracle Apps?
I have created the development of a custom workflow,tested it in Developer studio in Workflow administrator and has been working correctly. I was hoping to implement this workflow using Workflow background process Concurrent request and move to production.Unfortunately when submititng the concurrent request I am not receiving any notification eventhough all the time Concurrent request always completes normal.(Also when submitting as concurrent request workflow is not prompting for the itemkey). Is it not possible to implement a workflow in the application using background concurrent process? Any help is appreciated.
Please note that Workflow Background engine is used to process workflows that are in deferred status. It is not used to launch the workflow. You will have to write your own code to launch the Workflow using one of the following methods.
1. Use WF_ENGINE.CreateProcess and WF_ENGINE.LaunchProcess APIs.
2. Register a Business Event, create a subscription to the event to launch the workflow and raise the Business Event from your code.
Workflow Background Engine has parameters such as Itemtype, Min and Max Thresholds, Process Deferred, Process Timeout and Process Stuck... which basically determine the type of background work it has to do.
Please refer to Workflow Developer Guide on how to launch Workflows and the uses of Workflow Background Engine.
Thanks
Vijay -
How run a report in background process ?
Hi Experts,
I wrote a code in which I am have multiple selection screens....means in first screen there will 3 radio buttons.
So, depending upon the radio button selected, the other selction screen will be displayed...
So, here i want to run a report in background process...But in menubar im not able to find 'program'.
So, please help me this to run my report in background process.. with any simple code...
Thanks,
Rocky.Hi,
Try to see this example and adapt it for your case:
constants : c_jobname like tbtcjob-jobname value 'ZRFC_CM_38',
c_jobclass like tbtcjob-jobclass value 'A',
c_x type c value 'X',
c_msgclass type arbgb value 'ZXXXSD',
c_error type bapi_mtype value 'E',
c_status type bapi_mtype value 'S',
c_msg1 type msgnr value '177',
c_msg2 type msgnr value '178'.
data : v_jobcount like tbtcjob-jobcount.
ranges:
r_auart for vbak-auart,
r_wbstk for vbuk-wbstk,
r_mtart for mara-mtart,
r_reswk for ekko-reswk,
r_vtweg for vbak-vtweg.
call function 'JOB_OPEN'
exporting
jobname = c_jobname
importing
jobcount = v_jobcount
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if sy-subrc = 0.
Assignment of Ranges
append lines of:
distribution_channel to r_vtweg,
order_type_range to r_auart,
status_range to r_wbstk,
material_type_range to r_mtart,
plant_range to r_reswk.
Submit program in background
submit z_beve_salesorder_list
with p_spart = division
with p_file = file_name
with p_land1 = country
with s_vtweg in r_vtweg
with s_auart in r_auart
with s_wbstk in r_wbstk
with s_mtart in r_mtart
with s_reswk in r_reswk
via job c_jobname
number v_jobcount
and return.
Close the Job
call function 'JOB_CLOSE'
exporting
jobcount = v_jobcount
jobname = c_jobname
strtimmed = c_x
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
others = 9.
if sy-subrc = 0.
Status Message
return-type = c_status.
message id c_msgclass
type c_status
number c_msg1
into return-message
with c_jobname
sy-datum
sy-uzeit.
else.
Error Message
return-type = c_error.
message id c_msgclass
type c_error
number c_msg2
into return-message
with c_jobname.
endif.
endif.
Regards. -
Some background processes getting killed abruptly
Hi,
We have an E-Biz database and sometimes users complaint that some of the forms/JSP pages are not working fine. When i check the alert log, i find the following error messages which are marked as non critical.
Thu Oct 21 06:42:41 2010
Non critical error ORA-48913 caught while writing to trace file "/db1/ora1211/db/tech_st/11.1.0/admin/RGDB_orargpdb/diag/rdbms/rgdb/RGDB/trace/RGDB_ora_23488
.trc"
Error message: ORA-48913: Writing into trace file failed, file size limit [10485760] reached
Writing to the above trace file is disabled for now on...
Thu Oct 21 07:25:31 2010
ORA-00060: Deadlock detected. More info in file /db1/ora1211/db/tech_st/11.1.0/admin/RGDB_orargpdb/diag/rdbms/rgdb/RGDB/trace/RGDB_ora_26495.trc.
Thu Oct 21 09:24:04 2010
When i checked the background processes, mmon and mmnl processes were not running. When we restarted the database, everything started working fine.
this problems keep coming occasionally. Any help will be appreciated.Dear muneer.uae,
SHUTDOWN: waiting for logins to complete.&
PMON failed to delete process, see PMON trace fileWell i think those are enough for you to understand the problem but the important thing here to diagnose is the "deadlock". First of all forget about everything and answer the question "do you know what is a deadlock?". If your answer is no, please go to the http://tahiti.oracle.com and search for deadlock.
The problem is not the Oracle database, is the application that you are currently using. You have nothing to do about the suicide of the PMON and if you can not solve it by your own than you need to create an SR call.
Background processes "normally" do not kill theirselves.
Regards.
Ogan -
User exit during VF04 background process
Hi ,
I am creating billing through the background run of VF04.
Before a billing document is created I have to check the following condition.
If the payment terms of the relevant billing item not equal to 'X' then system shoudl check the billing date and only create billing document if the date is equal to system date.
If the payment terms is equal to 'X' then billing document should be created.
I am plannign to use the userexit RV60AFZC and in there
FORM USEREXIT_FILL_VBRK_VBRP
I tried to find out of this user exit was called during background processing of VF04 by putting ina breakpoint. It did not give any pop-up.During creation of billing through VF01 it gave me the breakpoint.
I want to know if for my requirement this is the right place to put the logic.
Regards
BGSHi ,
We had to change the logic and the user exit because it was not possible to pull the item level data into the VF04 screen.
We are trying to do the following with variant which looks for all billing items due in next 5 working days
Before system gets data from VKDFS into VKDFIF we are trying to aplly the logic
If Payment terms <> direct debit the include in the list VKDFIF
If Payment terms <> direct debit
Check IF Billing date <= system date
Yes -include in VKDFIF
No- Remove entry
When I call the variant in try to display the billing due list It shows the correct value
But when we run the same variant in backgorund it fails
BADI used
Include LV60AA93
Badi badi_sd_billing methode:vbrk_vbrp_fill
CALL METHOD l_sd_billing_item_exit->vbrk_vbrp_fill
Any help wpuld be appreciated -
Workflow background engine in Oracle inventory responsibility
12.0.6
we have scheduled Po approval and requisition in workflow backgraound engine to run every 5 mins which routes our Po`s and Req
But Workflow background engine has more than 100 item types
what are they all used for..its requests doesnt even have any output
Can someone please explain to me abt it and refer a document too
Thanks alot>
what you mean by this
We run Po approval and Requisition item types as its needed
Do you mean that we should run all more than 100 item types regularly or what?
Can you please refer me a document for it for my understanding
You are supposed to run the workflow background process for all item types (i.e do not pick a specific item type in the concurrent program submission window). Pl see these MOS Docs
466535.1 - How to Resolve the Most Common Workflow Background Engine Problems
266614.1 - Troubleshooting Workflow Issues in Applications 11i -
Accessing Secured Web Services fromPL/SQL Code.
Hi ,
This is an urgent requirement.We need to call a Web Sercured which is secured(That we need Authenticate using Digital Signatures).I don't how to call a Secured web service from PL/SQL code.with java it is possible.
Can anyone help me in confoguring/Writing code to call web services with Digital Certificates.
Regards,
RamIn the XmlDigester class you would have to change the following 2 functions...
public int Compare(Object x, Object y)
XmlAttribute lhs = (XmlAttribute)x;
XmlAttribute rhs = (XmlAttribute)y;
string ls = lhs.NamespaceURI;
string rs = rhs.NamespaceURI;
if ((ls == rs) || (ls.Equals(rs) && ls != null && rs != null))
ls = lhs.LocalName;
rs = rhs.LocalName;
if (ls == null)
return -1;
if (rs == null)
return 1;
byte[] larr = Encoding.UTF8.GetBytes(ls);
byte[] rarr = Encoding.UTF8.GetBytes(rs);
int len = Math.Min(larr.Length, rarr.Length);
for (int i = 0; i < len; i++)
int li = (int)(larr[i] & 0xFF);
int ri = (int)(rarr[i] & 0xFF);
int d = li - ri;
if (d != 0)
return d;
return larr.Length - rarr.Length;
private void Serialize(string s, Stream outStream)
byte[] bytes = Encoding.UTF8.GetBytes(s);
int len = bytes.Length;
Serialize((byte)(len >> 8), outStream);
Serialize((byte)(len), outStream);
Serialize(bytes, outStream);
That should do the trick. -
How to run an external application from PL/SQL code?
Hi,
I want to call an application like "Notepad" from PL/SQL code in a Windows2000 server. Is there any way to do that?
Thanks, best regards.
Paulo.declare
r varchar(4000);
begin
dbms_java.set_output(10000);
system_util.runshell('sh /ora9/runBackup.sh', r);
dbms_output.put_line(r);
end;
System_util package is
CREATE OR REPLACE PACKAGE System_Util IS
*System: Generic
*Package Name: System_util
*Description: This is an open source package which holds regular used
* methods by developers and dba's.
*Created by: Rae Smith
*Created Date: 27/06/2001
*Notes: This ia an free open source package that holds no warranty and
* therefore no-one connected to the development of this package
* can be made reasponsible for any outcomes by it's use.
MODIFICATION LOG**************************************************************
*DETAILS DATE VERS CHANGED BY
*===============================================================================
*Created 27-06-2001 1.0 Rae Smith
/********************************* Public Methhods ***************************************/
--- getDir returns the first directory value held in the init.ora file
FUNCTION getDir RETURN VARCHAR2;
--- getPrev.. returns the prevoise day from a gievn date
FUNCTION getPrevSat(pDate IN DATE) RETURN DATE;
FUNCTION getPrevSun(pDate IN DATE) RETURN DATE;
FUNCTION getPrevMon(pDate IN DATE) RETURN DATE;
FUNCTION getPrevTue(pDate IN DATE) RETURN DATE;
FUNCTION getPrevWed(pDate IN DATE) RETURN DATE;
FUNCTION getPrevThu(pDate IN DATE) RETURN DATE;
FUNCTION getPrevFri(pDate IN DATE) RETURN DATE;
--- isNumber returns TRUE or FALSE depending on a datatype passed
FUNCTION isNumber(pnumber IN VARCHAR2) RETURN BOOLEAN;
FUNCTION isNumber(pnumber IN NUMBER) RETURN BOOLEAN;
FUNCTION isNumber(pnumber IN DATE) RETURN BOOLEAN;
--- The writeFile allow you to write data to a file
--- writeFile has 2 Versions
--- v1 pass in the file name and the text to write to a file.
--- v2 pass in the file name, dbms_sql.varhar2s object
--- and the amount of rows to procces at a time
--- This enables you to write to afile in batch mode
PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2);
PROCEDURE writeFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER);
--- The appendFile methods allow you to append data to a file
--- This also has the inteligents to create the file if ts does not exist.
--- appendFile has 2 Versions
--- v1 pass in the file name and the text to write to a file.
--- v2 pass in the file name, dbms_sql.varhar2s object
--- and the amount of rows to procces at a time
--- This enables you to write to afile in batch mode
PROCEDURE appendFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER);
PROCEDURE appendFile(pName IN VARCHAR2, pText IN VARCHAR2);
--- The clearFile clears the data from a file.
PROCEDURE clearFile(pName IN VARCHAR2);
--- checkSyntax is a quick syntax checker for sql statements the is a limit to
--- the size used in the statement. If you have a error with
--- a statement then pass in the statement watch as it displays
--- the point where the error arose.
PROCEDURE checkSyntax(pSql IN VARCHAR2);
--- isEmpty this returns TRUE or FALSE
FUNCTION isEmpty(pValue IN VARCHAR2) RETURN BOOLEAN;
--- getTimeInMins returns the time in minutes for a specified date
FUNCTION getTimeInMins (pDate IN DATE) RETURN NUMBER;
--PROCEDURE get_time_in_mins (pDate IN DATE);
--- incDate returns a specified date incremented by value
FUNCTION incDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE;
--- decDate returns a specified date decremented by value
FUNCTION decDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE;
--- getTime returns the time in milliseconds
FUNCTION getTime RETURN NUMBER;
--- daysDiff returns the amount of days between two values
FUNCTION daysDiff(pHigh IN DATE, pLow IN DATE) RETURN NUMBER;
--- difference returns the diffeence between two numbers always
--- taking the lowest away from the highest
FUNCTION difference(pAnum IN NUMBER,pBnum IN NUMBER)RETURN NUMBER;
--- total returns the value of two numbers added together
FUNCTION total(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER;
--- numberToWords returns the string for a number passed in
FUNCTION numberToWords(pNumb IN NUMBER) RETURN VARCHAR2;
--- runShell allows you to run operating commands from pl/sql
--- Only available with 8i
--- PROCEDURE runShell(pCmnd IN VARCHAR2, pErrMsg IN OUT VARCHAR2);
/**************************** Public Vaiables *******************************/
--- Public variable that holds the operating system directory
--- that the can be written to from withing the database.
vDir VARCHAR2(50);
END;
CREATE OR REPLACE PACKAGE BODY System_Util IS
FUNCTION getDir RETURN VARCHAR2
IS
BEGIN
RETURN vDir;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('ERROR...ERROR...System_Util.getDir');
RAISE;
END getDir;
/**** Private module to get the first directory for utl_file to use ****/
PROCEDURE getDir
IS
CURSOR cDir(p1 IN VARCHAR2)
IS
SELECT DECODE(INSTR(value, ','), 0, value, SUBSTR(value, 1, INSTR(value, ',')-1)) dir
FROM v$parameter
WHERE name = p1;
BEGIN
FOR rDir IN cDir('utl_file_dir') LOOP
vDir := rDir.dir;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('ERROR...ERROR...System_Util.getDir');
RAISE;
END getDir;
FUNCTION getPrevDate(pDate IN DATE, pDay IN VARCHAR2) RETURN DATE
IS
BEGIN
RETURN NEXT_DAY(pDate - 7, pDay);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevDate;
FUNCTION getPrevSat(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'saturday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevSat;
FUNCTION getPrevSun(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'sunday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevSun;
FUNCTION getPrevMon(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'monday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevMon;
FUNCTION getPrevTue(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'tuesday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevTue;
FUNCTION getPrevWed(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'wednesday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevWed;
FUNCTION getPrevThu(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'thursday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevThu;
FUNCTION getPrevFri(pDate IN DATE) RETURN DATE
IS
BEGIN
RETURN getPrevDate(pDate, 'friday');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getPrevFri;
FUNCTION isNumber(pNumber IN VARCHAR2) RETURN BOOLEAN
IS
BEGIN
IF TO_NUMBER(pNumber)> 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END isNumber;
FUNCTION isNumber(pNumber IN NUMBER) RETURN BOOLEAN
IS
BEGIN
IF TO_NUMBER(pNumber) > 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END isNumber;
FUNCTION isNumber(pNumber IN DATE) RETURN BOOLEAN
IS
BEGIN
IF TO_NUMBER(TO_CHAR(pNumber, 'YYYYMMDD')) > 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END isNumber;
PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2)
IS
vFtype utl_file.file_type;
BEGIN
vFtype := UTL_FILE.FOPEN(vDir, pName,'w');
UTL_FILE.PUT_LINE(vFtype,pText);
UTL_FILE.FCLOSE(vFtype);
EXCEPTION
WHEN OTHERS THEN
UTL_FILE.FCLOSE(vFtype);
RAISE;
END writeFile;
PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2, pFtyp IN OUT utl_file.file_type)
IS
vFtype utl_file.file_type;
BEGIN
vFtype := UTL_FILE.FOPEN(vDir, pName,'w');
UTL_FILE.PUT_LINE(vFtype,pText);
UTL_FILE.FCLOSE(vFtype);
EXCEPTION
WHEN OTHERS THEN
UTL_FILE.FCLOSE(vFtype);
RAISE;
END writeFile;
PROCEDURE writeFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER)
IS
vFtype utl_file.file_type;
vText VARCHAR2(2000);
vCnt BINARY_INTEGER;
vRem BINARY_INTEGER;
vRowcnt PLS_INTEGER := 0;
BEGIN
vRem := MOD(pText.COUNT, pRows);
vFtype := UTL_FILE.FOPEN(vDir, pName, 'w');
vCnt := pText.FIRST;
LOOP
EXIT WHEN vCnt IS NULL;
vRowcnt := vRowcnt + 1;
IF vCnt = pText.LAST THEN
vText := vText||pText(vCnt);
UTL_FILE.PUTF(vFtype,vText);
UTL_FILE.FFLUSH(vFtype);
vText := '';
ELSIF MOD(vCnt, pRows) = 0 THEN
vText := vText||pText(vCnt)||'\n';
UTL_FILE.PUTF(vFtype,vText);
UTL_FILE.FFLUSH(vFtype);
vText := '';
ELSIF vRowcnt = vRem THEN
vText := vText||pText(vCnt)||'\n';
UTL_FILE.PUTF(vFtype,vText);
UTL_FILE.FFLUSH(vFtype);
ELSE
vText := vText||pText(vCnt)||'\n';
END IF;
vCnt := pText.NEXT(vCnt);
END LOOP;
UTL_FILE.FCLOSE(vFtype);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.WRITE_FILE');
UTL_FILE.FCLOSE(vFtype);
RAISE;
END writeFile;
PROCEDURE appendFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER)
IS
vFtype utl_file.file_type;
vText VARCHAR2(2000);
vCnt BINARY_INTEGER;
vRem BINARY_INTEGER;
vMode VARCHAR2(2) := 'a';
vRowcnt PLS_INTEGER := 0;
BEGIN
vRem := MOD(pText.COUNT, pRows);
vFtype := UTL_FILE.FOPEN(vDir, pName, vMode);
vCnt := pText.FIRST;
LOOP
EXIT WHEN vCnt IS NULL;
vRowcnt := vRowcnt + 1;
IF vCnt = pText.LAST THEN
vText := vText||pText(vCnt);
UTL_FILE.PUTF(vFtype,vText);
UTL_FILE.FFLUSH(vFtype);
vText := '';
ELSIF MOD(vCnt, pRows) = 0 THEN
vText := vText||pText(vCnt)||'\n';
UTL_FILE.PUTF(vFtype,vText);
UTL_FILE.FFLUSH(vFtype);
vText := '';
ELSIF vRowcnt = vRem THEN
vText := vText||pText(vCnt)||'\n';
UTL_FILE.PUTF(vFtype,vText);
UTL_FILE.FFLUSH(vFtype);
ELSE
vText := vText||pText(vCnt)||'\n';
END IF;
vCnt := pText.NEXT(vCnt);
END LOOP;
UTL_FILE.FCLOSE(vFtype);
EXCEPTION
WHEN UTL_FILE.INVALID_OPERATION THEN
IF vMode = 'a' THEN
writeFile(pName, pText, pRows);
ELSE
RAISE;
END IF;
WHEN OTHERS THEN
dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.APPENDFILE');
UTL_FILE.FCLOSE(vFtype);
RAISE;
END appendFile;
PROCEDURE appendFile(pName IN VARCHAR2, pText IN VARCHAR2)
IS
vFtype utl_file.file_type;
vMode VARCHAR2(2) := 'a';
BEGIN
vFtype := UTL_FILE.FOPEN(vDir, pName, vMode);
UTL_FILE.PUTF(vFtype, pText);
UTL_FILE.FFLUSH(vFtype);
UTL_FILE.FCLOSE(vFtype);
EXCEPTION
WHEN UTL_FILE.INVALID_OPERATION THEN
IF vMode = 'a' THEN
writeFile(pName, pText);
ELSE
RAISE;
END IF;
WHEN OTHERS THEN
dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.APPENDFILE');
UTL_FILE.FCLOSE(vftype);
RAISE;
END appendFile;
PROCEDURE clearFile(pName IN VARCHAR2)
IS
vFtype utl_file.file_type;
vText VARCHAR2(2000);
vCnt BINARY_INTEGER;
vRem BINARY_INTEGER;
vRowcnt PLS_INTEGER := 0;
BEGIN
vFtype := UTL_FILE.FOPEN(vDir, pName, 'w');
UTL_FILE.PUTF(vFtype,'');
UTL_FILE.FFLUSH(vFtype);
UTL_FILE.FCLOSE(vFtype);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('ERROR...ERROR...System_Util.CLEARFILE');
UTL_FILE.FCLOSE(vFtype);
RAISE;
END clearFile;
PROCEDURE checkSyntax(pSql IN VARCHAR2)
IS
sqlCur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
errPos PLS_INTEGER;
sqlStmt VARCHAR2(2000);
BEGIN
sqlStmt := pSql;
DBMS_SQL.PARSE(sqlCur, sqlStmt, DBMS_SQL.NATIVE);
EXCEPTION
WHEN OTHERS THEN
errPos := DBMS_SQL.LAST_ERROR_POSITION;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
DBMS_OUTPUT.PUT_LINE(sqlStmt);
DBMS_OUTPUT.PUT_LINE(' ');
DBMS_OUTPUT.PUT_LINE(LPAD('^', errPos, '-'));
DBMS_SQL.CLOSE_CURSOR(sqlCur);
END checkSyntax;
FUNCTION isEmpty(pValue IN VARCHAR2) RETURN BOOLEAN
IS
BEGIN
IF pValue IS NULL OR pValue = '' OR pValue = ' ' THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END isEmpty;
FUNCTION getTimeInMins (pDate IN DATE) RETURN NUMBER
IS
vHours NUMBER;
vMins NUMBER;
vRetval PLS_INTEGER;
BEGIN
vHours := TO_NUMBER(TO_CHAR(pDate,'HH24'));
vMins := TO_NUMBER(TO_CHAR(pDate,'MI'));
vRetval := ((60 * vHours) + vMins);
RETURN vRetval;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getTimeInMins;
PROCEDURE getTimeInMins (pDate IN DATE)
IS
vHours NUMBER;
vMins NUMBER;
vRetval PLS_INTEGER;
BEGIN
vHours := TO_NUMBER(TO_CHAR(pDate,'HH24'));
vMins := TO_NUMBER(TO_CHAR(pDate,'MI'));
vRetval := ((60 * vHours) + vMins);
DBMS_OUTPUT.PUT_LINE('The time IN minutes IS: '||vRetval);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getTimeInMins;
FUNCTION incDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE
IS
BEGIN
RETURN (TO_DATE(TO_CHAR(pDate + pInc, 'DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YYYY HH24:MI:SS'));
EXCEPTION
WHEN OTHERS THEN
RAISE;
END incDate;
FUNCTION decDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE
IS
BEGIN
RETURN (TO_DATE(TO_CHAR(pDate - pInc, 'DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YYYY HH24:MI:SS'));
EXCEPTION
WHEN OTHERS THEN
RAISE;
END decDate;
FUNCTION getTime RETURN NUMBER
IS
BEGIN
RETURN dbms_utility.get_time;
END getTime;
FUNCTION daysDiff(pHigh IN DATE, pLow IN DATE) RETURN NUMBER
IS
vHighdate DATE;
vLowdate DATE;
BEGIN
IF pHigh > pLow THEN
vHighdate := TO_DATE(TO_CHAR(pHigh, 'YYYYMMDD'), 'YYYYMMDD');
vLowdate := TO_DATE(TO_CHAR(pLow, 'YYYYMMDD'), 'YYYYMMDD');
ELSIF pLow > pHigh THEN
vHighdate := TO_DATE(TO_CHAR(pLow, 'YYYYMMDD'), 'YYYYMMDD');
vLowdate := TO_DATE(TO_CHAR(pHigh, 'YYYYMMDD'), 'YYYYMMDD');
END IF;
RETURN (vHighdate - vLowdate);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END daysDiff;
PROCEDURE dateCheck(pDateFrom IN OUT DATE, pDateTo IN OUT DATE)
IS
/* Declare the variable to hold the "from" date */
vDateFrom DATE;
BEGIN
/* If either date_from or date_to is null then set to todays date **
** using the sysdate **
** today's DATE AND IN the correct format */
pDateFrom := NVL(pDateFrom, SYSDATE);
pDateTo := NVL(pDateTo, SYSDATE);
/* Check that the from date is not greater than the to date if so **
** use the system_util.incDate to Increment the date by 1 day */
IF (pDateFrom > pDateTo) THEN
vDateFrom := pDateFrom;
pDateTo := System_Util.incDate(1, vDateFrom);
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
/* calculates the difference of two numbers always taken the high from the low*/
FUNCTION difference(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER
IS
vTotal NUMBER;
BEGIN
IF (pAnum > pBnum )OR (pAnum = pBnum)THEN
vTotal := (pAnum - pBnum);
ELSIF (pAnum < pBnum) THEN
vTotal := (pBnum - pAnum);
END IF;
RETURN (vTotal);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END difference;
/* calculates the Total of two numbers*/
FUNCTION total(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER
IS
vTotal NUMBER;
BEGIN
vTotal := (pAnum + pBnum);
RETURN (vTotal);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END total;
FUNCTION numberToWords(pNumb IN NUMBER) RETURN VARCHAR2
IS
vRetval VARCHAR2(255);
vNumb PLS_INTEGER;
BEGIN
vNumb := pNumb;
vRetval := REPLACE(TO_CHAR(TO_DATE(vNumb,'j'),'jsp'),'-',' ');
RETURN (vRetval);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
/*************** Only Available on 8i ********************************\
FUNCTION Catcherr(pStr IN VARCHAR2) RETURN VARCHAR2
IS
LANGUAGE JAVA
NAME 'catchErr.run(java.lang.String) return String';
PROCEDURE runShell(pCmnd IN VARCHAR2, pErrMsg IN OUT VARCHAR2)
IS
BEGIN
pErrMsg := Catcherr(pCmnd);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END runShell;
BEGIN
getDir;
END; -
How to design BPEL process where BPEL is called by PL/SQL code?
Hi,
My BPEL process is called by a PL/SQL code given below.
CREATE OR REPLACE PROCEDURE testd(errbuf OUT VARCHAR2,
retcode OUT VARCHAR2)
IS
soap_request VARCHAR2(20000);
soap_respond VARCHAR2(10000);
http_req UTL_HTTP.REQ;
http_resp UTL_HTTP.RESP;
l_detail VARCHAR2(10000);
endpoint VARCHAR2(130);
begin
endpoint := 'http://afsmlnx04.rheem.com:7105/soa-infra/services/default/HelloWorldPayload/bpelprocess1_client_ep';
soap_request := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://oracle.nl/HelloWorldPayload"><ns1:process><ns1:input>abc</ns1:input></ns1:process></soap:Body></soap:Envelope>';
http_req := utl_http.begin_request(
endpoint
, 'POST'
, 'HTTP/1.1'
utl_http.set_header(http_req
, 'Content-Type'
, 'text/xml');
utl_http.set_header(http_req
, 'Content-Length'
, length(soap_request));
utl_http.set_header(http_req
, 'SOAPAction'
, 'process');
utl_http.write_text(http_req, soap_request);
http_resp := utl_http.get_response(http_req);
utl_http.read_text(http_resp, soap_respond);
utl_http.end_response(http_resp);
dbms_output.put_line('soap'||soap_respond);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(http_resp);
WHEN utl_http.request_failed THEN
DBMS_OUTPUT.PUT_LINE('Request Failed: ' || utl_http.get_detailed_sqlerrm);
WHEN utl_http.http_server_error THEN
DBMS_OUTPUT.PUT_LINE('Server Error: ' || utl_http.get_detailed_sqlerrm);
WHEN utl_http.http_client_error THEN
DBMS_OUTPUT.PUT_LINE('Client Error: ' || utl_http.get_detailed_sqlerrm);
WHEN others THEN
DBMS_OUTPUT.PUT_LINE(sqlerrm);
END;
The above procedure will be defined as concurrent program in Oracle EBS.This concurrent program will call the bpel process.My question is how should i design the bpel process so that bpel will know it is called by a concurrent program?
My BPEL is doing picking a file by FTP adapter and inserting data into a table.
Please throw some lights on this!!Option 1:
You have to design the service as a synchronous BPEL process
1. Do a synchronous ftp get to read the file.
2. Transform and write it into database table
3. Reply results back to plsql
Disadvantage: Your BPEL process should complete from BPEL timeout happens.
Option 2:
1. Enqueue the message into AQ from the concurrent program
2. From the BPEL monitor the AQ, start the process when the message arrives
3. Do a synchronous ftp get to read the file.
4. Transform and write it into database table
You cannot reply the results back to concurrent program.
5. However, you could have another AQ to send the results back to concurrent program.
6. Your concurrent program should listen to the resultsAQ to get the results back from BPEL.
Option 2 is a relliable design.
--Prasanna
Maybe you are looking for
-
Please help!
-
i have updated my software from os lion to mavericks since then i cannot detect my display on my hd tv screen. if i need to do some settings kindly help me with that.. pls important
-
Error during this APL startup period - PI 7.0 SPS13
When we need to perform some maintenance in an application Server, we are stop this APL. During these steps, no problem in the XI System. We have the same procedure to startup and we only put APL again, the central instance is not affect and all XI
-
How do I find Ibook audio files on Mac?
An Ibook that i downloaded includes audio, i would like to be able to listen to the audio on my ipod instead of an ibook. Is it possible to transfer the files to itunes?
-
Condition types for service tax
Hi, We are configuring the system for TAXINN. Which condition types to be usd for service tax, ECess on service tax and HECess on service tax? are their any standard condition types for it or we need to create those? Regards,