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: 
Read only

event programing

Former Member
0 Likes
690

Hi All,

I would like to run an abap program in background after tcode VL02n of Goods issue button has been saved, In the user exit (USEREXIT_SAVE_DOCUMENT_PREPARE) of the VL02n, I should create the job that will run the abap program. after the VL02n is saved, I should create an event with SM62, and using function module 'BP_EVENT_RAISE' in the program should triger the event, Please anybody could contribute the sample programs to refer the coding for function module 'BP_EVENT_RAISE' so that it would be easy to me to understand the functionality of the FM 'BP_EVENT_RAISE' .

Thanks.

Regards,

Anil

5 REPLIES 5
Read only

Former Member
0 Likes
658

Hi,

define an event using SM62

set the start-time for the process-chain on "after event" and insert your just created event in the appropriate field

CALL FUNCTION 'BP_EVENT_RAISE'

EXPORTING

eventid = string

EXCEPTIONS

bad_eventid = 1

eventid_does_not_exist = 2

eventid_missing = 3

raise_failed = 4

OTHERS = 5.

.

IF sy-subrc 0.

f_calc_error = 'X'.

ENDIF.

the variable string has to contain your event

Regards,

Raj.

Read only

0 Likes
658

Hi Raj,

This much is not adequate to understand I need step by step process please, because this much I m unable to understand.

Regards,

Srinivasa

Read only

Former Member
0 Likes
658

Hi,

FM 'BP_EVENT_RAISE' is used to trigger Background Event.

Trigger an event in the background processing system. This function module is for use in programs written in ABAP/4. Triggering an event tells the background processing system to start any background jobs that were scheduled to wait for the event.

You can trigger an event with or without an event argument, a string that more precisely identifies an event. Jobs can be scheduled to wait for an event for the combination of event and a particular event argument.

EVENTID is just an identifier to locate the event.

You can find this event in transaction SWEL/SWE2 transactions.

see the sample code

report zsystem_copy_check .

data: i_zzcopytest type table of zzcopytest with header line,

i_zsystem_info type table of zsystem_info with header line,

i_mshost type syhost,

i_message type string,

i_event type btceventid.

  • ......................

  • Get mshost

call 'C_SAPGPARAM' id 'NAME' field 'rdisp/mshost'

id 'VALUE' field i_mshost.

  • ......................

  • Check if system was just copied and if so, trigger corresponding event

  • for conversion

select single * into i_zzcopytest from zzcopytest

where sys = sy-sysid

and server = i_mshost.

if sy-subrc eq 0.

i_zzcopytest-datum = sy-datum.

i_zzcopytest-uhrzeit = sy-uzeit.

update zzcopytest from i_zzcopytest.

else.

i_zzcopytest-sys = sy-sysid.

i_zzcopytest-server = i_mshost.

i_zzcopytest-datum = sy-datum.

i_zzcopytest-uhrzeit = sy-uzeit.

insert zzcopytest from i_zzcopytest.

select single * from zsystem_info into i_zsystem_info

where sid = sy-sysid and

mshost = i_mshost.

if sy-subrc = 0.

i_event = 'CONVERT'.

else.

i_event = 'ULOC'.

endif.

call function 'BP_EVENT_RAISE'

exporting

eventid = i_event

exceptions

bad_eventid = 01

eventid_does_not_exist = 02

eventid_missing = 03

raise_failed = 04.

if sy-subrc eq 0.

concatenate text-001 i_event text-002 into i_message.

else.

concatenate text-001 i_event text-003 into i_message.

endif.

message s398(00) with i_message.

endif.

Regards

Kiran Sure

Read only

0 Likes
658

Hi Kiran,

Can you send me the step by step process if possible, because this much I m unable to understand.

Regards,

Srinivasa

Read only

Former Member
0 Likes
658

Thread closed