Get server catalog contents in SAP ABAP

I need to get a list of server directories inside SAP. How to achieve this in ABAP? Are there any built-in SAP features that I can name?

Ideally, I want a function through which I can pass the path as input, and which will return a list of file names in the internal table.

+6
sap abap
source share
5 answers

After reading the answers of Chris Carrters and tomdemuyt, I would say:

1) Use RZL_READ_DIR_LOCAL if you need a simple list of file names.

2) EPS_GET_DIRECTORY_LISTING is more powerful - it can also display subdirectories.

Thanks to both of you!

Best regards Niki Galanov

+3
source share

Call Function RZL_READ_DIR_LOCAL:

FUNCTION RZL_READ_DIR_LOCAL. *"---------------------------------------------------------------------- *"Lokale Schnittstelle: *" IMPORTING *" NAME LIKE SALFILE-LONGNAME *" TABLES *" FILE_TBL STRUCTURE SALFLDIR *" EXCEPTIONS *" ARGUMENT_ERROR *" NOT_FOUND *"---------------------------------------------------------------------- 

Put the path in the import option NAME, and then read the directory listing from FILE_TBL after it returns.

RZL_READ_DIR_LOCAL can handle regular local paths as well as UNC paths.

The only drawback is that it only has access to the first 32 characters of each file name. However, you can easily create a new function based on the RZL_READ_DIR_LOCAL code and change the output method of the C program, since the first 187 characters of each file name are actually available.

+3
source share

EPS2_GET_DIRECTORY_LISTING does the same as EPS_GET_DIRECTORY_LISTING , but reconfigures file names up to 200 characters

+3
source share

The response is called by the EPS_GET_DIRECTORY_LISTING function module. DIR_NAME → Directory name FILE_MASK → Pass '*' to receive all files.

Note. This does not apply to really large file names (80 characters +), it truncates the name.

+2
source share

Take a look at the source code of transaction AL11: form RSWATCH0 fill_file_list There you can get all the information about the files.

Hope this helps!

+1
source share

All Articles