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

Scan application server directory to read a file by pattern

Former Member
0 Likes
3,589

Hi Experts,er

I am trying to search for a file which is on application server

File Name: payroll_1000_date_timestamp

Since i will not know the timestamp on the file i will have to search the file in the folder like this: payroll_1000_date_*

I have tried almost all below techniques but none of them work in background mode:

1.F.M EPS2_GET_DIRECTORY_LISTING

2.EPS_GET_DIRECTORY_LISTING

3.Perform  DIRECTORY_CONTENTS_GET from F.M /SAPDMC/LSM_F4_SERVER_FILE

Would appreciate if someone can highlight on a way i can do this search.

Is there any function module or any utility which can run in background and give me all files present on app. server ? I can than filter it down

later.

Would appreciate your help.

Thanks

Bhanu

1 ACCEPTED SOLUTION
Read only

kathryn_mcgallicher
Active Participant
1,878

Can you use function module ISU_M_L_FOLDER_SERVER?

We use this to retrieve the directory list (will handle up to 75 character file names) and then scan the list for entries of type "f" and the file name mask we are searching for.

Regards,

K--

8 REPLIES 8
Read only

Former Member
1,878

Hi Bhanu,

did you try the following??

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'

  EXPORTING

dir_name = gv_folder "'\usr\sap\ECD\SYS\global\chase\inbound'

file_mask = 'payroll_1000_date_*'

  TABLES

dir_list = lt_dir_list

  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.

IF sy-subrc = 0.

Read only

0 Likes
1,878

Hi Noufal,

Problem with this function module is the return parameter directory list which has only 40 Char limit.

Read only

Former Member
0 Likes
1,878

This message was moderated.

Read only

0 Likes
1,878

Jacob,

i mentioned about the background mode

Read only

0 Likes
1,878

If no other FMs are present, I think you need to make a program to use this Fm and run that as background job

Read only

Former Member
0 Likes
1,878

This message was moderated.

Read only

kathryn_mcgallicher
Active Participant
1,879

Can you use function module ISU_M_L_FOLDER_SERVER?

We use this to retrieve the directory list (will handle up to 75 character file names) and then scan the list for entries of type "f" and the file name mask we are searching for.

Regards,

K--

Read only

Former Member
0 Likes
1,878

Experts,

It was my bad the function module EPS2_GET_DIRECTORY_LISTING can be used in background , there are no issues with it.


I am closing the thread



Thanks

Bhanu Malik