SAP RH_GET_RESOURCE Function Module for Selection of resource BOM per business event
RH_GET_RESOURCE is a standard rh get resource SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Selection of resource BOM per business event 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 rh get resource FM, simply by entering the name RH_GET_RESOURCE into the relevant SAP transaction such as SE37 or SE38.
Function Group: RHV4
Program Name: SAPLRHV4
Main Program: SAPLRHV4
Appliation area: H
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function RH_GET_RESOURCE 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 'RH_GET_RESOURCE'"Selection of resource BOM per business event.
EXPORTING
* PLVAR = "Plan version
* ROOM = 'X' "
* INSTRUCTOR = 'X' "
* MATERIAL = 'X' "
* OTYPE = "Object type of business event
* OBJID = "Business event ID
* BEGDA = '19000101' "
* ENDDA = '99991231' "
* ISTAT = "
* LANGU = SY-LANGU "
* ORTID = "
* RESOURCE = 'X' "
TABLES
RESSOURCE_TAB = "Export table with business event + resource
* EVENT_TAB = "Import table with keys of business events
* I1001 = "
EXCEPTIONS
NO_EVENT_FOUND = 1 NO_OCCUPYING = 2 WRONG_OBJECTTYPE = 3
IMPORTING Parameters details for RH_GET_RESOURCE
PLVAR - Plan version
Data type: P1001-PLVAROptional: Yes
Call by Reference: No ( called with pass by value option)
ROOM -
Data type: HRI1023-RAUMXDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
INSTRUCTOR -
Data type: HRI1023-INSTXDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
MATERIAL -
Data type: HRI1023-MATRXDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
OTYPE - Object type of business event
Data type: P1001-OTYPEOptional: Yes
Call by Reference: No ( called with pass by value option)
OBJID - Business event ID
Data type: P1001-OBJIDOptional: Yes
Call by Reference: No ( called with pass by value option)
BEGDA -
Data type: P1001-BEGDADefault: '19000101'
Optional: Yes
Call by Reference: No ( called with pass by value option)
ENDDA -
Data type: P1001-ENDDADefault: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)
ISTAT -
Data type: P1001-ISTATOptional: Yes
Call by Reference: No ( called with pass by value option)
LANGU -
Data type: SY-LANGUDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
ORTID -
Data type: PLOG-OBJIDOptional: Yes
Call by Reference: No ( called with pass by value option)
RESOURCE -
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for RH_GET_RESOURCE
RESSOURCE_TAB - Export table with business event + resource
Data type: HRVRESOptional: No
Call by Reference: No ( called with pass by value option)
EVENT_TAB - Import table with keys of business events
Data type: HROBJECTOptional: Yes
Call by Reference: No ( called with pass by value option)
I1001 -
Data type: P1001Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_EVENT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_OCCUPYING -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
WRONG_OBJECTTYPE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for RH_GET_RESOURCE 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_plvar | TYPE P1001-PLVAR, " | |||
| lt_ressource_tab | TYPE STANDARD TABLE OF HRVRES, " | |||
| lv_no_event_found | TYPE HRVRES, " | |||
| lv_room | TYPE HRI1023-RAUMX, " 'X' | |||
| lv_instructor | TYPE HRI1023-INSTX, " 'X' | |||
| lv_material | TYPE HRI1023-MATRX, " 'X' | |||
| lv_otype | TYPE P1001-OTYPE, " | |||
| lt_event_tab | TYPE STANDARD TABLE OF HROBJECT, " | |||
| lv_no_occupying | TYPE HROBJECT, " | |||
| lt_i1001 | TYPE STANDARD TABLE OF P1001, " | |||
| lv_objid | TYPE P1001-OBJID, " | |||
| lv_wrong_objecttype | TYPE P1001, " | |||
| lv_begda | TYPE P1001-BEGDA, " '19000101' | |||
| lv_endda | TYPE P1001-ENDDA, " '99991231' | |||
| lv_istat | TYPE P1001-ISTAT, " | |||
| lv_langu | TYPE SY-LANGU, " SY-LANGU | |||
| lv_ortid | TYPE PLOG-OBJID, " | |||
| lv_resource | TYPE PLOG. " 'X' |
|   CALL FUNCTION 'RH_GET_RESOURCE' "Selection of resource BOM per business event |
| EXPORTING | ||
| PLVAR | = lv_plvar | |
| ROOM | = lv_room | |
| INSTRUCTOR | = lv_instructor | |
| MATERIAL | = lv_material | |
| OTYPE | = lv_otype | |
| OBJID | = lv_objid | |
| BEGDA | = lv_begda | |
| ENDDA | = lv_endda | |
| ISTAT | = lv_istat | |
| LANGU | = lv_langu | |
| ORTID | = lv_ortid | |
| RESOURCE | = lv_resource | |
| TABLES | ||
| RESSOURCE_TAB | = lt_ressource_tab | |
| EVENT_TAB | = lt_event_tab | |
| I1001 | = lt_i1001 | |
| EXCEPTIONS | ||
| NO_EVENT_FOUND = 1 | ||
| NO_OCCUPYING = 2 | ||
| WRONG_OBJECTTYPE = 3 | ||
| . " RH_GET_RESOURCE | ||
ABAP code using 7.40 inline data declarations to call FM RH_GET_RESOURCE
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 PLVAR FROM P1001 INTO @DATA(ld_plvar). | ||||
| "SELECT single RAUMX FROM HRI1023 INTO @DATA(ld_room). | ||||
| DATA(ld_room) | = 'X'. | |||
| "SELECT single INSTX FROM HRI1023 INTO @DATA(ld_instructor). | ||||
| DATA(ld_instructor) | = 'X'. | |||
| "SELECT single MATRX FROM HRI1023 INTO @DATA(ld_material). | ||||
| DATA(ld_material) | = 'X'. | |||
| "SELECT single OTYPE FROM P1001 INTO @DATA(ld_otype). | ||||
| "SELECT single OBJID FROM P1001 INTO @DATA(ld_objid). | ||||
| "SELECT single BEGDA FROM P1001 INTO @DATA(ld_begda). | ||||
| DATA(ld_begda) | = '19000101'. | |||
| "SELECT single ENDDA FROM P1001 INTO @DATA(ld_endda). | ||||
| DATA(ld_endda) | = '99991231'. | |||
| "SELECT single ISTAT FROM P1001 INTO @DATA(ld_istat). | ||||
| "SELECT single LANGU FROM SY INTO @DATA(ld_langu). | ||||
| DATA(ld_langu) | = SY-LANGU. | |||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_ortid). | ||||
| DATA(ld_resource) | = 'X'. | |||
Search for further information about these or an SAP related objects