on 07-17-2006 9:45 AM
Hi all,
I'm looking for a way to read the following information from the application server
Last change Creator Name
17.07.2006 09:19:58 cbdadm file1.csv
27.05.2003 10:53:11 cbdadm file2.csv
13.07.2006 17:01:30 cbdadm file3.csv
I want to see for a number of filenames, when it was last changed, but I don't know where to get this data? Is it stored in a table? And how should I read this data?
I see that a program named RSWATCH0 is generating the required output for transaction AL11...maybe this is helpful?
The following code works in ABAP, but I need to use this in BSP... is this possible somehow?
REPORT ZUPLOAD_TIME .
TABLES epsf.
PARAMETERS dir LIKE epsf-epsdirnam.
PARAMETERS file LIKE epsf-epsfilnam.
DATA mtime TYPE p DECIMALS 0.
DATA time(10).
DATA date LIKE sy-datum.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = 'TESTFILE.CSV'
dir_name = '/usr/sap/data/'
IMPORTING
file_size = epsf-epsfilsiz
file_owner = epsf-epsfilown
file_mode = epsf-epsfilmod
file_type = epsf-epsfiltyp
file_mtime = mtime
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
PERFORM p6_to_date_time_tz(rstr0400) USING mtime
time
date.
WRITE: / mtime,
/ date, time.
thanks in advance! points will be rewarded for usefull answers
Message was edited by: Joris Hens
Message was edited by: Joris Hens
Hi,
just call that function in the desired BSP-part,
It should work as in the ABAP program,
just copy and paste and use the right datadeclaration.
possibly the function needs to be remote enabled,
but it should work without that on some functions
(as it is the case here)
grtz
Koen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just a small modification :
PERFORM p6_to_date_time_tz(rstr0400)
USING mtime
time
date.
is not allowed in BSP (ABAPP OO rules)
Use instead :
PERFORM p6_to_date_time_tz IN PROGRAM rstr0400
USING mtime
time
date.
The one problem I see is that you must know the file names in advance, conctrary to AL11 which lists all files.
If you want to have the list of files, you probably will have to use CALL kernel...
Best regards,
Guillaume
In the TYPES Definition tab :
types: BEGIN OF t_file,
date TYPE d,
time(10) TYPE c.
INCLUDE TYPE epsf.
TYPES: END OF t_file.
types: tt_files type table of t_file.
In the Page attributes tab :
ta_files TYPE tt_files
In the OnInitialization Event Handler :
* event handler for data retrieval
DATA: epsf TYPE epsf.
DATA: mtime TYPE p DECIMALS 0.
DATA: time(10) TYPE c.
DATA: date TYPE sy-datum.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = 'myfile.csv'
dir_name = '/usr/sap/data'
IMPORTING
file_size = epsf-epsfilsiz
file_owner = epsf-epsfilown
file_mode = epsf-epsfilmod
file_type = epsf-epsfiltyp
file_mtime = mtime
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
PERFORM p6_to_date_time_tz IN PROGRAM rstr0400 USING mtime
time
date.
FIELD-SYMBOLS: <fs_file> LIKE LINE OF ta_files.
APPEND INITIAL LINE TO ta_files ASSIGNING <fs_file>.
MOVE-CORRESPONDING epsf TO <fs_file>.
<fs_file>-time = time.
<fs_file>-date = date.
In the Layout :
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page title = "List files on application server ">
<htmlb:form>
<htmlb:tableView id = "tvx"
table = "<%= ta_files %>" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Then, you still have some minor modificaions to perform on the tableView thanks to an Iterator, for instance.
Best regards,
Guillaume
Message was edited by: Guillaume Garcia
Hi,
Btw, if you need to read all the files in a dir.
data: dir_files type table of salfldir with header line.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = '/usr/sap/data/'
tables
file_tbl = dir_files
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at dir_files
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
....
endloop.
Eddy
Hi,
Have a look at the numerous Weblogs on TableView Iterator here in SDN.
/people/thomas.jung3/blog/2005/07/18/bsp-extension-for-downloading-a-table-applying-an-iterator
/people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators
/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
Best regards,
Guillaume
PS: Didn't know that FM Eddy, Thanks !!
Message was edited by: Guillaume Garcia
Hi,
I've slightly chaged the code by Guillaume for your needs:
replace types by this
types: BEGIN OF t_file,
date TYPE d,
time(10) TYPE c,
filename TYPE PFEFLNAME.
TYPES: END OF t_file.
types: tt_files type table of t_file.
Put this in the OnInitialization Event Handler.
data: wa LIKE LINE OF ta_files.
DATA: epsf TYPE epsf.
DATA: mtime TYPE p DECIMALS 0.
DATA: time(10) TYPE c.
DATA: date TYPE sy-datum.
wa-filename = 'file1.txt'.
append wa to ta_files.
wa-filename = 'file2.txt'.
append wa to ta_files.
wa-filename = 'file3.txt'.
append wa to ta_files.
...
loop at ta_files into wa.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = wa-filename
dir_name = '/usr/sap/data'
IMPORTING
file_size = epsf-epsfilsiz
file_owner = epsf-epsfilown
file_mode = epsf-epsfilmod
file_type = epsf-epsfiltyp
file_mtime = mtime
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
PERFORM p6_to_date_time_tz IN PROGRAM rstr0400 USING mtime
time
date.
wa-time = time.
wa-date = date.
modify ta_files from wa.
endloop.
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d!
thanks Eddy,
but this generated this error when running the BSP (no compiling errors)
The following error text was processed in the system:
An exception with the type CX_SY_DYN_CALL_ILLEGAL_TYPE occurred, but was neither handled locally, nor declared in a RAISING clause
Long text A type conflict occurred when the program tried to passan actual parameter to the formal parameter 'FILE_NAME' of the function 'EPS_GET_FILE_ATTRIBUTES'.
thanks again Eddy, you received the points you deserve.
I'm trying now to just add an image to the tableview, according to the file that is there.
for example: file1 = image1.gif
file2 = logo.gif
file3 = mylogo.jpg
it will allways be the same image, but I don't think it's easy to do this.
Anyway, thanks a lot for your help. My issue is solved!
Hi,
Add to types after the
filename TYPE PFEFLNAME.
the following
filesize type EPSFILSIZ.
In the event handler
after the
wa-date = date.
the following
wa-filesize = epsf-epsfilsiz.
But you're now close to Guillaumes suggestion for looking at the web logs on tableview iterators.
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d!
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.