‎2010 Jan 27 9:57 AM
Hi,
We are using WS_QUERY FM to get the length of file name.
CALL FUNCTION 'WS_QUERY'
EXPORTING
filename = l_filename
query = 'FL'
IMPORTING
return = return
This FM is obslete in ECC 6.0. So is there any FM or method which provides the same functionality.
Thanks & Regards,
Sri ramya g.
‎2010 Jan 27 10:46 AM
Hi Ramya,
Query 'FL' is for getting the file size and below is the replacement for ws_query in case of query 'FL'.
data: l_filename1 type string,
rc type i.
move l_filename to l_filename1.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_GET_SIZE
EXPORTING
FILE_NAME = l_filename1
IMPORTING
FILE_SIZE = rc
EXCEPTIONS
FILE_GET_SIZE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
CALL METHOD CL_GUI_CFW=>FLUSH.
IF SY-SUBRC = 0.
move rc to return.
ENDIF.
‎2010 Jan 27 10:01 AM
‎2010 Jan 27 10:06 AM
Hi Ramya,
Use methods of class CL_GUI_FRONTEND_SERVICES like FILE_GET_ATTRIBUTES
Regards
Abhii
Edited by: Abhii on Jan 27, 2010 11:07 AM
‎2010 Jan 27 10:46 AM
Hi Ramya,
Query 'FL' is for getting the file size and below is the replacement for ws_query in case of query 'FL'.
data: l_filename1 type string,
rc type i.
move l_filename to l_filename1.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_GET_SIZE
EXPORTING
FILE_NAME = l_filename1
IMPORTING
FILE_SIZE = rc
EXCEPTIONS
FILE_GET_SIZE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
CALL METHOD CL_GUI_CFW=>FLUSH.
IF SY-SUBRC = 0.
move rc to return.
ENDIF.
‎2010 Jan 27 11:55 AM
Hi,
Thanks for your reply.But the method is not giving size of file.It is returning 0 in RC of the method.
‎2010 Jan 27 12:03 PM
1) Check sy-subrc value after the method is executed to check if the method is returning any error
2) Check if the filename provided is correct
3) Have you called CALL METHOD CL_GUI_CFW=>FLUSH after the call to the method FILE_GET_SIZE ?
Edited by: Vasuki S Patki on Jan 27, 2010 5:33 PM
‎2010 Jan 27 12:07 PM
I called the method CL_GUI_CFW=>FLUSH after File_get_size and sy-subrc = 0 also.
‎2010 Jan 27 12:08 PM
Hi Ramya,
Try using GUI_GET_FILE_INFO.
data file_path like rlgrap-filename."später verlängern
data filesize type i
call function 'GUI_GET_FILE_INFO'
exporting
fname = file_path
importing
file_size = filesize
exceptions
fileinfo_error = 1.
move filesize to object_hd_display-objlen.
move reference_type_file to object_hd_display-extct.
perform mom_object_insert.
if f_cancelled is initial.
* Object was created successfully
move: crea to objects-okcode,
object_hd_display-objnam to objects-objnam,
object_hd_display-objdes to objects-objdes.
modify_objects_index current_line.
endif.
endif.Regards
Abhii
‎2010 Jan 27 12:09 PM
‎2010 Jan 27 12:09 PM
‎2010 Jan 27 12:12 PM
data:V_FILENAME LIKE RLGRAP-FILENAME value 'C:\Documents and Settings\narayanp\Desktop\pass.txt',
V_RETURN TYPE I.
DATA:L_FILE TYPE STRING,
RC TYPE I.
CALL FUNCTION 'WS_QUERY'
EXPORTING
FILENAME = V_FILENAME
QUERY = 'FL'
IMPORTING
RETURN = V_RETURN
EXCEPTIONS
OTHERS = 1.
*MOVE V_FILENAME TO L_FILE.
*CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_GET_SIZE
EXPORTING
FILE_NAME = L_FILE
IMPORTING
FILE_SIZE = RC
EXCEPTIONS
FILE_GET_SIZE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*
*CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
others = 3
.
*IF SY-SUBRC <> 0.
*MOVE RC TO V_RETURN .
*ENDIF.
WRITE V_RETURN .
‎2010 Jan 27 12:19 PM
Hi Ramya,
Pls check the path that you have provided, as I get the right file size with the code that you have provided.
I uncommented the replacement part ( CL_GUI_FRONTEND_SERVICES=>FILE_GET_SIZE) that you have commented in your post, and able to get teh file size, can you please check again,.
Vasuki
‎2010 Jan 27 4:52 PM
Give the file path through selection screen and check if its working!!
if u like to hardcode the string for which u want to return length then give a simpe word with out slashes or other character's and
check........
I guess this should work for u
Regards,
Shravanthi
‎2010 Jan 27 10:59 AM
Hello,
I hope Vasuki S Patki is correct
Thanks,
santhosh
Edited by: santhosh kumar on Jan 27, 2010 12:04 PM
‎2010 Jan 27 11:41 AM
Hi ,
Use class cl_gui_frontend_services and method
CALL METHOD cl_gui_frontend_services=>FILE_GET_SIZE
Regards
SVJ
Edited by: Siddivinesh jogu on Jan 27, 2010 12:42 PM