‎2009 Nov 05 2:10 PM
Hi ,
I am training on OOPS which one of the concept is really trouble-shooting to understand.
In the class ...CL_SEND_BCS_EXAMPLE....
There is one Method called ASYNCHRONUS.
When i am chekcing the code inside the mehtod it has written as
TRY.
RAISE EVENT IP_OPS_METHOD~RAISE_ERROR.
ENDTRY.
i KNOW raise event is just like rasing the error which can be caught by
But when i double click..there is notjhing code it is written inside that event
I just want to know why this event is used here???
Sas
‎2009 Nov 10 8:22 AM
Hi saslove,
I really wonder where you do what kind of training. In our ECC600 system we have no class
CL_SEND_BCS_EXAMPLEWe don't even have any method called
ASYNCHRONUS.
Questions and answers are lot more helpful if they refer to something that exists.
Regards,
Clemens
‎2009 Nov 05 2:15 PM
Hi
The event is like an exception....a traffic light....no code there , the code is in the method is triggered as soon as the event is raised
Max
‎2009 Nov 06 1:37 AM
Max my concern is the same..............
There is nothing code in the method.......what it means?
It onlyhave
method aysncronous.
try.
raise event,
endtry.
endmethod.
It means callng Method itself raise event?(Raising error )
Sas
‎2009 Nov 06 4:44 AM
As Max said, raising an event is like setting a traffic light, or running a flag up a flagpole - you have to decide within your code how you want to react to that event - and you may chose to do nothing by not implementing a handler for it.
An example of this would be the ALV grid (class CL_GUI_ALV_GRID) where when the user double-clicks on a cell, the ALV grid class raises an event "double_click" - however your report may not support drill-down or similar processing, thus you won't implement code to handle that event... actually that CL_GUI_ALV_GRID class has over 40 events, and it's rare to need to trap more than a couple of them.
Take a look at the ABAP help on "set handler" and "raise event" - both have code examples in them.
Jonathan
‎2009 Nov 06 5:25 AM
Not Satisficatory.....................
But Jonathan thanks for taking pain to explain me......Is it mean that method which doesnt have any code except the raising events is nothing but calling the the method means raising the events???
Any Hint pls?????
Regards
Sas
Edited by: saslove sap on Nov 8, 2009 3:32 AM
‎2009 Nov 09 11:02 PM
If you want an example, take a look at BCALV_TEST_GRID_EVENTS - the selection screen gives you options for turning on "listening" logic for events that the ALV grid class may raise.
Jonathan
‎2009 Nov 08 9:41 AM
HI saslove;
I'm not on the system now. so I can't check the details.
In OO RAISE EVENT ans RAISE EXCEPTION is a big difference. If an event is raised, it will look what method of what class (instance) is registered for this event. Then this method (the 'listener') is executed.
Events are used in OO to establish the communication between instances of classes, 'notifiers' and 'listeners'.
Class-based Exceptions are raised to leave the current processing block immediately. They can (and should) be caught in a calling block.
Regards,
Clemens
‎2009 Nov 10 8:22 AM
Hi saslove,
I really wonder where you do what kind of training. In our ECC600 system we have no class
CL_SEND_BCS_EXAMPLEWe don't even have any method called
ASYNCHRONUS.
Questions and answers are lot more helpful if they refer to something that exists.
Regards,
Clemens
‎2009 Nov 10 4:17 PM
Thanks Clemens...Here i go with clear example which should exists in all the Systems..
Sorry for wrong input.
Please go to class se24 class: CL_BCS.
we can see one attribute send_request.
In the method select asynchronous doube clikc we can see code :
method asynchronous.
Call method: send_request ->get_asynshronus.
Receiving
Result = Result.
endmethod.
when we double click get_asynchronous it will refer to send_request type cls_send_request_bcs.
In the method get_asynchronus we have code as below
method get_asynchronus.
state read acess.-> this is amacro
result = result.
endmethod.
MACRO.
define read
Raise event if_os_state~read_access.----
>Here is the problem what i am discussing.
end of definition.
i know ~ stands for interface ...when i check read_acess it doenst have code it doenst have paramters.it is a event.
So my point is calling asynchronous method in CL_BCS class measn Raising the event?
Sas
‎2009 Nov 10 4:18 PM
Thanks Clemens...Here i go with clear example which should exists in all the Systems..
Sorry for wrong input.
Please go to class se24 class: CL_BCS.
we can see one attribute send_request.
In the method select asynchronous doube clikc we can see code :
method asynchronous.
Call method: send_request ->get_asynshronus.
Receiving
Result = Result.
endmethod.
when we double click get_asynchronous it will refer to send_request type cls_send_request_bcs.
In the method get_asynchronus we have code as below
method get_asynchronus.
state read acess.-> this is amacro
result = result.
endmethod.
MACRO.
define read
Raise event if_os_state~read_access.----
>Here is the problem what i am discussing.
end of definition.
i know ~ stands for interface ...when i check read_acess it doenst have code it doenst have paramters.it is a event.
So my point is calling asynchronous method in CL_BCS class measn Raising the event?
Sas
‎2009 Nov 10 5:07 PM
Hi saslove,
sometimes it is not required to understand everything.
Method
ASYNCHRONOUSreturns
VALUE( RESULT ) TYPE OS_BOOLEANwhich is a flag that informs you if the send request of the BCS object instance is created for asynchronous (background) processing.
This
ASYNCHRONOUSis called a functional method.
To determine the RESULT, a functional method of class
CL_SEND_REQUEST_BCSis called: Method
GET_ASYNCHRONOUSalso returns boolean value RESULT, this is just taken from the attribute, so
result = ASYNCHRONOUS.
This is the main function of the method.
The macro
state_read_accessraises event
READ_ACCESSwhich is defined in interface
IF_OS_STATE.
If in the class or an inherited class a handler for this event has been implemented and set for this event, this will automatically be triggered without any changes to the class.
This is what I tried to explain about the Notifier - Listener concept.
In this case to summarize: The function of Method
ASYNCHRONOUSis just to return a flag about the processing function (SYNCHRONOUS/ASYNCHRONOUS). As a side-effect, event
READ_ACCESSis triggered. This may be useful if any listeners are configured.
The Notifier - Listener concept is used when objects have to inform other objects about state changes: This is not hard-coded but implemented via so called loose-coupling. This allows you to exchange classes and objects freely.
[Page 44 ff - the observer pattern|http://books.google.com/books?id=LjJcCnNf92kC&printsec=frontcover&dq=designpatternshead+first&hl=de#v=onepage&q=&f=false]
is just an idea for further studies.
Regards,
Clemens
‎2009 Nov 10 5:14 PM
Hy Clemens
Wirklich dankt für den hilfreichen infomation .................
Von Morgen Arbeiten Arbeiten: (hat nur gebunden. ..............get zurück Sie tomorow
Noch einmal Dankt alot
Sas