Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to handle events between programs ?

biju_john
Explorer
0 Likes
1,460

i have a program 'ProgramA' and another 'programB' one user is running programA and another is running ProgramB

when the user does some activity in programA i want an event to be triggered by ProgramA and that is to be handled by programB. its like notifying programB that when programA raises an event.

Hi,

does a locking mechanism (kind of flag), or do you want to transfer data? Could you explain more about the scenario?

Sandra

11 REPLIES 11
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,363

Hi,

does a locking mechanism (kind of flag), or do you want to transfer data? Could you explain more about the scenario?

Sandra

Read only

0 Likes
1,363

There is no locking mechanism involved and i dont want to transfer any data , its like normal event handling i have Raise Event in ProgramA and the setHandler in ProgramB , ProgramA is running in an external session and ProgramB is Running on another external session on the same applicaton server.

Read only

0 Likes
1,363

Use txns SM64 to create events and subsequently use the RAISE method of the CL_BATCH_EVENT class. This same class can also be used to create events.

Read only

0 Likes
1,363

did you mean to say use transaction sm62 to create an sap event , and raise the event from ProgramA , can you just elaborate on how to handel the scenario

Read only

0 Likes
1,363

Hi,

So, you want that programB executes immediately an ABAP code when it receives event from ProgramA.

But do you want that programB displays something when the event has been processed? In that case, all the input made by the user will be lost, the user will be unhappy!

I see 2 solutions :

1) "Good" : ProgramA writes its status into clustered database/shared memory DataA. When programB starts the "event", in fact it will run a background job with programC which reads the dataA. In case it is from memory, be careful to start programC in the same Application server.

2) "Bad" : ProgramB starts an asynchronous RFC with a callback procedure, to look up periodically (every 1 second?) at the "event" sent by ProgramA (do it like you want, database, memory, or whatever you want). As the RFC is processed as a dialog, it has a max duration (timeout after), so you should also re-start the RFC as soon as a certain delay is reached.

Sandra

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,363

Hello,

I have a couple of questions for you

If the execution of ProgB is dependent on execution of ProgA, imo they should not be started asynch. Since if you read Sandra's solution(s), at one point of time you need to "stop" ProgB & wait for the trigger from ProgA.

1. Can you not start ProgB in synch i.e., ProgB starts after ProgA ends? Or, do you want to achieve "paralled processing" thorugh this design?

2. If you want to go ahead with this design, how long do you want the user running ProgB to "wait" for event to be raised from ProgA?

BR,

Suhas

Read only

0 Likes
1,363

first of all i should thank sandra for the reply,

if i use database wont it affect the performance since the event has to be triggered frequently ,

since i am using 4.7 i don't have shared memory access.

as for suhas question

actually programA and ProgramB can be started independently programB doesnt depend on programA or viz , the only thing is that they are operating on the same set of data , so once user changes the data using ProgramA and saves , if another user is using ProgramB he should be notified that he should refresh his data. in a way i want ProgramA's changes to reflect on ProgramB

Read only

0 Likes
1,363

For database, probably not an issue in your case.

For shared memory, use EXPORT TO SHARED MEMORY or EXPORT TO SHARED BUFFER

Sandra

Read only

Amarpreet
Active Participant
0 Likes
1,363

you can use an if condition check and the submit ____ and return the other program based on that condition and passing data from the calling program to the called program ...

Edited by: alcoholix on Aug 29, 2011 7:51 PM

Edited by: alcoholix on Aug 29, 2011 7:52 PM

Read only

Former Member
0 Likes
1,363

One option is to use:

perform routine_name(ProgramB). in program A, where routine_name is a routine in program B.

Read only

Former Member
0 Likes
1,363

Go to SM64 and create and event- say ZEVENT1.

and then Use the RAISE method of the CL_BATCH_EVENT class or

use FM 'BP_EVENT_RAISE' to trigger the event .

-Sumit