Skip to Content
author's profile photo Former Member
Former Member

Reg: FILE_GET_SIZE

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2007 at 06:36 AM

    can you paste your whole code?

    Regards,

    Atish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2007 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2007 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2007 at 06:59 AM

    The file should be closed, during execution of program & data type of gv_size should be i.

    data : Gv_size type i.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2007 at 07:05 AM

    Hi,

    I have already declared the file size as i.

    Data: gv_filesize type i.

    Regards,

    Suganya.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.