SAP KD_GET_FILENAME_ON_F4 Function Module for Filemanager support to locate file in a directory (on value request)
KD_GET_FILENAME_ON_F4 is a standard kd get filename on f4 SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Filemanager support to locate file in a directory (on value request) 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 kd get filename on f4 FM, simply by entering the name KD_GET_FILENAME_ON_F4 into the relevant SAP transaction such as SE37 or SE38.
Function Group: KDUT
Program Name: SAPLKDUT
Main Program: SAPLKDUT
Appliation area: I
Release date: 07-Feb-1996
Mode(Normal, Remote etc): Normal Function Module
Update:
![](https://www.se80.co.uk/training-education/wp-content/uploads/2019/07/normal-function-module.png)
Function KD_GET_FILENAME_ON_F4 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 'KD_GET_FILENAME_ON_F4'"Filemanager support to locate file in a directory (on value request).
EXPORTING
* PROGRAM_NAME = SYST-REPID "Module pool program name for screen field
* DYNPRO_NUMBER = SYST-DYNNR "Dynpro number where F4 help is needed
* FIELD_NAME = ' ' "name of field where path is to be entered
* STATIC = ' ' "
* MASK = ' ' "
* FILEOPERATION = 'R' "Operation to perform on file
* PATH = "Long path name
CHANGING
FILE_NAME = "Path name selected by user with help of Filemngr
* LOCATION_FLAG = 'P' "Flag: Application or presentation server
EXCEPTIONS
MASK_TOO_LONG = 1
IMPORTING Parameters details for KD_GET_FILENAME_ON_F4
PROGRAM_NAME - Module pool program name for screen field
Data type: SY-REPIDDefault: SYST-REPID
Optional: Yes
Call by Reference: No ( called with pass by value option)
DYNPRO_NUMBER - Dynpro number where F4 help is needed
Data type: SY-DYNNRDefault: SYST-DYNNR
Optional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_NAME - name of field where path is to be entered
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
STATIC -
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
MASK -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FILEOPERATION - Operation to perform on file
Data type: DXFIELDS-FILEOPERDefault: 'R'
Optional: Yes
Call by Reference: No ( called with pass by value option)
PATH - Long path name
Data type: DXFIELDS-LONGPATHOptional: Yes
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for KD_GET_FILENAME_ON_F4
FILE_NAME - Path name selected by user with help of Filemngr
Data type: RLGRAP-FILENAMEOptional: No
Call by Reference: No ( called with pass by value option)
LOCATION_FLAG - Flag: Application or presentation server
Data type: DXFIELDS-LOCATIONDefault: 'P'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
MASK_TOO_LONG - The len of MASK must not be > 100
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for KD_GET_FILENAME_ON_F4 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_file_name | TYPE RLGRAP-FILENAME, " | |||
lv_program_name | TYPE SY-REPID, " SYST-REPID | |||
lv_mask_too_long | TYPE SY, " | |||
lv_dynpro_number | TYPE SY-DYNNR, " SYST-DYNNR | |||
lv_location_flag | TYPE DXFIELDS-LOCATION, " 'P' | |||
lv_field_name | TYPE DXFIELDS, " SPACE | |||
lv_static | TYPE DXFIELDS, " SPACE | |||
lv_mask | TYPE C, " SPACE | |||
lv_fileoperation | TYPE DXFIELDS-FILEOPER, " 'R' | |||
lv_path | TYPE DXFIELDS-LONGPATH. " |
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4' "Filemanager support to locate file in a directory (on value request) |
EXPORTING | ||
PROGRAM_NAME | = lv_program_name | |
DYNPRO_NUMBER | = lv_dynpro_number | |
FIELD_NAME | = lv_field_name | |
STATIC | = lv_static | |
MASK | = lv_mask | |
FILEOPERATION | = lv_fileoperation | |
PATH | = lv_path | |
CHANGING | ||
FILE_NAME | = lv_file_name | |
LOCATION_FLAG | = lv_location_flag | |
EXCEPTIONS | ||
MASK_TOO_LONG = 1 | ||
. " KD_GET_FILENAME_ON_F4 |
ABAP code using 7.40 inline data declarations to call FM KD_GET_FILENAME_ON_F4
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 FILENAME FROM RLGRAP INTO @DATA(ld_file_name). | ||||
"SELECT single REPID FROM SY INTO @DATA(ld_program_name). | ||||
DATA(ld_program_name) | = SYST-REPID. | |||
"SELECT single DYNNR FROM SY INTO @DATA(ld_dynpro_number). | ||||
DATA(ld_dynpro_number) | = SYST-DYNNR. | |||
"SELECT single LOCATION FROM DXFIELDS INTO @DATA(ld_location_flag). | ||||
DATA(ld_location_flag) | = 'P'. | |||
DATA(ld_field_name) | = ' '. | |||
DATA(ld_static) | = ' '. | |||
DATA(ld_mask) | = ' '. | |||
"SELECT single FILEOPER FROM DXFIELDS INTO @DATA(ld_fileoperation). | ||||
DATA(ld_fileoperation) | = 'R'. | |||
"SELECT single LONGPATH FROM DXFIELDS INTO @DATA(ld_path). | ||||
Search for further information about these or an SAP related objects