06-08-2014 11:36 AM
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.
06-08-2014 12:24 PM
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
06-08-2014 12:48 PM
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.
06-08-2014 12:59 PM
Hi Sandipan,
You tried to call the routine also..
Please confirm for Fm SUBST_GET_FILE_LIST
Regards,
Kannan
06-08-2014 2:33 PM
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.
06-08-2014 2:49 PM
Hi Sandipan,
Check in se37.Pass the parameters as follows.
Catch the respective exceptions too.
Regards,
Kannan
06-08-2014 3:09 PM
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?
06-08-2014 3:57 PM
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
06-08-2014 6:11 PM
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?
06-08-2014 6:16 PM
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
06-08-2014 6:45 PM
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'.
06-08-2014 6:05 PM
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.
06-08-2014 6:57 PM
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>.
06-08-2014 7:18 PM
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'
06-08-2014 7:24 PM
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
06-09-2014 6:45 AM
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 .
06-09-2014 6:53 AM
then try using stat instead of ls -l.
you may search about unix commands to find out the correct command for your requirement.
06-09-2014 7:47 AM
Hello Kartik,
How to use unix command in abap program. Can you give any kind of example?
06-09-2014 3:30 PM
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.
06-11-2014 1:10 PM
Dear All,
Issue has been solved by using this fm - EPS2_GET_DIRECTORY_LISTING .
Thanks to all of you for your quick reply.