Fonction SAP CBIH_LB14_UETEMPL_IATYPE_CHECK - EHS: User Exit to Check Type of Incident/Accident Log Entry

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
I_ADDINF RCGADDINF u 27 Additional information
I_IAL_RECN CCIHT_IAL-RECN N 20 Internal key for incident/accident log entry
I_IATYPE CCIHT_IAL-IATYPE C 3 Incident/accident log entry type

Paramètre Reférence Type Long. Description
E_ERROR_MESSAGE 0 Error message
E_FLG_OK ESP1_BOOLEAN 0 TRUE: Incident/accident log entry type correct

Paramètre Reférence Long. Facultatif Description
I_INVPERS_TAB CCIHS_IPIOT 490 X Table of persons involved

Exception Description
INTERNAL_ERROR

Functionality
This function module is used as a template for check functions that youcan define for the incident/accident log entry type.
The function module is also available as a reference function module fordefining the interface of the user exit category IAL_TYPCHK.

Example
In the following example, the consistency of the incident/accident logentry type is examined based on the number ofpersons affected. Thevalues used in the example for the incident/accident log entry type areset as defaults in standard Customizing.
*"*"Local interface:
*" IMPORTING
*" VALUE(I_IATYPE) LIKE CCIHT_IAL-IATYPE
*" VALUE(I_IAL_RECN) LIKE CCIHT_IAL-RECN
*" VALUE(I_ADDINF) LIKE RCGADDINF STRUCTURE RCGADDINF
*" EXPORTING
*" VALUE(E_FLG_OK) TYPE ESP1_BOOLEAN
*" VALUE(E_ERROR_MESSAGE)
*" TABLES
*" I_INVPERS_TAB STRUCTURE CCIHS_IPIOT OPTIONAL
*" EXCEPTIONS
*" INTERNAL_ERROR
*"----------------------------------------------------------------------
* ----------------------------------------------------------------------
* Local data
* ----------------------------------------------------------------------
* working table
DATA: L_INVPERS_IOTAB LIKE CCIHS_IPIOT OCCURS 10 WITH HEADER LINE.
DATA: L_COUNT LIKE SY-TABIX VALUE 0.
* ----------------------------------------------------------------------
* Function body
* ----------------------------------------------------------------------
* init export parameters
E_FLG_OK = ESP1_TRUE.
CLEAR E_ERROR_MESSAGE.
* ----------------------------------------------------------
* STEP 1: prepare person involved table (recommended to be copied)
* ----------------------------------------------------------
REFRESH L_INVPERS_IOTAB.
IF ( I_INVPERS_TAB[] IS INITIAL ).
* read person involved data from buffer
CALL FUNCTION 'CBIH_LB14_IAL_SREAD'
EXPORTING
I_RECN = I_IAL_RECN
I_ACTYPE = IC_ACTYPE-SHOW
I_ADDINF = I_ADDINF
* I_FLG_AUTHORITY_CHECK = ESP1_FALSE
* I_FLG_WITH_LOCK = ESP1_FALSE
I_FLG_WITH_MESSAGE = TRUE
I_FLG_IP = ESP1_TRUE
TABLES
E_IP_IOTAB = L_INVPERS_IOTAB
EXCEPTIONS
PARAMETER_ERROR = 1
IAL_NOT_FOUND = 2
NO_AUTHORITY = 3
OTHERS = 4.
IF ( SY-SUBRC NE 0 ).
RAISE INTERNAL_ERROR.
ENDIF.
ELSE.
* use data of imported table
L_INVPERS_IOTAB[] = I_INVPERS_TAB[].
ENDIF. " i_invpers_tab[] is initial
* ----------------------------------
* STEP 2: check IAL type (example)
* ----------------------------------
* determine number of injured persons
L_COUNT = 0.
LOOP AT L_INVPERS_IOTAB WHERE ( IPTYPE = CIH04_IPTYPE-INJURED ).
L_COUNT = L_COUNT + 1.
ENDLOOP.
CASE I_IATYPE.
WHEN 'OPE'.
IF ( L_COUNT NE 1 ).
E_FLG_OK = FALSE.
ENDIF.
WHEN 'MPE'.
IF ( L_COUNT < 2 ).
E_FLG_OK = FALSE.
ENDIF.
WHEN 'NPE'.
IF ( L_COUNT > 0 ).
E_FLG_OK = FALSE.
ENDIF.
WHEN OTHERS.
E_FLG_OK = TRUE.
ENDCASE. " i_iatype

Notes
In Customizing for Industrial Hygiene and Safety, you can specifya user exit name for every incident/accident log entry type in the IMGactivity Specify Incident/Accident Log EntryTypes. You must have already created this user exit name inCustomizing for Basic Data and Tools under Manage User Exits
and assigned it to a function module.
If you write your own check function, its interface must match theinterface of the reference function module.