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: 

event creation

Former Member
0 Kudos
254

Hi,

could anybody tell me how to create events?..plz its very urgent

thanks in advance

11 REPLIES 11

Former Member
0 Kudos
212

Hi..,

We will not create any events !!!!!

Instead we call them to execute a particular block of tasks at a particular time...

we call them using their keywards..

like ...

<b>At selection-screen -


> Before the selection screen is output.

At selection-screen -


> After user input on selection scree.

Start-of-selection -


> TO retrieve and process data..

End-of-selection -


> To display the data..

At line-selection -


> To generate secondary lists...

At user-command ......</b>

<b><u>Go through this simple code..</u></b>

selection-screen begin of block blck with frame .

parameters

p_date like sy-datum. " Input date.

selection-screen end of block blck.

data:

w_days type i. " Total number of days.

initialization . <----


EVENT

p_date = sy-datum - 1.

at selection-screen.

if p_date ca sy-abcde.

message 'Error' type 'E'.

enif.

end-of-selection. <----


EVENT

perform output.

form output .

write : 'The entered date is : '(002) , p_date,/ .

move p_date+6(2) to w_days.

write :

/'Total no of days from the 1st of the month to entered date :'(001),

w_days.

endform. " Form output

reward if it helps u...

sai ramesh

Former Member
0 Kudos
212

Hi

are you askinh this question with respect to Business Object Events, which are used in Tasks and in Workflow.

Every business object comes with predefined events.

if a particular event you need, that was not there in that object, then you have to copy that business object(for example BUS2032 salesorder) to Zobject and can create an event in SWO1 t code.

regards,

Anji

sreeramkumar_madisetty
Active Contributor
0 Kudos
212

Hi

Events are defaults in sap.

We won't create the events just we use the events in our reports as we will write certain code under certain events.

Regards,

kumar

0 Kudos
212

Could u be more specific.I am talikng about events related to process..where actually we ll careate these to trigger perticular process chain..

thanks

Former Member
0 Kudos
212

in this package u will obaerve more examples

"SABAPDOCU"

test these reports u will get good idea about reports

REPORT demo_program_end_of_selection .

NODES spfli.

DATA: spfli_tab TYPE SORTED TABLE OF spfli

WITH UNIQUE KEY cityfrom cityto carrid connid,

spfli_line TYPE spfli.

START-OF-SELECTION.

WRITE 'Demo program for END-OF-SELECTION'.

SKIP.

GET spfli FIELDS carrid connid cityfrom cityto.

MOVE-CORRESPONDING spfli TO spfli_line.

INSERT spfli_line INTO TABLE spfli_tab.

END-OF-SELECTION.

LOOP AT spfli_tab INTO spfli_line.

WRITE: / spfli_line-cityfrom,

spfli_line-cityto,

spfli_line-carrid,

spfli_line-connid.

ENDLOOP.

REPORT demo_program_stop .

NODES: spfli, sflight, sbook.

START-OF-SELECTION.

WRITE 'Test program for STOP'.

GET sbook.

WRITE: 'Bookid', sbook-bookid.

STOP.

END-OF-SELECTION.

WRITE: / 'End of Selection'.

Message was edited by:

sunil kumar

Former Member
0 Kudos
212

Please describe your requirement in detail.

If you just want to raise an EVENT you can use the available Function Modules

Regards,

Vishal

Former Member
0 Kudos
212

hi

try the following codes n let me know

*"Table declarations...................................................

tables:

sflight, " Flight master

spfli. " Flight schedule master

*"Selection screen elements............................................

selection-screen begin of block b1 with frame title tit.

select-options: s_carrid for spfli-carrid.

select-options: s_ctyfrm for spfli-cityfrom no intervals.

select-options: s_cityto for spfli-cityto no intervals.

selection-screen end of block b1.

selection-screen begin of block b2 with frame.

select-options: s_fldate for sflight-FLDATE.

selection-screen end of block b2.

"----


  • Field string to hold flight and scheduling data *

"----


data:

begin of fs_airline,

fldate type sflight-fldate, " Flight date

price type sflight-price, " Price

currency type sflight-currency, " Local currency of airline

carrid type sflight-carrid, " Carrier id

connid type sflight-connid, " Connection id

seatsmax type sflight-seatsmax, " Maximum seats

seatsocc type sflight-seatsocc, " Occupied seats

cityfrom type spfli-cityfrom, " City from

cityto type spfli-cityto, " City to

deptime type spfli-deptime, " Departure time

arrtime type spfli-arrtime, " Arrival time

end of fs_airline.

"----


  • Internal table to hold flight and scheduling data *

"----


data:

t_airline like

standard table

of fs_airline.

"----


  • INITIALIZATION *

"----


initialization.

