2005 Jul 21 2:00 PM
Hi, profs!
I found a problem using CL_GUI_FRONTEND_SERVICES meth FILE_GET_SIZE. It does not return an value.
I tried FILE_EXIST, FILE_GET_ATTRIBUTES - all works properly, but not FILE_GET_SIZE. At all! I tried with existing file and not existing - always 0.
Is anybody familiar with this problem?
With best regards,
Constantine
PS
Frontend MS WIN XP SP2, SAP GUI 640, Path level 11
System SAP R/3 4.7 620
Patches:
SAP_BASIS 620 0050 SAPKB62050
SAP_ABA 620 0050 SAPKA62050
2005 Jul 21 2:16 PM
Hi Konstantin,
No not familiar, but that is because i use the following code to determine both the existance AND the file size of any file:
DATA: FILETAB TYPE TABLE OF FILE_INFO,
FILEREC TYPE FILE_INFO,
COUNT TYPE i,
FZISE TYPE i.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = '<Yourfilename>'
FILTER = ''
FILES_ONLY = 'X'
CHANGING
FILE_TABLE = FILETAB
COUNT = COUNT
EXCEPTIONS
CNTL_ERROR = 1
DIRECTORY_LIST_FILES_FAILED = 2
WRONG_PARAMETER = 3
ERROR_NO_GUI = 4
others = 5.
IF SY-SUBRC <> 0.
RAISE CNTL_ERROR.
ENDIF.
IF COUNT = 0.
* Does not exist
RESULT = ABAP_FALSE.
FSIZE = 0.
ELSE.
* Does exist
RESULT = ABAP_TRUE.
READ FILETAB INDEX 1 INTO FILEREC.
FSIZE = FILEREC-FILELENGTH.
ENDIF.Hope this helps you,
Regards,
Rob.
Hi, profs!
I found a problem using CL_GUI_FRONTEND_SERVICES meth FILE_GET_SIZE. It does not return an value.
I tried FILE_EXIST, FILE_GET_ATTRIBUTES - all works properly, but not FILE_GET_SIZE. At all! I tried with existing file and not existing - always 0.
Is anybody familiar with this problem?
With best regards,
Constantine
PS
Frontend MS WIN XP SP2, SAP GUI 640, Path level 11
System SAP R/3 4.7 620
Patches:
SAP_BASIS 620 0050 SAPKB62050
SAP_ABA 620 0050 SAPKA62050
2005 Jul 21 2:16 PM
Hi Konstantin,
No not familiar, but that is because i use the following code to determine both the existance AND the file size of any file:
DATA: FILETAB TYPE TABLE OF FILE_INFO,
FILEREC TYPE FILE_INFO,
COUNT TYPE i,
FZISE TYPE i.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = '<Yourfilename>'
FILTER = ''
FILES_ONLY = 'X'
CHANGING
FILE_TABLE = FILETAB
COUNT = COUNT
EXCEPTIONS
CNTL_ERROR = 1
DIRECTORY_LIST_FILES_FAILED = 2
WRONG_PARAMETER = 3
ERROR_NO_GUI = 4
others = 5.
IF SY-SUBRC <> 0.
RAISE CNTL_ERROR.
ENDIF.
IF COUNT = 0.
* Does not exist
RESULT = ABAP_FALSE.
FSIZE = 0.
ELSE.
* Does exist
RESULT = ABAP_TRUE.
READ FILETAB INDEX 1 INTO FILEREC.
FSIZE = FILEREC-FILELENGTH.
ENDIF.Hope this helps you,
Regards,
Rob.
2005 Jul 21 3:00 PM
Thanks, Rob!
I spent some time and find func working properly - GUI_GET_FILE_INFO. Not very clever, but fast.
I tryed foollow you suggestion - all ok.
I think i try to measure processing time for both methods and apply fastest.
Greatly thanks,
Constantin
2005 Jul 21 3:00 PM
Hi Konstantin ,
method file_get_size works - you've forgotten the <b>flush</b>!
try that:
CALL METHOD cl_gui_frontend_services=>file_get_size
EXPORTING
file_name = str
IMPORTING
file_size = size.
<b>CALL METHOD cl_gui_cfw=>flush( ).</b>
WRITE: / file(50), size.regards Andreas
Message was edited by: Andreas Mann
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |