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: 

How to get creation date of a file created in application server?

former_member240605
Participant
0 Kudos

Dear experts ,

I have some txt files in a particular path in application server .Suppose path is - \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt.

I want to fetch  the creation date of this txt file - test.txt . I tried with fm -  ADS2KIPUPL_GET_FILE_ATTRIBUTES , but this will give proper out put.

I need to get file creation date. If today I am creating file - abc.txt, so according to this file I should get today's date as creation date.

Please suggest me.  



19 REPLIES 19

Former Member
0 Kudos

Hi Sandipan,

Please confirm either you are looking for creation date or last modified date.

Please check this FM


EPS_GET_FILE_ATTRIBUTES


also try 'SUBST_GET_FILE_LIST

call this routine also inside

PERFORM P6_TO_DATE_TIME_TZ(RSTR0400) USING FILE_LIST-MTIME

                                                 FILE_LIST-MOD_TIME

                                                 FILE_LIST-MOD_DATE.

Hope it will be helpful.

Regards,

Kannan


0 Kudos

Hello Kannan,

Thanks for your quick reply. I analyzed the issue again. I need last modification date .

I tried with fm - EPS_GET_FILE_ATTRIBUTES, but its not giving proper output, also tried with 'SUBST_GET_FILE_LIST, but not working. I want last modification date of a file. May be its a txt file or different type of file, but I want last moidification date of a file.

0 Kudos

Hi Sandipan,

You tried to call the routine also..

Please confirm for Fm SUBST_GET_FILE_LIST

Regards,

Kannan

0 Kudos

Hello Kannan ,

I am not getting any proper output from fm - SUBST_GET_FILE_LIST . if this is my '\\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt'  entire path, and test.txt is my file. then can u just tell me what need to pass to this function module. It would be better if you give me a proper example.

0 Kudos

Hi Sandipan,

Check in se37.Pass the parameters as follows.

Catch the respective exceptions too.

Regards,

Kannan

0 Kudos

Hello Kannan,

My entire path is -  '\\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt'.  But when you are giving input to dirname , it is coming -  \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SA,

But it should coming - \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT. LES_RPT is truncated, may be its size exceeding, Same problem I am also facing. So kindly tell me how can I solve it?

0 Kudos

Hi Sandipan,

You are correct it allows only upto char 75.can you try it by placing file in BDC folder.You can do it by using CG3Y.

Give a try..

Regards,

Kannan

0 Kudos

Hello Kannan,

My requirement is to get modification date of a file created in application server . Transaction CG3Y

is to download file from application server to presentation server . Then what I will do with this transaction?

0 Kudos

Hi Sandipan,

What i meant is to download the file from the SALES_RPT using CG3Y and upload it in BDC folder using CG3Z and try executing.

Regards,

Kannan

0 Kudos

Hello Kannan,

I don't think user will accept this. Because as per requirement my path must be same.  So whatever I would do, I have to use same path - \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt'.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Thinking aloud....

Why not use DOS DIR command as external command redirecting the output to a file and then read this file ?

Or use the output of the command (I am at home cannot test this....) .

Regards.

former_member205763
Active Contributor
0 Kudos

Use UNIX command.

example:


    CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unixcom
                ID 'TAB'     FIELD i_file[].

Where l_v_unixcom would be - ls -l <path>.

0 Kudos

Hello Kartik,

Thanks for your reply. Can you just tell me what will be the type declaration of

i_file[]. Before this piece of code should I need to call any function module or anything else. It would be very helpful for me if you kindly send me any program as an example. My path is - '\\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt'


0 Kudos

                    BEGIN OF ty_file,
                    line(400)   TYPE c,                                      "File names
                  END   OF ty_file,

This is the structure declaration.

l_v_unixcom would be ls -l \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt

now call

CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unixcom
                ID 'TAB'     FIELD i_file[].

and see contents of i_file[] it should have the details, post results so we can help further

0 Kudos

Hello Kartik,

I have tried as per your suggestion. Used this  -

CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unixcom
                ID 'TAB'     FIELD i_file[].

But it is taking so much time and at end time is exceeding .

0 Kudos

then try using stat instead of ls -l.

you may search about unix commands to find out the correct command for your requirement.

0 Kudos

Hello Kartik,

How to  use unix command in abap program. Can you give any kind of example?

0 Kudos

the code given above is used to call unix command.

l_v_unixcom would be stat \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt

 

CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unixcom
                ID 'TAB'     FIELD i_file[].


l_v_unixcom is the unix command in this case.

former_member240605
Participant

Dear All,

Issue has been solved by using this fm - EPS2_GET_DIRECTORY_LISTING .

Thanks to all of you for your quick reply.