Skip to Content
0
Former Member
Jun 24, 2008 at 08:55 AM

ECC6.0: Function SWE_EVENT_CREATE changed. Now error: No receiver entered.

210 Views

Upgrading from 46C to ECC6.0.

Issue: When triggering the event no receiver is found...

Although in SWE3 settings have been made and the receiver function module was entered.

Object Category:              BOR Object Type
Object Type:                  Z_BP
Event:                        UPDATEDONE
Receiver Type :               EVENTITEM
 
Receiver Call:                Function Module
Receiver Function Module:     SWW_EI_EVENT_RECEIVE

Behavior Upon Error Feedback: System defaults
Receiver Status:              No errors.

Looking at the new version of the function module in ECC6.0 I can see that the whole 'Receiver' part is commented out...

Has anyone else encountered this issue before? What's the solution?

New Function module in ECC6.0::

FUNCTION swe_event_create.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(OBJTYPE) LIKE  SWETYPECOU-OBJTYPE
*"     VALUE(OBJKEY) LIKE  SWEINSTCOU-OBJKEY
*"     VALUE(EVENT) LIKE  SWETYPECOU-EVENT
*"     VALUE(CREATOR) LIKE  SWHACTOR STRUCTURE  SWHACTOR
*"         DEFAULT SPACE
*"     VALUE(TAKE_WORKITEM_REQUESTER) LIKE  SWEFLAGS-WIREQFLAG
*"         DEFAULT SPACE
*"     VALUE(START_WITH_DELAY) LIKE  SWEFLAGS-DELAYFLAG DEFAULT SPACE
*"     VALUE(START_RECFB_SYNCHRON) LIKE  SWEFLAGS-SYNCFLAG
*"         DEFAULT SPACE
*"     VALUE(NO_COMMIT_FOR_QUEUE) LIKE  SWEFLAGS-COMMITFLAG
*"         DEFAULT SPACE
*"     VALUE(DEBUG_FLAG) LIKE  SWEFLAGS-DEBUGFLAG DEFAULT SPACE
*"     VALUE(NO_LOGGING) LIKE  SWEFLAGS-LOGFLAG DEFAULT SPACE
*"     VALUE(IDENT) LIKE  SWEDUMEVID-EVTID OPTIONAL
*"  EXPORTING
*"     VALUE(EVENT_ID) LIKE  SWEDUMEVID-EVTID
*"     VALUE(RECEIVER_COUNT) LIKE  SWEDUMEVID-EVTID
*"  TABLES
*"      EVENT_CONTAINER STRUCTURE  SWCONT OPTIONAL
*"  EXCEPTIONS
*"      OBJTYPE_NOT_FOUND
*"----------------------------------------------------------------------
*- begin of local data
  DATA: l_event              TYPE REF TO if_swf_evt_event.
  DATA: l_container          TYPE REF TO if_swf_cnt_container.
  DATA: l_parameters         TYPE REF TO if_swf_ifs_parameter_container.
  DATA: lt_bor_container     TYPE swconttab.
  DATA: lex_exc              TYPE REF TO cx_swf_evt_exception.
  DATA: l_selected_handlers  TYPE i.
  DATA: lcl_event            TYPE REF TO cl_swf_evt_event.
*- end   of local data

  TRANSLATE event TO UPPER CASE.                          "#EC SYNTCHAR
**** begin of note 837313
  TRANSLATE objtype TO UPPER CASE.                        "#EC SYNTCHAR
**** end of note 837313

  IF NOT event_container[] IS INITIAL.
*-- create a container and import the given elements
    TRY.
        CALL METHOD cl_swf_cnt_factory=>create_event_container
          EXPORTING
            im_objcateg = swfco_objtype_bor
            im_objtype  = objtype
            im_event    = event
          RECEIVING
            re_instance = l_container.
      CATCH cx_swf_utl_obj_create_failed .              "#EC NO_HANDLER
      CATCH cx_swf_utl_no_instance_found .              "#EC NO_HANDLER
    ENDTRY.

    IF NOT l_container IS INITIAL.
      lt_bor_container[] = event_container[].

      TRY.
          CALL METHOD l_container->import_from_bor_container
            EXPORTING
*              IMPORT_PARAM          = 'X'
*              EXPORT_PARAM          = 'X'
*              CHANGING_PARAM        = 'X'
*              RETURNING_PARAM       = 'X'
*              SUPPRESS_OTHERS       = SPACE
              values                = lt_bor_container
              .
        CATCH cx_swf_cnt_element.                       "#EC NO_HANDLER
      ENDTRY.
    ENDIF.
  ENDIF.

  l_parameters ?= l_container.
*- get the event
  CALL METHOD cl_swf_evt_event=>get_instance
    EXPORTING
      im_objcateg        = cl_swf_evt_event=>mc_objcateg_bor
      im_objtype         = objtype
      im_event           = event
      im_objkey          = objkey
      im_event_container = l_parameters
    RECEIVING
      re_event           = l_event.

*- set some properties (if needed)
  IF NOT creator IS INITIAL.
    CALL METHOD l_event->set_creator( creator ).
  ENDIF.

*- property: delay
  IF NOT start_with_delay IS INITIAL.
    CALL METHOD l_event->set_property
      EXPORTING
        im_property = if_swf_evt_event=>mc_prop_start_with_delay
        im_value    = 'X'.
  ENDIF.

*- property: synchron
  IF NOT start_recfb_synchron IS INITIAL.
    CALL METHOD l_event->set_property
      EXPORTING
        im_property = if_swf_evt_event=>mc_prop_sync_no_commit
        im_value    = 'X'.
  ENDIF.

*- property: qsyncinsert
  IF NOT no_commit_for_queue IS INITIAL.
    CALL METHOD l_event->set_property
      EXPORTING
        im_property = if_swf_evt_event=>mc_prop_queue_sync_insert
        im_value    = 'X'.
  ENDIF.

*- property: debugging
  IF NOT debug_flag IS INITIAL.
    CALL METHOD l_event->set_property
      EXPORTING
        im_property = if_swf_evt_event=>mc_prop_debugging
        im_value    = 'X'.
  ENDIF.

*-----------------------------------------------------------------------
*- raise
*-----------------------------------------------------------------------
  TRY.
      CALL METHOD l_event->raise .
    CATCH cx_swf_evt_invalid_objtype cx_swf_evt_invalid_event
          INTO lex_exc.
      MESSAGE ID lex_exc->t100_msg-msgid TYPE 'E'
              NUMBER lex_exc->t100_msg-msgno
              WITH lex_exc->t100_msg-msgv1 lex_exc->t100_msg-msgv2
                   lex_exc->t100_msg-msgv3 lex_exc->t100_msg-msgv4
              RAISING objtype_not_found.
  ENDTRY.

*- get counter
  IF receiver_count IS REQUESTED.
    CALL METHOD l_event->get_handler_counters
      IMPORTING
        ex_selected = l_selected_handlers
*        EX_STARTED  =
        .

    receiver_count = l_selected_handlers.
  ENDIF.

  lcl_event ?= l_event.
  event_id  =  lcl_event->get_event_id( ).


*------------------------------
*- BEGIN OF OLD IMPLEMENTATION
*------------------------------
**- begin of local data
*  INCLUDE: rswelogi.                   " Log status (on/off)
*  DATA: l_trace_handle        LIKE swt_handle.
*  DATA: l_eq_admin_data       TYPE sweqadm.
*  DATA: l_event_queue_is_on   TYPE sy-input.
*  DATA: lt_receivers          LIKE swelog OCCURS 0 WITH HEADER LINE.
*  DATA: lt_event_log          LIKE swelog OCCURS 0 WITH HEADER LINE.
*  DATA: lt_receiver_info      TYPE swe_trecinf.
*  DATA: l_receiver_info       TYPE swe_recinf.
*  DATA: l_lines               TYPE i.
*  DATA: l_log_is_on           TYPE sy-input.
*  DATA: l_event_log_id        LIKE swelog-event_id.
*  DATA: lt_trace_struct       LIKE swt_logdat-structname
*                                   OCCURS 1 WITH HEADER LINE.
*  DATA: l_fb_name             LIKE swetypecou-recfb
*                                   VALUE 'SWE_EVENT_CREATE'.
*  DATA: l_coup_cnt            LIKE sy-tabix.
*  DATA: l_subrc               LIKE sy-subrc.
*  DATA: lt_event_container    LIKE swcont OCCURS 0.
**- end of local data
*
**----------------------------------------------------------------------
** do trace preparations
**----------------------------------------------------------------------
*  CALL FUNCTION 'SWT_TRACE_HANDLE_GET'
*       IMPORTING
*            handle = l_trace_handle.
*  IF NOT l_trace_handle IS INITIAL.
*    swc_set_element event_container c_trace_handle l_trace_handle.
*  ENDIF.
*  CLEAR lt_trace_struct. REFRESH lt_trace_struct.
*  lt_trace_struct = 'SWELOG'.
*  APPEND lt_trace_struct.
*
*  TRANSLATE event TO UPPER CASE.                          "#EC SYNTCHAR
*
**----------------------------------------------------------------------
** do Log preparations
**----------------------------------------------------------------------
*  IF no_logging EQ space.
*    CALL FUNCTION 'SWE_EVENT_LOG_CHECK_ACTIVE'
*         EXCEPTIONS
*              not_active = 1
*              OTHERS     = 2.
*    IF sy-subrc = 0.
*      l_log_is_on = 'X'.
**      IF ident IS INITIAL.
*      PERFORM fetch_event_log_id USING    range_no
*                                          range_object
*                                 CHANGING l_event_log_id.
**      ELSE.
***---- if event originates from the event queue it has already an
*evt-id
**        MOVE ident TO l_event_log_id.
**      ENDIF.
*    ENDIF.
*  ENDIF.
**----------------------------------------------------------------------
*-
** if event-log is on, and the receivers are started asynchronous
** I set the event_log_id to the container. This will update the Log
** within the called receiver-FB
**----------------------------------------------------------------------
*-
*  IF start_recfb_synchron EQ space
*     AND     l_log_is_on  EQ 'X'
*     AND NOT l_event_log_id IS INITIAL.
*    swc_set_element event_container evt_log_update 'X'.
*  ENDIF.
*
*  IF NOT l_event_log_id IS INITIAL.
*    swc_set_element event_container evt_id l_event_log_id.
*  ENDIF.
*
**----------------------------------------------------------------------
*-
** set the requester to the container
**----------------------------------------------------------------------
*-
*  CALL FUNCTION 'SWE_REQUESTER_TO_CONTAINER'
*       EXPORTING
*            take_workitem_requester = take_workitem_requester
**      IMPORTING
**           REQUESTER               =
*       TABLES
**           REQUESTER_TABLE         =
*            container               = event_container
*            .
*
**----------------------------------------------------------------------
*-
** fill the event-container with system-elements
**----------------------------------------------------------------------
*-
*  PERFORM set_container_elements TABLES event_container
*                                 USING objtype objkey event creator.
*
**----------------------------------------------------------------------
*-
** get the receivers
**----------------------------------------------------------------------
*-
*  CALL FUNCTION 'SWE_EVENT_GET_RECEIVERS'
*       EXPORTING
*            objtype                 = objtype
*            objkey                  = objkey
*            event                   = event
*            creator                 = creator
*            take_workitem_requester = take_workitem_requester
*       TABLES
*            event_container         = event_container
*            event_receivers         = lt_receivers
*            receiver_info           = lt_receiver_info
*       EXCEPTIONS
*            objtype_not_found       = 1
*            OTHERS                  = 2.
*  IF sy-subrc <> 0.
*    IF NOT l_log_is_on IS INITIAL.
*      REFRESH: lt_event_log.
*      lt_event_log-error      = exception.
*      lt_event_log-objtype    = objtype.
*      lt_event_log-objkey     = objkey.
*      lt_event_log-event      = event.
*      lt_event_log-rectype    = 'Ausnahme'(t01).
*      lt_event_log-ev_program = sy-cprog.
*      lt_event_log-ev_user    = sy-uname.
*      lt_event_log-ev_date    = sy-datum.
*      lt_event_log-ev_time    = sy-uzeit.
*      lt_event_log-msgid      = sy-msgid.
*      lt_event_log-msgno      = sy-msgno.
*      lt_event_log-msgv1      = sy-msgv1.
*      lt_event_log-msgv2      = sy-msgv2.
*      lt_event_log-msgv3      = sy-msgv3.
*      lt_event_log-msgv4      = sy-msgv4.
*      lt_event_log-msgty      = sy-msgty.
*      APPEND lt_event_log.
*
*      " the log is only written, if either objtype or event is
*      " not valid. Write the Trace to show the error! This was
*      " requested by RW 990801 (realised: 46B)
*
*      CALL FUNCTION 'SWE_EVENT_LOG_WRITE'
*           EXPORTING
*                event_id  = l_event_log_id
*                do_commit = ' '
*           TABLES
*                entries   = lt_event_log.
*      .
*    ENDIF.
*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
*            RAISING objtype_not_found.
*  ENDIF.
*
**----------------------------------------------------------------------
*-
**- got all receivers for the event
**- now, i begin to start the receivers... This will dispatch
**    - the starts via event-queue
**-   - the direct starts
**-   - queue-entries for couplings in status "error"
**----------------------------------------------------------------------
*-
*  DESCRIBE TABLE lt_receivers LINES l_lines.
**-- set line-counter as event-id -> event-id is not really the event-id
**-- but the counter of the receivers !!!
*  event_id = l_lines.                  " no. of couplings eq 'event_id
*  IF l_lines = 0.                      " No receivers for this event
*    lt_receivers-error      = no_receivers.
*    lt_receivers-objtype    = objtype.
*    lt_receivers-objkey     = objkey.
*    lt_receivers-event      = event.
*    lt_receivers-ev_program = sy-cprog.
*    lt_receivers-ev_user    = sy-uname.
*    lt_receivers-ev_date    = sy-datum.
*    lt_receivers-ev_time    = sy-uzeit.
*    APPEND lt_receivers.
*  ENDIF.
*
**----------------------------------------------------------------------
** check, if events should be started with delay
**----------------------------------------------------------------------
*  IF start_with_delay NE space.
*    PERFORM event_start_time_set.
*  ENDIF.
*
**----------------------------------------------------------------------
*-
** next, we have to check, if the event-queue is active
**       this check will only be done, if there is any receiver. If
*there
**       is no receiver, it is not neccessary to know, wheather the
*queue
**       is active or not.
**       L_LINES indicates the number of found receivers to this event
**----------------------------------------------------------------------
*-
*  IF l_lines > 0.
*    CALL FUNCTION 'SWE_EQ_ADMIN_DATA_READ'
*         IMPORTING
*              admin_data = l_eq_admin_data
*         EXCEPTIONS
*              OTHERS     = 2.
*    IF sy-subrc <> 0.
**----- i cannot read the administration-data of the event-queue. to be
**----- defensive, i asume, that the event-queue is off
*      l_event_queue_is_on = space.
*    ELSE.
*      IF NOT l_eq_admin_data-switch_on IS INITIAL.
**------- event-queue is on.
*        l_event_queue_is_on = 'X'.
*      ENDIF.
*    ENDIF.
*  ENDIF.
*
**----------------------------------------------------------------------
*-
** Prepare the event-log. Set the receiver-table as event-log-table.
** For all Receivers, that are in state "error", i need a dummy-key in
** the event-log. Otherwise these entries will be overwritten (because
** of duplicate keys) if the events will be delivered manually.
**
** Furthermore, i have to delete all logentries for receivers, that are
** started via QUEUE, because the Enqueue-Module will create an own
** log-entry
**----------------------------------------------------------------------
*-
*  lt_event_log[] = lt_receivers[].
**- .. and set dummy-receiver-id for those that are in failure
*  LOOP AT lt_event_log WHERE error = receiver_in_failure.
*    CONCATENATE c_log_recid_in_failure sy-datum sy-uzeit
*           INTO lt_event_log-recid .
*    MODIFY lt_event_log.
*  ENDLOOP.
*  LOOP AT lt_receiver_info INTO l_receiver_info
*                          WHERE q_enable = 'X'.
*    READ TABLE lt_event_log
*         WITH KEY rectype = l_receiver_info-rectype
*                  recid   = l_receiver_info-recid.
*    IF sy-subrc = 0 AND lt_event_log-error = no_error.
*      DELETE lt_event_log INDEX sy-tabix.
*    ENDIF.
*  ENDLOOP.
*
**----------------------------------------------------------------------
*-
** synchronous call => log and trace
**----------------------------------------------------------------------
*-
*  IF start_recfb_synchron NE space.
**-- write log entry (in synchronous call) => COMMIT WORK !!
*    IF l_log_is_on EQ 'X'.
*      CALL FUNCTION 'SWE_EVENT_LOG_WRITE'
*           EXPORTING
*                event_id  = l_event_log_id
*                do_commit = 'X'
*           TABLES
*                entries   = lt_event_log.
*    ENDIF.
**--- write trace
*    CALL FUNCTION 'SWT_TRACE_WRITE'
*         EXPORTING
*              own_modid = c_swtmi_em
*              action    = space
*              funcname  = l_fb_name
*         TABLES
*              name_lst  = lt_trace_struct
*              data_lst  = lt_event_log.
*  ENDIF.
*
*----------------------------------------------------------------------
*-
** START the receivers !!
**----------------------------------------------------------------------
*-
*  CLEAR l_coup_cnt.
*  LOOP AT lt_receivers.
*    l_coup_cnt = l_coup_cnt + 1.
*    CLEAR: l_subrc.
*    CLEAR: wi_id.
**-- read extended receiver-info...
*    READ TABLE lt_receiver_info INTO l_receiver_info
*         WITH KEY rectype = lt_receivers-rectype
*                  recid   = lt_receivers-recid.
*    IF sy-subrc = 0.
*      lt_event_container[] = l_receiver_info-container[].
*    ELSE.
*      lt_event_container[] = event_container[].
*      swc_set_element lt_event_container
*                      evt_receiver_id lt_receivers-recid.
*    ENDIF.
*
*    IF lt_receivers-error EQ '0'.      " No error has occured
*
**----------------------------------------------------------------------
*-
**- tackle rec get functions
**       "That pattern indicated (for the log entry) that a RecGet-FB
*was
**       "used. It has to be removed for the Rec-FB-Call
**----------------------------------------------------------------------
*-
*      IF lt_receivers-rectype CP '(*)'.
*        SHIFT lt_receivers-rectype RIGHT DELETING TRAILING ') '.
*        SHIFT lt_receivers-rectype LEFT DELETING LEADING ' ('.
*      ENDIF.
*
**----------------------------------------------------------------------
*-
**- if we know the receiver id we put it into the container
**      " move coup-recid again to container element evt_receiver_id,
**      " because we may have several such (instance) receivers, but
**      " only ONE event_container for all such events. rg, 950907.
**----------------------------------------------------------------------
*-
*      swc_set_element lt_event_container
*                      evt_receiver_id lt_receivers-recid.
*
*      IF l_event_queue_is_on IS INITIAL
*         OR l_receiver_info-q_enable IS INITIAL.
**------ DO NOT USE THE QUEUE
*        CALL FUNCTION 'SWE_EVENT_CREATE_INTERNAL'
*             EXPORTING
*                  objtype                 = lt_receivers-objtype
*                  objkey                  = lt_receivers-objkey
*                  event                   = lt_receivers-event
*                  rectype                 = lt_receivers-rectype
*                  recfb                   = lt_receivers-recfb
*                  rfcdest                 = lt_receivers-rfcdest
*                  creator                 = creator
*                  take_workitem_requester = take_workitem_requester
**                 START_WITH_DELAY        = start_with_delay
*                  start_recfb_synchron    = start_recfb_synchron
*                  debug_flag              = debug_flag
*                  no_logging              = no_logging
**                 evt_guid_in             =
*                  evt_log_id              = l_event_log_id
**            IMPORTING
**                 EVenT_ID                =
**                 evt_guid_OUT            =
*             TABLES
*                  event_container         = lt_event_container
*                  log_entries             = lt_event_log
*             EXCEPTIONS
*                  objtype_not_found       = 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
*                  RAISING objtype_not_found.
*        ENDIF.
*      ELSE.
**------ enqueue the event
*        CALL FUNCTION 'SWE_EVENT_ENQUEUE'
*             EXPORTING
*                  objtype                     = lt_receivers-objtype
*                  objkey                      = lt_receivers-objkey
*                  event                       = lt_receivers-event
*                  rectype                     = lt_receivers-rectype
*                  recfb                       = lt_receivers-recfb
*                  rfcdest                     = lt_receivers-rfcdest
*                  creator                     = creator
*                  take_workitem_requester     = take_workitem_requester
*                  start_with_delay            = start_with_delay
*                  start_recfb_synchron        = start_recfb_synchron
*                  no_explicit_commit_required = no_commit_for_queue
*                  debug_flag                  = debug_flag
*                  evt_log_id                  = l_event_log_id
**             IMPORTING
**                  event_id                    = event_id
*             TABLES
*                  event_container             = lt_event_container
*             EXCEPTIONS
*                  objtype_not_found           = 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
*                  RAISING objtype_not_found.
*        ENDIF.
*      ENDIF.
*
*    ELSEIF lt_receivers-error EQ receiver_in_failure.
**---- everything is o.k. but the receiver is marked as failure.
**---- enqueue the event to the queue!
*
*      CALL FUNCTION 'SWE_EVENT_ENQUEUE'
*           EXPORTING
*                objtype                     = lt_receivers-objtype
*                objkey                      = lt_receivers-objkey
*                event                       = lt_receivers-event
*                rectype                     = lt_receivers-rectype
*                recfb                       = lt_receivers-recfb
*                rfcdest                     = lt_receivers-rfcdest
*                creator                     = creator
*                take_workitem_requester     = take_workitem_requester
*                start_with_delay            = start_with_delay
*                start_recfb_synchron        = start_recfb_synchron
*                no_explicit_commit_required = no_commit_for_queue
**               DEBUG_FLAG                  = space
*                evt_log_id                  = l_event_log_id
*                status                      =
*c_evt_status_wait_on_error
**          IMPORTING
**               EVENT_ID                    =
*           TABLES
*                event_container             = lt_event_container
*           EXCEPTIONS
*                objtype_not_found           = 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
*                RAISING objtype_not_found.
*      ENDIF.
*    ENDIF.
*  ENDLOOP.
*
**----------------------------------------------------------------------
**- finally, write log asynchronously
**- write log and trace for asynchronous function call
**- (swe_event_log_write contains a commit)
**----------------------------------------------------------------------
*  IF start_recfb_synchron EQ space.
*    IF l_log_is_on EQ 'X'.
*      CALL FUNCTION 'SWE_EVENT_LOG_WRITE'
*           IN BACKGROUND TASK
*           DESTINATION space
*           EXPORTING
*                event_id                  = l_event_log_id
*           TABLES
*                entries                   = lt_event_log.
*    ENDIF.
*    CALL FUNCTION 'SWT_TRACE_WRITE'
*         EXPORTING
*              own_modid = c_swtmi_em
*              action    = space
*              funcname  = l_fb_name
*         TABLES
*              name_lst  = lt_trace_struct
*              data_lst  = lt_event_log.
*  ENDIF.

ENDFUNCTION.



*---------------------------------------------------------------------*
*       FORM EVENT_START_TIME_SET                                     *
*---------------------------------------------------------------------*
FORM event_start_time_set.
  DATA: start_time       LIKE sy-uzeit,
        start_date       LIKE sy-datum,
        delay(2)         TYPE n VALUE 10, " use a delay of 10 minutes
        start_minutes(2) TYPE n,
        start_hours(2)   TYPE n.

  GET TIME.
* use calendar function to determine real start time, rg 961113
  CALL FUNCTION 'END_TIME_DETERMINE'
       EXPORTING
            duration                   = 10
            unit                       = 'MIN'
*           FACTORY_CALENDAR           =
       IMPORTING
            end_date                   = start_date
            end_time                   = start_time
       CHANGING
            start_date                 = sy-datum
            start_time                 = sy-uzeit
       EXCEPTIONS
            factory_calendar_not_found = 1
            date_out_of_calendar_range = 2
            date_not_valid             = 3
            unit_conversion_error      = 4
            si_unit_missing            = 5
            parameters_no_valid        = 6
            OTHERS                     = 7.
  IF sy-subrc NE 0.
    " try to calclate new time myself, if there's an error
    start_minutes = sy-uzeit+2(2) + delay.
    IF start_minutes > 60.             " goto next hour
      start_hours = sy-uzeit(2) + 1.
      IF start_hours <= 23. " we've not yet reached the next day
        start_minutes = start_minutes - 60.
      ELSE.                            " do not regard date changes
        start_hours = 23.
        start_minutes = 59.
      ENDIF.
    ELSE.
      start_hours = sy-uzeit(2).
    ENDIF.
    start_date = sy-datum.
    WRITE start_hours TO start_time(2).
    WRITE start_minutes TO start_time+2(2).
  ENDIF.                               " end_time_determine failed
* set time for tRFC execution
  CALL FUNCTION 'START_OF_BACKGROUNDTASK'
    EXPORTING
      startdate = start_date
      starttime = start_time.
ENDFORM.                    "event_start_time_set