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

Get Number of Rows in Excel sheet at runtime

i have a problem. i want to pass value to end_row parameter in 'ALSM_EXCEL_TO_INTERNAL_TABLE' function module at runtime.The excel file (XLS) user is selecting can have any number of rows . so i need to get number of rows in the excel file(.XLS) which contains data at runtime.

with regards,

suresh.p.s

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 05, 2005 at 08:09 PM

    after uploading to itab get the itab count using describe table itab lines v_lines.

    regards

    vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2005 at 08:10 PM

    I guess you would first have to upload it to your program, then do a describe table to get the number of lines.

    
    
    report zrich_0001.
    
    data: itab(1000) type c occurs 0 with header line.
    data: tab_lines type i.
    data: file type string.
    
    call function 'GUI_UPLOAD'
         exporting
              filename = file
              filetype = 'ASC'
         tables
              data_tab = itab.
    
    
    describe table itab lines tab_lines.
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Why do you even what to pass specific values anyway. Just set them high, and let the funtion module bring you the data.

      
      report zrich_0001.
      
      
      
      data: itab type table of alsmex_tabline with header line.
      data: tab_lines type i.
      data: file type rlgrap-filename.
      
      file = 'C:test.xls'.
      
      
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        exporting
          filename                      = file
      <b>    i_begin_col                   = 1
          i_begin_row                   = 1
          i_end_col                     = 250
          i_end_row                     = 65000</b>
        tables
          intern                        = itab
      * EXCEPTIONS
      *   INCONSISTENT_PARAMETERS       = 1
      *   UPLOAD_OLE                    = 2
      *   OTHERS                        = 3
                .
      if sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      
      
      loop at itab.
        write:/ itab.
      endloop.
      
      
      

      Regards,

      Rich Heilman

  • Posted on Dec 05, 2005 at 08:28 PM

    Hi Suresh

    Did you got the solution or still loking for some thing else..

    regards

    vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2005 at 11:01 PM

    Why do you have to count the number of rows, just pass a big value to end_rows that should solve your problem .

    Pass a value like 999999 to this parameter.

    Regards

    Kalidas

    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.