‎2007 Jun 29 8:13 AM
HI,
WHAT ARE THE USER-DEFINED EVENTS ? HOW CAN WE RAISE PROGRAMMATICALLY
THANK YOU
ASHOK KUMAR
‎2007 Jun 29 11:11 AM
hi
7 events are there in classical report.
1.load of program.
2.initialization.
3.at selection screen
4.start of selection.
5.end of selection.
6.top of page.
7.end of page.
control level statements are
1.at new <f>
2.at end of <f>
3.at first
4.at last.
5.sum 6.on change of <f> etc.
drill down report events are
1.at line selection.
2.at user command.
3.at PF key
4.top of page during line selection.
example program for events in classical report.
report line-count 2(25) line-size 200.
TABLES : KNA1.
DATA: WA_CUST TYPE KNA1,
IT_CUST TYPE TABLE OF KNA1.
DATA T1 TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS CUST FOR KNA1-KUNNR .
SELECTION-SCREEN END OF BLOCK BL1.
INITIALIZATION.
T1 = 100.
*
*
AT SELECTION-SCREEN.
if cust eq space.
MESSAGE W000(8I) with TEXT-101.
E - Error - Stop the process
I - Information - Display message and Continue with process
W - Warning - Display warning and stop till the Enter is hited
again
endif.
AT SELECTION-SCREEN ON HELP-REQUEST for cust-low.
T1 = 200.
*
*
*
END-OF-SELECTION.
LOOP AT IT_CUST INTO WA_CUST.
WRITE: / WA_CUST-KUNNR, WA_CUST-NAME1, WA_CUST-ORT01.
ENDLOOP.
START-OF-SELECTION.
SELECT * FROM KNA1 INTO TABLE IT_CUST WHERE KUNNR IN CUST.
TOP-OF-PAGE.
write 'Customer Details'.
end-of-page.
write: / 'Eminent Technologies'.
‎2007 Jun 29 8:17 AM
HI,
see this example.
REPORT demo_class_counter_event.
CLASS counter DEFINITION.
PUBLIC SECTION.
METHODS increment_counter.
EVENTS critical_value EXPORTING value(excess) TYPE i.
PRIVATE SECTION.
DATA: count TYPE i,
threshold TYPE i VALUE 10.
ENDCLASS.
CLASS counter IMPLEMENTATION.
METHOD increment_counter.
DATA diff TYPE i.
ADD 1 TO count.
IF count > threshold.
diff = count - threshold.
RAISE EVENT critical_value EXPORTING excess = diff.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS handler DEFINITION.
PUBLIC SECTION.
METHODS handle_excess
FOR EVENT critical_value OF counter
IMPORTING excess.
ENDCLASS.
CLASS handler IMPLEMENTATION.
METHOD handle_excess.
WRITE: / 'Excess is', excess.
ENDMETHOD.
ENDCLASS.
DATA: r1 TYPE REF TO counter,
h1 TYPE REF TO handler.
START-OF-SELECTION.
CREATE OBJECT: r1, h1.
SET HANDLER h1->handle_excess FOR ALL INSTANCES.
DO 20 TIMES.
CALL METHOD r1->increment_counter.
ENDDO.
<b>reward if helpful</b>
rgds,
bharat.
‎2007 Jun 29 9:14 AM
hi
check with this program to handle events
&----
*& Report ZAACLC_REPORT
*&
&----
*&
*&
&----
REPORT zaaclc_report.
----
CLASS lcl_test_class DEFINITION
----
*
----
CLASS lcl_test_class DEFINITION.
PUBLIC SECTION.
METHODS increment_counter.
EVENTS break_statement EXPORTING value(count) TYPE i.
PRIVATE SECTION.
DATA: num TYPE i,
max TYPE i VALUE 5.
ENDCLASS. "lcl_test_class DEFINITION
----
CLASS lcl_test_class IMPLEMENTATION
----
*
----
CLASS lcl_test_class IMPLEMENTATION.
METHOD increment_counter.
num = num + 1.
IF num EQ max.
RAISE EVENT break_statement EXPORTING count = num.
ENDIF.
WRITE:/ num .
ENDMETHOD. "increment_counter
ENDCLASS. "lcl_test_class IMPLEMENTATION
----
CLASS event_receiver DEFINITION
----
*
----
CLASS event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handler FOR EVENT break_statement OF lcl_test_class IMPORTING count.
endclass.
----
CLASS event_receiver IMPLEMENTATION
----
*
----
CLASS event_receiver IMPLEMENTATION.
METHOD handler.
count = count + 10.
WRITE 😕 count.
WRITE 😕 'Event Raised'.
endmethod.
ENDCLASS. "event_receiver IMPLEMENTATION
DATA:obj TYPE REF TO lcl_test_class,
rec TYPE REF TO event_receiver.
START-OF-SELECTION.
CREATE OBJECT: obj,rec.
set handler rec->handler for obj." for all instances.
DO 10 TIMES.
CALL METHOD obj->increment_counter.
ENDDO.
regards
dinesh
‎2007 Jun 29 9:16 AM
Hi,
Events are the markers that define certain code that is to occur at certain time in the pgm.They help how your pgm should run.
Certain events governed by the AT COMMAND, for ex: used in interactive report.
Other events like INITIALIZATION, and START-OF-SELECTION., defines at the data selection occurs.
The EVENTS are :
INITIALIZATION.
START-OF-SELECTION
END-OF-SELECTION
AT USER-COMMAND
AT LINE-SELECTION
AT PFFUNCTION KEY NUMBER
AT SELECTION-SCREEN
AT NEW FIELD
AT END OF FIELD
AT FIRST
AT LAST
AT FIELD-GROUP.
example1
data: p_year for sy-datum.
initialization.
if sy-datum ge '28062007'
p_year = '2007'
else
p_year = 'yesteryear'.
endif.
example 2.
selectio-screen pushbutton10(20) text-0001 user-command engl.
selectio-screen pushbutton50(20) text-0002 user-command germ.
at selection-screen.
at user-command
case sy-ucomm.
when 'engl'.
lang-english = 'y'.
when 'germ'.
lang-german = 'y'.
endcase.
we can use similarly all the events.
Regards
Raghavendra.D.S.
‎2007 Jun 29 10:47 AM
Hi Ashok
<b>Events:</b> <b>Application:</b>----
-
Print-end_of_list Define output text to be printed at the end of the entire list
Print-top_of_list Define output text to be printed at the beginning of the entire list
Print-end_of_page Define output text to be printed at the end of each page
Print-top_of_page Define output text to be printed at the beginning of each page
subtotal_tesxt Define self-defined subtotals texts.
This events will be used for ALV report.
If its useful reward points
Thanks
senthil
‎2007 Jun 29 11:11 AM
hi
7 events are there in classical report.
1.load of program.
2.initialization.
3.at selection screen
4.start of selection.
5.end of selection.
6.top of page.
7.end of page.
control level statements are
1.at new <f>
2.at end of <f>
3.at first
4.at last.
5.sum 6.on change of <f> etc.
drill down report events are
1.at line selection.
2.at user command.
3.at PF key
4.top of page during line selection.
example program for events in classical report.
report line-count 2(25) line-size 200.
TABLES : KNA1.
DATA: WA_CUST TYPE KNA1,
IT_CUST TYPE TABLE OF KNA1.
DATA T1 TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS CUST FOR KNA1-KUNNR .
SELECTION-SCREEN END OF BLOCK BL1.
INITIALIZATION.
T1 = 100.
*
*
AT SELECTION-SCREEN.
if cust eq space.
MESSAGE W000(8I) with TEXT-101.
E - Error - Stop the process
I - Information - Display message and Continue with process
W - Warning - Display warning and stop till the Enter is hited
again
endif.
AT SELECTION-SCREEN ON HELP-REQUEST for cust-low.
T1 = 200.
*
*
*
END-OF-SELECTION.
LOOP AT IT_CUST INTO WA_CUST.
WRITE: / WA_CUST-KUNNR, WA_CUST-NAME1, WA_CUST-ORT01.
ENDLOOP.
START-OF-SELECTION.
SELECT * FROM KNA1 INTO TABLE IT_CUST WHERE KUNNR IN CUST.
TOP-OF-PAGE.
write 'Customer Details'.
end-of-page.
write: / 'Eminent Technologies'.