SAP EHS_FIND_TASKS Function Module for Health Surveillance Protocols acc. to Person's Task
EHS_FIND_TASKS is a standard ehs find tasks SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Health Surveillance Protocols acc. to Person's Task processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for ehs find tasks FM, simply by entering the name EHS_FIND_TASKS into the relevant SAP transaction such as SE37 or SE38.
Function Group: EHS00PPROT
Program Name: SAPLEHS00PPROT
Main Program: SAPLEHS00PPROT
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function EHS_FIND_TASKS pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'EHS_FIND_TASKS'"Health Surveillance Protocols acc. to Person's Task.
EXPORTING
IM_PERNR = "Personnel Number
* IM_BEGDA = SY-DATUM "Start of evaluation period
* IM_ENDDA = SY-DATUM "End of evaluation period
* IM_WEGID = 'EHSP_OBJ' "Evaluation Path
* IM_OBJTYP = 'P ' "Object Type (T=Task, P=Person,..)
* IM_FLAG_GET_STRUC = 'X' "Set to Call RH_GET_STRUC in Function Module
TABLES
E_TASK_PERSPROT = "Results Table (Prot<->Person)
* I_TASK_RESULT = "Transfer Table if IM_FLAG ' '
* I_TASK_OBJEC = "Transfer Table if IM_FLAG ' '
* I_TASK_STRUC = "Transfer Table if IM_FLAG ' '
EXCEPTIONS
PERNR_NOT_ALLOWED = 1 PERNR_NOT_EXIST = 2 PERSON_NOT_ASSIGNED = 3
IMPORTING Parameters details for EHS_FIND_TASKS
IM_PERNR - Personnel Number
Data type: E1P0002-PERNROptional: No
Call by Reference: No ( called with pass by value option)
IM_BEGDA - Start of evaluation period
Data type: E1P0002-BEGDADefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
IM_ENDDA - End of evaluation period
Data type: E1P0002-ENDDADefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
IM_WEGID - Evaluation Path
Data type: GDSTR-WEGIDDefault: 'EHSP_OBJ'
Optional: Yes
Call by Reference: No ( called with pass by value option)
IM_OBJTYP - Object Type (T=Task, P=Person,..)
Data type: OBJEC-OTYPEDefault: 'P '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IM_FLAG_GET_STRUC - Set to Call RH_GET_STRUC in Function Module
Data type: CHAR1Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for EHS_FIND_TASKS
E_TASK_PERSPROT - Results Table (Prot<->Person)
Data type: EHS00PERSPROTOptional: No
Call by Reference: No ( called with pass by value option)
I_TASK_RESULT - Transfer Table if IM_FLAG ' '
Data type: SWHACTOROptional: Yes
Call by Reference: No ( called with pass by value option)
I_TASK_OBJEC - Transfer Table if IM_FLAG ' '
Data type: OBJECOptional: Yes
Call by Reference: No ( called with pass by value option)
I_TASK_STRUC - Transfer Table if IM_FLAG ' '
Data type: STRUCOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
PERNR_NOT_ALLOWED - Personnel Number 0 Not Allowed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PERNR_NOT_EXIST - Personnel Number Does Not Exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PERSON_NOT_ASSIGNED - Person Not Assigned to Object (C,S,T)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for EHS_FIND_TASKS Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_im_pernr | TYPE E1P0002-PERNR, " | |||
| lt_e_task_persprot | TYPE STANDARD TABLE OF EHS00PERSPROT, " | |||
| lv_pernr_not_allowed | TYPE EHS00PERSPROT, " | |||
| lv_im_begda | TYPE E1P0002-BEGDA, " SY-DATUM | |||
| lt_i_task_result | TYPE STANDARD TABLE OF SWHACTOR, " | |||
| lv_pernr_not_exist | TYPE SWHACTOR, " | |||
| lv_im_endda | TYPE E1P0002-ENDDA, " SY-DATUM | |||
| lt_i_task_objec | TYPE STANDARD TABLE OF OBJEC, " | |||
| lv_person_not_assigned | TYPE OBJEC, " | |||
| lv_im_wegid | TYPE GDSTR-WEGID, " 'EHSP_OBJ' | |||
| lt_i_task_struc | TYPE STANDARD TABLE OF STRUC, " | |||
| lv_im_objtyp | TYPE OBJEC-OTYPE, " 'P ' | |||
| lv_im_flag_get_struc | TYPE CHAR1. " 'X' |
|   CALL FUNCTION 'EHS_FIND_TASKS' "Health Surveillance Protocols acc. to Person's Task |
| EXPORTING | ||
| IM_PERNR | = lv_im_pernr | |
| IM_BEGDA | = lv_im_begda | |
| IM_ENDDA | = lv_im_endda | |
| IM_WEGID | = lv_im_wegid | |
| IM_OBJTYP | = lv_im_objtyp | |
| IM_FLAG_GET_STRUC | = lv_im_flag_get_struc | |
| TABLES | ||
| E_TASK_PERSPROT | = lt_e_task_persprot | |
| I_TASK_RESULT | = lt_i_task_result | |
| I_TASK_OBJEC | = lt_i_task_objec | |
| I_TASK_STRUC | = lt_i_task_struc | |
| EXCEPTIONS | ||
| PERNR_NOT_ALLOWED = 1 | ||
| PERNR_NOT_EXIST = 2 | ||
| PERSON_NOT_ASSIGNED = 3 | ||
| . " EHS_FIND_TASKS | ||
ABAP code using 7.40 inline data declarations to call FM EHS_FIND_TASKS
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single PERNR FROM E1P0002 INTO @DATA(ld_im_pernr). | ||||
| "SELECT single BEGDA FROM E1P0002 INTO @DATA(ld_im_begda). | ||||
| DATA(ld_im_begda) | = SY-DATUM. | |||
| "SELECT single ENDDA FROM E1P0002 INTO @DATA(ld_im_endda). | ||||
| DATA(ld_im_endda) | = SY-DATUM. | |||
| "SELECT single WEGID FROM GDSTR INTO @DATA(ld_im_wegid). | ||||
| DATA(ld_im_wegid) | = 'EHSP_OBJ'. | |||
| "SELECT single OTYPE FROM OBJEC INTO @DATA(ld_im_objtyp). | ||||
| DATA(ld_im_objtyp) | = 'P '. | |||
| DATA(ld_im_flag_get_struc) | = 'X'. | |||
Search for further information about these or an SAP related objects