10-23-2007 7:30 AM
Hi Group,
I want to know the size of the excel file which i am uploading to the internal table.
i am using the method file_get_size.
CALL METHOD cl_gui_frontend_services=>file_get_size
EXPORTING
file_name = gv_file
IMPORTING
file_size = gv_filesize.
the problem is for the first time the filesize is 0 the actual size is not displaying in the filesize.
What is the problem here????
thanks in advance
Regards,
Suganya.
10-23-2007 7:36 AM
10-23-2007 7:38 AM
Hi,
If you are uploading the file using FM 'GUI_UPLOAD', then the FM itself has a parameter "FILELENGTH", which will provide you the file size which is uploaded.
Best regards,
Prashant
10-23-2007 7:45 AM
Hi,
In my requirement, i want to uplaod a file into the internal. if the file is empty error message should be displayed. My code is given below:
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004.
PARAMETERS: p_fname LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
Search help for P_FNAME parameter.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = gv_cprog
dynpro_number = gv_dynnr
IMPORTING
file_name = p_fname.
AT SELECTION-SCREEN ON p_fname.
Check whether the given file name exists or not
gv_file = p_fname.
gv_fileexists = cl_gui_frontend_services=>file_exist( gv_file ).
IF gv_fileexists IS INITIAL.
MESSAGE e002(zmsg_ss). " file does not exist
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_get_size
EXPORTING
file_name = gv_file
IMPORTING
file_size = gv_filesize.
IF gv_filesize EQ 0.
MESSAGE e003(zmsg_ss). " file is empty
ENDIF.
Regards,
Suganya.
10-23-2007 7:50 AM
Hi,
Can you move code from AT SELECT..
To START-OF_SE..
Regards,
Atish
10-23-2007 7:56 AM
Hi,
Same problem is coming again..
i guess the problem is with the method. the file_size is empty for the first excution and for the second excution the file size is 16000 but my actual file size is 600.
regards,
Suganya.
10-23-2007 7:59 AM
The file should be closed, during execution of program & data type of gv_size should be i.
data : Gv_size type i.
10-23-2007 8:05 AM
Hi,
I have already declared the file size as i.
Data: gv_filesize type i.
Regards,
Suganya.
10-23-2007 8:28 AM
hi,
try to insert line after calling method file_size:
<b>CALL METHOD cl_gui_cfw=>flush.</b>
Message was edited by:
Andreas Mann
12-17-2015 7:53 PM
Excellent Andreas.. Cheers... It's solve my problem too...
Thanks
Gourab