Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using Unix command in ABAP

Former Member
0 Likes
597

Hi guy,

I am using " Call 'SYSTEM' id 'COMMAND' field UnixCommand id 'TAB' field itFiles-SYS" to read number of files in folder, it works fine if number of line are around 200 but if its more then that it doesn't any file.

UnixCommand = 'ls -ld'.

UnixCommand+7(45) = /abap/.

call 'SYSTEM' id 'COMMAND' field UnixCommand

id 'TAB' field itFiles-SYS.

Thanks

Atul

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
537

Hi,


DATA: L_DIRNAME LIKE EPSF-EPSDIRNAM,
      L_FILEMASK LIKE EPSF-EPSFILNAM.
 
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
    EXPORTING
      dir_name                  = l_dirname
      file_mask                 = l_filemask
* IMPORTING
*   DIR_NAME                    =
*   FILE_COUNTER                =
*   ERROR_COUNTER               =
    TABLES
      dir_list                  = pi_filelist
 EXCEPTIONS
   invalid_eps_subdir           = 1
   sapgparam_failed             = 2
   build_directory_failed       = 3
   no_authorization             = 4
   read_directory_failed        = 5
   too_many_read_errors         = 6
   empty_directory_list         = 7
   OTHERS                       = 8.

Try with this

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
538

Hi,


DATA: L_DIRNAME LIKE EPSF-EPSDIRNAM,
      L_FILEMASK LIKE EPSF-EPSFILNAM.
 
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
    EXPORTING
      dir_name                  = l_dirname
      file_mask                 = l_filemask
* IMPORTING
*   DIR_NAME                    =
*   FILE_COUNTER                =
*   ERROR_COUNTER               =
    TABLES
      dir_list                  = pi_filelist
 EXCEPTIONS
   invalid_eps_subdir           = 1
   sapgparam_failed             = 2
   build_directory_failed       = 3
   no_authorization             = 4
   read_directory_failed        = 5
   too_many_read_errors         = 6
   empty_directory_list         = 7
   OTHERS                       = 8.

Try with this

Read only

0 Likes
537

Thanks it works

Atul

Read only

Former Member
0 Likes
537

Hi

You can also use FM RZL_READ_DIR_LOCAL to get the files for the given directory..

Thanks,

Naren