‎2007 Feb 12 2:16 PM
Hi,
Can anyuone please tell me how to trigger an event ? Kindly send me a small code .
regards,
Vijay
********REPLIES TO BE DEFINETELY REWARDED********
‎2007 Feb 12 2:17 PM
Are you referring to events in ALV's or.. anything else? Can you please be specific?
Regards,
Sankar.
‎2007 Feb 12 2:18 PM
Hello,
Check these Demo Programs:
demo_program_initialization
demo_program_start_of_selectio.
demo_program_end_of_selection
demo_program_stop
demo_program_exit_1
Vasanth
‎2007 Feb 12 2:19 PM
hi,
report ztest.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS: p_emp LIKE rlgrap-filename,
p_empt LIKE rlgrap-filename,
p_cont LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK block1.
*at selection-screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_emp.
REFRESH: it_tabemp.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
initial_directory = 'C:'
multiselection = ' ' "No multiple selection
CHANGING
file_table = it_tabemp
rc = gd_subrcemp.
LOOP AT it_tabemp INTO p_emp.
in the above code when you click the button on p_emp parameter
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_emp. gets triggered
Regards,
Santosh
‎2007 Feb 12 2:19 PM
Check Transaction SM64, it calls the function module 'BP_EVENT_RAISE'.
call function 'BP_EVENT_RAISE'
exporting
eventid = btch1250-eventid
eventparm = btch1250-parameter
exceptions
bad_eventid = 1
eventid_does_not_exist = 2
eventid_missing = 3
raise_failed = 4
others = 99.
case sy-subrc.
when 0.
message s250 with btch1250-eventid.
when 1.
message e042 with btch1250-eventid.
when 2.
message e042 with btch1250-eventid.
when 3.
message e038.
when 4.
message e249 with btch1250-eventid.
endcase.
Good luck,
Leonardo De Araujo
‎2007 Feb 12 2:21 PM
Assuming you are talking about job events... if it is class related it is another story.
Leo
‎2007 Feb 12 2:29 PM
Hi,
Thanks a lot for your reply. I have a small clarification.Please reply.
I am calling the event from a BADI. The object is ZBUS20001 and the event I want to trigger is ZTESTCREATE.
Please tell me how to write the code. Kindly help.
Thanks a lot once again for your reply.
Regards,
Vijay
***I Shall definetely reward you*****
‎2007 Feb 12 2:36 PM
Call this way.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'ZBUS20001'
OBJKEY = <Object key >
EVENT = 'ZTESTCREATE'
TABLES
EVENT_CONTAINER = IT_CONTAINER "Fill the it_container using macros
EXCEPTIONS
OBJTYPE_NOT_FOUND = 1
OTHERS = 2.
REgards,
Ravi
‎2007 Feb 12 2:22 PM
Hi,
Normally we trigger the Events using <b>RAISE EVENT</b> ..
<b>Declaring Events</b>
You declare events in the declaration part of a class or in an interface. To declare instance events, use the following statement:
EVENTS evt EXPORTING... VALUE(e1 e2 ...) TYPE type [OPTIONAL]..
To declare static events, use the following statement:
CLASS-EVENTS evt...
Both statements have the same syntax.
When you declare an event, you can use the EXPORTINGaddition to specify parameters that are passed to the event handler. The parameters are always passed by value. Instance events always contain the implicit parameter SENDER, which has the type of a reference to the type or the interface in which the event is declared.
<b>Triggering Events</b>
An instance event in a class can be triggered by any instance method in the class. Static events can be triggered by any method. However, static methods can only trigger static events. To trigger an event in a method, use the following statement:
RAISE EVENT evt EXPORTING e1 = f1 e2 = f2 ...
For each formal parameter e1 that is not defined as optional, you must pass a corresponding actual parameter f1 in the EXPORTING addition. The self-reference me is automatically passed to the implicit parameter sender.
Regards
Sudheer
‎2007 Feb 12 2:58 PM
Hi,
INIT_EVENT_RAISE for Triggering the INIT event
BP_EVENT_RAISE for Trigger Background Event
RFC_RAISE_ERROR for RFC Event.
In the above function modules pass OBJTYPE = 'ZBUS20001' and EVENT = 'ZTESTCREATE'
Regards
Sudheer