tit = 'connections'.

"----


  • START-OF-SELECTION EVENT *

"----


start-of-selection.

perform get_flight_data.

"----


  • END-OF-SELECTION EVENT *

"----


end-of-selection.

perform print_list.

----


  • FORM GET_FLIGHT_DATA *

----


  • This subroutine retrieves necessary data from flight arrival and *

  • departure related table. *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form get_flight_data.

select sflight~fldate " Flight date

sflight~price " Price

sflight~currency " Local currency of airline

sflight~carrid " Carrier id

sflight~connid " Connection id

sflight~seatsmax " Maximum seats

sflight~seatsocc " Occupied seats

spfli~cityfrom " City from

spfli~cityto " City to

spfli~deptime " Departure time

spfli~arrtime " Arrival time

from sflight as sflight inner join spfli as spfli

on sflightcarrid eq spflicarrid

and sflightconnid eq spfliconnid

into corresponding fields of table t_airline

where sflight~carrid in s_carrid

and spfli~cityfrom in s_ctyfrm

and spfli~cityto in s_cityto

and sflight~fldate in s_fldate.

if sy-subrc ne 0.

message 'No records found'(001) type 'W'.

endif. " IF SY-SUBRC...

endform. " GET_FLIGHT_DATA

----


  • FORM PRINT_LIST *

----


  • This subroutine writes necessary data from internal table to list. *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form print_list.

loop at t_airline into fs_airline.

on change of fs_airline-connid.

format color 7.

write:

/5 fs_airline-cityfrom,

20 fs_airline-cityto,

40 fs_airline-carrid,

45 fs_airline-connid,

55 fs_airline-deptime,

65 fs_airline-arrtime.

format color off.

endon.

write:

/5 fs_airline-fldate,

15 fs_airline-price currency sflight-currency,

35 fs_airline-currency,

40 fs_airline-seatsmax,

50 fs_airline-seatsocc.

endloop. " LOOP AT T_AIRLINE...

********************************************************************************************

"----


  • Tables *

"----


tables:

sflight, " Flight master

spfli. " Flight schedule master

"----


  • Field string to hold flight schedule data *

"----


data:

begin of fs_spfli,

carrid type spfli-carrid, " Airline carrier id

connid type spfli-connid, " Flight connection number

airpfrom type spfli-airpfrom, " Departure airport

airpto type spfli-airpto, " Destination airport

deptime type spfli-deptime, " Departure time

arrtime type spfli-arrtime, " Arrival time

end of fs_spfli.

"----


  • Internal table to hold flight schedule data *

"----


data:

t_spfli like standard table

of fs_spfli.

"----


  • Type declaration of the structure to hold flight data *

"----


data:

begin of fs_sflight,

carrid type sflight-carrid, " Airline carrier id

fldate type sflight-fldate, " Flight date

seatsmax type sflight-seatsmax, " Maximum seats

seatsocc type sflight-seatsocc, " Occupied seats

end of fs_sflight.

"----


  • Internal table to hold flight data *

"----


data:

t_sflight like standard table

of fs_sflight.

*" Data declarations...................................................

"----


  • Work variables *

"----


data:

w_checkbox type c. " Checkbox variable

"----


  • START-OF-SELECTION EVENT *

"----


start-of-selection.

select carrid " Airline carrier id

connid " Flight connection number

airpfrom " Departure airport

airpto " Destination airport

deptime " Departure time

arrtime " Arrival time

into table t_spfli

from spfli.

set pf-status 'TOOL'.

if sy-subrc ne 0.

message 'No records found'(001) type 'S'.

endif. " IF SY-SUBRC...

"----


  • END-OF-SELECTION EVENT *

"----


end-of-selection.

loop at t_spfli into fs_spfli.

write:/ w_checkbox as checkbox,

fs_spfli-carrid,

fs_spfli-connid,

fs_spfli-airpfrom,

fs_spfli-airpto,

fs_spfli-deptime,

fs_spfli-arrtime.

hide: fs_spfli-carrid.

endloop. " LOOP AT T_SPFLI...

clear fs_spfli.

"----


  • AT USER-COMMAND EVENT *

"----


at user-command.

perform user_command.

"----


  • AT LINE-SELECTION EVENT *

"----


at line-selection.

if sy-lsind eq 1.

perform read_and_display_sflight.

endif. " IF SY-LSIND...

----


  • FORM READ_AND_DISPLAY_SFLIGHT *

----


  • This subroutine writes flight data. *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form read_and_display_sflight.

select carrid " Airline carrier id

fldate " Flight date

seatsmax " Maximum seats

seatsocc " Occupied seats

into table t_sflight

from sflight

where carrid eq fs_spfli-carrid.

if sy-subrc eq 0.

loop at t_sflight into fs_sflight.

