Application Development 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: 

FM to count AL11 entries for a specific date

Former Member
0 Kudos

Hi Everyone,

I am suppose to automate one health check which we do on a daily basis. Description is as below:

Taking an example:  i want to count the no of files which we have receive in the below path:

AL11>>SAPIO>>Conversion>> (Read count of files which we have received for yesterday)

I have tried below mentioned function module but it's not helping.

SUBST_GET_FILE_LIST

EPS_GET_DIRECTORY_LISTING

RZL_READ_DIR

Request you to please suggest in step wise as i am new to SAP.

Thank you

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Rahul.

Is it possible to add a timestamp to the files names ? It's the best way to achieve your requirement.

Because, many Unix systems won't save the date of the creation of the file, but the last modification date. (the folders you can see in AL11 are your server OS folders).

You can see the attributes of your files using unix commands inside the abap code:

You can run a unix command using:

DATA:

   lv_command(50) TYPE c,

   lv_line(150)   TYPE c,

   lt_tab         LIKE TABLE OF lv_line.

lv_command = 'ls -l'.

CALL 'SYSTEM' ID 'COMMAND' FIELD lv_command

               ID 'TAB'     FIELD lt_tab.


lv_commands stores your command line, the lt_table, return the result of the command.

Also refer to this link: ls command in Linux/Unix | list files/directories

Hope this information helps you.

But as I already said, if you can add a timestamp to your files would save you a lot of work.

Since you can use a simple FM RZL_READ_DIR to get the files and then filter them by their name(timestamp) in your program.

Regards,

Thales Schmidt

3 REPLIES 3

Former Member
0 Kudos

Hi Rahul.

Is it possible to add a timestamp to the files names ? It's the best way to achieve your requirement.

Because, many Unix systems won't save the date of the creation of the file, but the last modification date. (the folders you can see in AL11 are your server OS folders).

You can see the attributes of your files using unix commands inside the abap code:

You can run a unix command using:

DATA:

   lv_command(50) TYPE c,

   lv_line(150)   TYPE c,

   lt_tab         LIKE TABLE OF lv_line.

lv_command = 'ls -l'.

CALL 'SYSTEM' ID 'COMMAND' FIELD lv_command

               ID 'TAB'     FIELD lt_tab.


lv_commands stores your command line, the lt_table, return the result of the command.

Also refer to this link: ls command in Linux/Unix | list files/directories

Hope this information helps you.

But as I already said, if you can add a timestamp to your files would save you a lot of work.

Since you can use a simple FM RZL_READ_DIR to get the files and then filter them by their name(timestamp) in your program.

Regards,

Thales Schmidt

Former Member
0 Kudos

Thank you Thames,

However, where do i put the path from where i have to fetch the count of the files for a specific date

And what should be the write statement.

0 Kudos

In unix command,

the command would be something like this "ls -l /etc/path/" .

Please refer to the link I posted.

For the function module, please search on the forums. There are lots of topics relationed to this subject.

Regards,

Thales Schmidt