2011 Aug 29 2:10 PM
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.
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.
2011 Aug 29 4:20 PM
Hi,
does a locking mechanism (kind of flag), or do you want to transfer data? Could you explain more about the scenario?
Sandra
2011 Aug 30 5:25 AM
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.
2011 Aug 30 5:41 AM
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.
2011 Aug 30 7:17 AM
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
2011 Aug 30 7:47 AM
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
2011 Aug 30 8:12 AM
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
2011 Aug 30 10:17 AM
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
2011 Aug 30 10:29 AM
For database, probably not an issue in your case.
For shared memory, use EXPORT TO SHARED MEMORY or EXPORT TO SHARED BUFFER
Sandra
2011 Aug 29 6:51 PM
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
2011 Aug 29 7:47 PM
One option is to use:
perform routine_name(ProgramB). in program A, where routine_name is a routine in program B.
2011 Aug 30 6:49 AM
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
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |