You can use the classes described here to restart background units with errors, or delete them. A class exists for each of the combinations of bgRFC type t and type q for inbound and outbound.
Graphic: Client Methods
The method GET_UNIT_STATE returns the following status of a background unit:
Return value | Meaning |
IF_BGRFC_CLIENT=> UNIT_STATE_BLOCKED | The unit unit_id cannot yet be executed, because other queues must be executed first due to the defined queues. |
IF_BGRFC_CLIENT=> UNIT_STATE_LOCKED | The unit unit_id cannot be executed, because a lock is placed on this unit, or the unit is part of a locked queue. |
IF_BGRFC_CLIENT=> UNIT_STATE_COMMUNICATION_ERR | The unit unit_id could not be executed due to an communication error with the destination system. |
IF_BGRFC_CLIENT=> UNIT_STATE_EXECUTION_ERR | An error occurred while executing the unit unit_id . |
IF_BGRFC_CLIENT=> UNIT_STATE_EXECUTED | The unit unit_id has already been executed or the value of unit_id does not specify a valid unit. |
IF_BGRFC_CLIENT=> UNIT_STATE_RUNNABLE | The unit unit_id can be executed. |
IF_BGRFC_CLIENT=> UNIT_STATE_IN_EXECUTION | The unit unit_id is being executed. |
IF_BGRFC_CLIENT=> QUEUE_STATE_UNKNOWN | The status of the unit is unknown. |
If multiple return codes are possible, then the one at the top is returned.
In addition, you can query the status of a queue for qRFC units with the GET_QUEUE_STATE method. One of the following statuses can be returned:
Return value | Meaning |
IF_BGRFC_CLIENT=> QUEUE_STATE_LOCKED | The first unit of the queue is locked. This value is also returned, if a queue lock set at the current queue position has reached the beginning of a queue. |
IF_BGRFC_CLIENT=> QUEUE_STATE_COMMUNICATION_ERR | The topmost unit of the queue could not be executed due to an communication error to the destination system. |
IF_BGRFC_CLIENT=> QUEUE_STATE_EXECUTION_ERR | An error occurred while executing the topmost unit of the queue. |
IF_BGRFC_CLIENT=> QUEUE_STATE_EMPTY | The queue is empty. |
IF_BGRFC_CLIENT=> QUEUE_STATE_RUNNABLE | The first unit of the queue can be executed. |
IF_BGRFC_CLIENT=> QUEUE_STATE_IN_EXECUTION | The first unit of the queue is being executed. |
IF_BGRFC_CLIENT=> UNIT_STATE_BLOCKED | The unit is blocked by a previous unit. |
IF_BGRFC_CLIENT=> UNIT_STATE_EXECUTED | The unit is executed successfully. |
IF_BGRFC_CLIENT=> UNIT_STATE_INVALID_UNIT_ID | Unknown unit ID. |
IF_BGRFC_CLIENT=> UNIT_STATE_RETRY | The unit is to be executed again and is, therefore, locked. |
IF_BGRFC_CLIENT=> UNIT_STATE_UNKNOWN | The status of the unit is unknown. |
If a queue is blocked by a unit with an error, then the unit_id of this unit can be detected by calling the GET_FAILD_UNIT_BY_QUEUE method.
A unit with errors can be started again by calling RUN_FAILED_UNIT. The method forces the scheduler to restart the unit and does not wait until the unit has been executed. The number of retroactive start attempts and the moment of the last start attempt of a unit is automatically logged and displayed in the monitor. After a unit has been processed successfully, the unit is deleted and the following units are potentially started by the scheduler automatically. If the unit was not processed successfully, then this queue keeps blocking the following queues. The exception CX_RFC_NO_FAILED_LUW is raised if the specified unit did not encounter an error. The exception CX_RFC_INVALID_LUW with the text element LUW_NOT_FOUND specifies that there is no unit with this unit_id.
A unit with errors can be deleted with the DELETE_FAILED_UNIT method. This deletion process is always logged by a trace record.