‎2009 Jun 04 7:07 AM
I need to read an XML file from the application server. This can be done using OPEN DATASET in BINARY MODE and reading into internal table of type binary data.
But inorder to parse the document using the iXML library, i need to pass the filesize of the XML file that is read into internal table.
Please let me know how to calculate this filesize ?
‎2009 Jun 04 7:55 AM
I suppose you could use the standard function module GUI_UPLOAD. This would give you the contents of the file in an internal table and also the size of the file. You could use this to create the istream to parse the xml document.
Hope this helps.
Ramneek
‎2009 Jun 04 7:58 AM
I think i have mentioned clearly above that i am reading from the Application server and not from the presentation server.
You cannot use GUI_UPLOAD for that my dear friend.
‎2009 Jul 24 12:19 PM
Hi ,
Check the FM : /SAPDMC/LSM_F4_SERVER_FILE.
Inside this FM , subroutine below exists.The main program for routine is /SAPDMC/LLSMW_AUX_020F02.
Call this routine from your program. You will get the length in bytes from the field len of table pt_file.
data:
begin of gs_file,
directory(75) type c, " name of directory.
" (possibly truncated.)
name(75) type c, " name of entry.
" (possibly truncated.)
type(10) type c, " type of entry: directory, file
*len(8) type p, " length in bytes*
owner(8) type c, " owner of the entry
mtime(6) type p, " last modification date,
" seconds since 1970
mode(9) type c, " like "rwx-r-x--x":
" protection mode
errno(3) type c,
errmsg(40) type c,
mod_date type d,
mod_time(8) type c, " hh:mm:ss
subrc like sy-subrc,
end of gs_file.
DATA : pt_file LIKE TABLE OF gs_file.
DATa : p_ok.
PERFORM /sapdmc/llsmw_aux_020f02(directory_contents_get)
TABLES pt_file
USING '/TMP' ""!!! Here is your filepath
'*'
CHANGING p_ok