Check for Open Applications

Pardha

Active Member
Hi List,

I have a need to check if a specific application is already running. I need to write this code in one of the custom application. In this custom application, I need to check if the business user already started P43070. If he/she did start/open the application, then I need to perform some logic.

I searched to my best abilities for past posts with very little luck.

Help appreciated.

Thanks in advance.

Pardha
E1 9.0 with 8.9.8 Tools, Oracle
 
I am not aware of anything that will tell you this out of the box. Might be there, just don't know.

You could always roll your own by modifying P43070. When the app launches simply write a record to jdeCache when the APPL starts and delete the record when it terminates. Then whatever needs to check if the APPL is running can simply look to see if a jdeCache record exits or not.
 
I have a work table in place for a different purpose. I could definetly use your suggestion. I choose physical table is mainly because to keep an audit trail of some of the activities. I read lot of your posts. You are one of the core developers out there. Any hints on how to use the jdeCache method (sample code)?

Much appreciated.
Pardha
 
Hi Pardha

unfortunately, E1 does not store this info any where. So you cannot check this. ON SAW you can see the application that a user have it open. But not sure if there is ANY way to tap into SAW from E1 application. As others has suggested, you might want to write a custom code at the launch of your application to log it in db table . This way you can check the status of application later on
 
You could use a custom DB work table just as easily as jdeCache (just include user name in your key). In fact if you need to make sure that only one instance of an application is running across ALL users you would HAVE to use a work table since jdeCache instances are created per user session.

If you only want one instance of the application running PER USER than I would use jdeCache simply because it is faster and cleaner (provided of course you dont need an audit trail). Just use the shared cache pattern in that the cache name is static (no unique identifier is appended to the cache name to create unique instances). That way anything can read from the cache and doesn't need to know any unique identifier or anything. If you are looking for sample jdeCache code I wrote an article for jdeTips that has some simple working examples.

Whether jdeCache or a DB work table I would create a general purpose BSFN for this:

ObjectRunningInstanceCount
-> szObjectName[11]
-> nAction
<- nInstanceCount //value AFTER increment or decrement

//values for ObjectRunningInstanceCount.nAction
enum
{
BXXXXX_ACTION_GET,
BXXXXX_ACTION_INCREMENT,
BXXXXX_ACTION_DECREMENT
} BXXXXX_ACTION;


Then you can call the function when the form initializes and terminates and write logic based on the number of instances running.
 
Another thought would be to use the F00095 Business Object Reservation table and the function N0000602. Have app A record a reservation for program/user. Have app B try the same. If it fails, you know the app is "in use".
 
This could work. Keep in mind, the only thing to watch for is on some E1 app versions, F00095 will not lock an object for multiple instances of an application by the same user. In other words if you lock Pxxxx as the object for user JSmith and then JSmith opens another instance of Pxxxx, the object reservation routines won't necessarily report that Pxxxx is locked. In order for this to work you will need to generate a unique key for the APP id.
 
Isn't the underlying issue, more-so, to identify when an application "isn't" running?

We can always turn on a flag 'somehow' that says "I'm Running" - whether that be in cache or in some sort of work-table. However, if the application does not end properly, there isn't a simplified way to yell, "I'm not Running Anymore"....

Solve the second half, before the first (how do you know it's not running)....

(db)
 
This is why I love the list. Thanks you all for the ideas. I am going with a work table to identify who started the application and has it been closed. I am updating the table entry in the EndDialog of the app. Based on my testing, EndDialog gets triggered even if you time out and/or power down your computer.

Sometimes, I like to spend whole lot of time exploring the great suggestion you folks throw at me. Unfortunately I got to deal with the other production issues lined up on my desk. If anyone experiments other approaches, please update the thread.

Thanks a lot for all your suggestions. Have a super day.

Pardha
 
Back
Top