write: / fs_sflight-fldate,

fs_sflight-seatsmax,

fs_sflight-seatsocc.

endloop. " LOOP AT T_SFLIGHT...

else.

message 'no data found' type 's'.

endif. " IF SY-SUBRC...

endform. " READ_AND_DISPLAY_SFLIGHT

----


  • FORM USER_COMMAND *

----


  • This subroutine prints the data based on whether the selected or *

  • deslected button is clicked. *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form user_command.

case sy-ucomm.

when 'SFLIGHT'.

perform selection.

when 'SELECTAL'.

if w_checkbox = ' '.

w_checkbox = 'X'.

loop at t_spfli into fs_spfli.

write:/ w_checkbox as checkbox,

fs_spfli-carrid,

fs_spfli-connid,

fs_spfli-airpfrom,

fs_spfli-airpto,

fs_spfli-deptime,

fs_spfli-arrtime.

endloop. " LOOP AT T_SPFLI...

endif. " IF W_CHECKBOX...

when 'DESELECTAL'.

if w_checkbox = 'X'.

w_checkbox = ' '.

loop at t_spfli into fs_spfli.

write:/ w_checkbox as checkbox,

fs_spfli-carrid,

fs_spfli-connid,

fs_spfli-airpfrom,

fs_spfli-airpto,

fs_spfli-deptime,

fs_spfli-arrtime.

endloop. " LOOP AT T_SPFLI...

endif. " IF W_CHECKBOX...

endcase. " CASE SY-UCOMM...

endform. " USER_COMMAND

----


  • FORM SELECTION *

----


  • This subroutine selects the required flight schedule data. *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form selection.

data:

begin of lt_spfli occurs 0,

carrid type spfli-carrid, " Airline carrier id

connid type spfli-connid, " Flight connection number

end of lt_spfli.

data:

lw_lines type i, " Number of lines

lw_lineno type i value 3, " Line number

lw_count type i. " Count variable

describe table t_spfli lines lw_lines.

do lw_lines times.

read line lw_lineno

field value w_checkbox into w_checkbox

fs_spfli-carrid into fs_spfli-carrid

fs_spfli-connid into fs_spfli-connid.

if sy-subrc eq 0.

if w_checkbox eq 'X'.

add 1 to lw_count.

clear w_checkbox.

lt_spfli-carrid = fs_spfli-carrid.

lt_spfli-connid = fs_spfli-connid.

append lt_spfli.

clear t_spfli.

endif. " IF W_CHECKBOX...

endif. " IF SY-SUBRC...

add 1 to lw_lineno.

enddo. " DO LW_LINES...

select carrid " Airline carrier id

fldate " Flight date

seatsmax " Maximum seats

seatsocc " Occupied seats

from sflight

into table t_sflight

for all entries

in lt_spfli

where carrid eq lt_spfli-carrid.

if sy-subrc eq 0.

loop at t_sflight into fs_sflight.

write :/20 fs_sflight-carrid,

fs_sflight-fldate,

fs_sflight-seatsmax,

fs_sflight-seatsmax.

endloop.

else.

message 'no data found' type 'S'.

endif. " IF SY-SUBRC...

endform. " SELECTION

reward if it helps

regards,

kiran kumar k

Former Member
0 Kudos
212

CREATING EVENTS...???

Message was edited by:

ananth

Former Member
0 Kudos
212

hi,

see this

TYPE-POOLS: SLIS.

DATA FS_INFO TYPE SLIS_LISTHEADER.

DATA T_INFO LIKE STANDARD TABLE OF FS_INFO.

FS_INFO-TYP = 'H'.

FS_INFO-KEY = 'LOGO'.

FS_INFO-INFO = 'JUST A SAMPLE TEST FOR THIS FUNCTION MODULE'.

APPEND FS_INFO TO T_INFO.

CLEAR FS_INFO.

TABLES SPFLI.

DATA FS_SPFLI LIKE SPFLI.

DATA T_SPFLI LIKE STANDARD TABLE OF FS_SPFLI.

SELECT *

FROM SPFLI

INTO TABLE T_SPFLI.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_CALLBACK_TOP_OF_PAGE = 'SUNIL'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

I_STRUCTURE_NAME = 'SPFLI'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = T_SPFLI

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

FORM SUNIL.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = T_INFO

I_LOGO = 'TRVPICTURE_REC_WIZ04'

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

ENDFORM.

except logo u give what u required

Former Member
0 Kudos
212

Hi Manjula,

get me your email-id i have some screen shots on event creation a.d some programs .i will send it to you.contact me in prejith_123@yahoo.com

regds,

Prajith

0 Kudos
212

Hi prajith,

send documents to manjula.vasidevadas@logicacmg.com..

thanks