SAP RH_GET_NEXT_NUMBER Function Module for Internal Number Assignment for Personnel Planning Objects
RH_GET_NEXT_NUMBER is a standard rh get next number SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Internal Number Assignment for Personnel Planning Objects 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 next number FM, simply by entering the name RH_GET_NEXT_NUMBER into the relevant SAP transaction such as SE37 or SE38.
Function Group: RHIV
Program Name: SAPLRHIV
Main Program: SAPLRHIV
Appliation area: H
Release date: 03-Sep-1999
Mode(Normal, Remote etc): Normal Function Module
Update:

Function RH_GET_NEXT_NUMBER 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_NEXT_NUMBER'"Internal Number Assignment for Personnel Planning Objects.
EXPORTING
* ACTION = 'DIRECT' "Action with which FM is started
EXT_NUMBER = "External Number
OTYPE = "Object type
PLVAR = "Plan version
* TEST_MODE = "
IMPORTING
NUMBER = "Number
EXCEPTIONS
INVALID_ACTION = 1 NUMBER_MUST_BE_ZERO = 2 INVALID_OBJECT = 3 NO_EXTERNAL_INTERVAL_FOUND = 4 NO_INTERNAL_INTERVAL_FOUND = 5 INVALID_NUMBER = 6 NO_MORE_NUMBERS_AVAILABLE = 7
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLRHIV_001 Customer exit: Internal number assignment
EXIT_SAPLRHIV_002 Customer exit: Check external numbers
EXIT_SAPLRHIV_003 Customer exit: Check whether internal number assignment is available
IMPORTING Parameters details for RH_GET_NEXT_NUMBER
ACTION - Action with which FM is started
Data type:Default: 'DIRECT'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXT_NUMBER - External Number
Data type: PLOG-OBJIDOptional: No
Call by Reference: No ( called with pass by value option)
OTYPE - Object type
Data type: PLOG-OTYPEOptional: No
Call by Reference: No ( called with pass by value option)
PLVAR - Plan version
Data type: PLOG-PLVAROptional: No
Call by Reference: No ( called with pass by value option)
TEST_MODE -
Data type: HRPP0C-TESTOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for RH_GET_NEXT_NUMBER
NUMBER - Number
Data type: PLOG-OBJIDOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INVALID_ACTION - Program Error: Action not Allowed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NUMBER_MUST_BE_ZERO - Program Error: Action GIVE only with NUMBER=0
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_OBJECT - Object was not Found in Table TNRO
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_EXTERNAL_INTERVAL_FOUND - No External Number Range was Found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_INTERNAL_INTERVAL_FOUND - No Internal Number Range was Found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_NUMBER - Number is not a Valid External Number
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_MORE_NUMBERS_AVAILABLE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for RH_GET_NEXT_NUMBER 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_action | TYPE STRING, " 'DIRECT' | |||
| lv_number | TYPE PLOG-OBJID, " | |||
| lv_invalid_action | TYPE PLOG, " | |||
| lv_ext_number | TYPE PLOG-OBJID, " | |||
| lv_number_must_be_zero | TYPE PLOG, " | |||
| lv_otype | TYPE PLOG-OTYPE, " | |||
| lv_invalid_object | TYPE PLOG, " | |||
| lv_plvar | TYPE PLOG-PLVAR, " | |||
| lv_no_external_interval_found | TYPE PLOG, " | |||
| lv_test_mode | TYPE HRPP0C-TEST, " | |||
| lv_no_internal_interval_found | TYPE HRPP0C, " | |||
| lv_invalid_number | TYPE HRPP0C, " | |||
| lv_no_more_numbers_available | TYPE HRPP0C. " |
|   CALL FUNCTION 'RH_GET_NEXT_NUMBER' "Internal Number Assignment for Personnel Planning Objects |
| EXPORTING | ||
| ACTION | = lv_action | |
| EXT_NUMBER | = lv_ext_number | |
| OTYPE | = lv_otype | |
| PLVAR | = lv_plvar | |
| TEST_MODE | = lv_test_mode | |
| IMPORTING | ||
| NUMBER | = lv_number | |
| EXCEPTIONS | ||
| INVALID_ACTION = 1 | ||
| NUMBER_MUST_BE_ZERO = 2 | ||
| INVALID_OBJECT = 3 | ||
| NO_EXTERNAL_INTERVAL_FOUND = 4 | ||
| NO_INTERNAL_INTERVAL_FOUND = 5 | ||
| INVALID_NUMBER = 6 | ||
| NO_MORE_NUMBERS_AVAILABLE = 7 | ||
| . " RH_GET_NEXT_NUMBER | ||
ABAP code using 7.40 inline data declarations to call FM RH_GET_NEXT_NUMBER
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.| DATA(ld_action) | = 'DIRECT'. | |||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_number). | ||||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_ext_number). | ||||
| "SELECT single OTYPE FROM PLOG INTO @DATA(ld_otype). | ||||
| "SELECT single PLVAR FROM PLOG INTO @DATA(ld_plvar). | ||||
| "SELECT single TEST FROM HRPP0C INTO @DATA(ld_test_mode). | ||||
Search for further information about these or an SAP related objects