SAP PTRV_GET_NAME_FOR_PERNR Function Module for Dialog box for displaying name for a personnel number
PTRV_GET_NAME_FOR_PERNR is a standard ptrv get name for pernr SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Dialog box for displaying name for a personnel number 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 ptrv get name for pernr FM, simply by entering the name PTRV_GET_NAME_FOR_PERNR into the relevant SAP transaction such as SE37 or SE38.
Function Group: HRTRV_STAT
Program Name: SAPLHRTRV_STAT
Main Program: SAPLHRTRV_STAT
Appliation area: P
Release date: 04-Apr-1998
Mode(Normal, Remote etc): Normal Function Module
Update:
Function PTRV_GET_NAME_FOR_PERNR 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 'PTRV_GET_NAME_FOR_PERNR'"Dialog box for displaying name for a personnel number.
EXPORTING
PERSONNEL_NUMBER = "Personnel number
* VALIDITY_DATE = "Validity date
* SCREEN_DISPLAY = 'X' "Output name in dialog box ? 'X' = yes
* START_ROW = 5 "Dialog box output as from line
* START_COLUMN = 10 "Dialog box output as from column
IMPORTING
NAME = "Name for Personnel Number
EXCEPTIONS
NAME_NOT_FOUND = 1
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_SAPLHRTRV_STAT_001
EXIT_SAPLHRTRV_STAT_002
IMPORTING Parameters details for PTRV_GET_NAME_FOR_PERNR
PERSONNEL_NUMBER - Personnel number
Data type: P0001-PERNROptional: No
Call by Reference: No ( called with pass by value option)
VALIDITY_DATE - Validity date
Data type: P0001-BEGDAOptional: Yes
Call by Reference: No ( called with pass by value option)
SCREEN_DISPLAY - Output name in dialog box ? 'X' = yes
Data type: CDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
START_ROW - Dialog box output as from line
Data type:Default: 5
Optional: Yes
Call by Reference: No ( called with pass by value option)
START_COLUMN - Dialog box output as from column
Data type:Default: 10
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for PTRV_GET_NAME_FOR_PERNR
NAME - Name for Personnel Number
Data type: P0001-ENAMEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NAME_NOT_FOUND - Name not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for PTRV_GET_NAME_FOR_PERNR 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_name | TYPE P0001-ENAME, " | |||
lv_name_not_found | TYPE P0001, " | |||
lv_personnel_number | TYPE P0001-PERNR, " | |||
lv_validity_date | TYPE P0001-BEGDA, " | |||
lv_screen_display | TYPE C, " 'X' | |||
lv_start_row | TYPE C, " 5 | |||
lv_start_column | TYPE C. " 10 |
  CALL FUNCTION 'PTRV_GET_NAME_FOR_PERNR' "Dialog box for displaying name for a personnel number |
EXPORTING | ||
PERSONNEL_NUMBER | = lv_personnel_number | |
VALIDITY_DATE | = lv_validity_date | |
SCREEN_DISPLAY | = lv_screen_display | |
START_ROW | = lv_start_row | |
START_COLUMN | = lv_start_column | |
IMPORTING | ||
NAME | = lv_name | |
EXCEPTIONS | ||
NAME_NOT_FOUND = 1 | ||
. " PTRV_GET_NAME_FOR_PERNR |
ABAP code using 7.40 inline data declarations to call FM PTRV_GET_NAME_FOR_PERNR
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 ENAME FROM P0001 INTO @DATA(ld_name). | ||||
"SELECT single PERNR FROM P0001 INTO @DATA(ld_personnel_number). | ||||
"SELECT single BEGDA FROM P0001 INTO @DATA(ld_validity_date). | ||||
DATA(ld_screen_display) | = 'X'. | |||
DATA(ld_start_row) | = 5. | |||
DATA(ld_start_column) | = 10. | |||
Search for further information about these or an SAP related objects